diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-06-27 20:45:16 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-06-27 20:46:26 -0400 |
commit | fc4c6171999243695166747108cf7d65e34bf4c0 (patch) | |
tree | 7360762dca9acb20660e0113659d382fe295996b /objectivec/GPBUtilities.m | |
parent | 2bcd43afe4b649c95d932daf31b0b83948f7cf7c (diff) | |
download | protobuf-fc4c6171999243695166747108cf7d65e34bf4c0.tar.gz protobuf-fc4c6171999243695166747108cf7d65e34bf4c0.tar.bz2 protobuf-fc4c6171999243695166747108cf7d65e34bf4c0.zip |
Fix GPBGetMessage{Repeated,Map}Field()
- Correct impl by using helpers the message wiring does.
- Add unittests.
Fixes https://github.com/google/protobuf/issues/1716
Diffstat (limited to 'objectivec/GPBUtilities.m')
-rw-r--r-- | objectivec/GPBUtilities.m | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/objectivec/GPBUtilities.m b/objectivec/GPBUtilities.m index 4280b899..05375084 100644 --- a/objectivec/GPBUtilities.m +++ b/objectivec/GPBUtilities.m @@ -895,17 +895,7 @@ void GPBSetMessageGroupField(GPBMessage *self, //%PDDM-EXPAND-END (4 expansions) -// Only exists for public api, no core code should use this. -id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field) { -#if defined(DEBUG) && DEBUG - if (field.fieldType != GPBFieldTypeRepeated) { - [NSException raise:NSInvalidArgumentException - format:@"%@.%@ is not a repeated field.", - [self class], field.name]; - } -#endif - return GPBGetObjectIvarWithField(self, field); -} +// GPBGetMessageRepeatedField is defined in GPBMessage.m // Only exists for public api, no core code should use this. void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array) { @@ -997,17 +987,7 @@ static NSString *TypeToStr(GPBDataType dataType) { } #endif -// Only exists for public api, no core code should use this. -id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) { -#if defined(DEBUG) && DEBUG - if (field.fieldType != GPBFieldTypeMap) { - [NSException raise:NSInvalidArgumentException - format:@"%@.%@ is not a map<> field.", - [self class], field.name]; - } -#endif - return GPBGetObjectIvarWithField(self, field); -} +// GPBGetMessageMapField is defined in GPBMessage.m // Only exists for public api, no core code should use this. void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, |