aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2016-07-18 11:10:02 -0400
committerJorge Canizales <jcanizales@google.com>2016-07-19 11:35:12 -0700
commit9707365756900484acba504e4c09b7b2828d9354 (patch)
tree70c054983ff0d052673e8e68733b0c0f247c9747
parent56855f6f002eeee8cf03021eaf2ece2adff2a297 (diff)
downloadprotobuf-9707365756900484acba504e4c09b7b2828d9354.tar.gz
protobuf-9707365756900484acba504e4c09b7b2828d9354.tar.bz2
protobuf-9707365756900484acba504e4c09b7b2828d9354.zip
Use public methods to fetch oneofs in generated code.
When building into frameworks, the generated code doesn't always have direct access to the proto internals. Instead of opening up the access, just use the public method to fetch the correct oneof. Fixes https://github.com/google/protobuf/issues/1789
-rw-r--r--objectivec/google/protobuf/Struct.pbobjc.m2
-rw-r--r--src/google/protobuf/compiler/objectivec/objectivec_oneof.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/objectivec/google/protobuf/Struct.pbobjc.m b/objectivec/google/protobuf/Struct.pbobjc.m
index 538faab3..8ea1f124 100644
--- a/objectivec/google/protobuf/Struct.pbobjc.m
+++ b/objectivec/google/protobuf/Struct.pbobjc.m
@@ -237,7 +237,7 @@ void SetGPBValue_NullValue_RawValue(GPBValue *message, int32_t value) {
void GPBValue_ClearKindOneOfCase(GPBValue *message) {
GPBDescriptor *descriptor = [message descriptor];
- GPBOneofDescriptor *oneof = descriptor->oneofs_[0];
+ GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0];
GPBMaybeClearOneof(message, oneof, -1, 0);
}
#pragma mark - GPBListValue
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc b/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
index 44bafd7f..3dda903b 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
@@ -119,7 +119,7 @@ void OneofGenerator::GenerateClearFunctionImplementation(io::Printer* printer) {
variables_,
"void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message) {\n"
" GPBDescriptor *descriptor = [message descriptor];\n"
- " GPBOneofDescriptor *oneof = descriptor->oneofs_[$raw_index$];\n"
+ " GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:$raw_index$];\n"
" GPBMaybeClearOneof(message, oneof, $index$, 0);\n"
"}\n");
}