aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBMessage.m
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2016-05-27 12:51:18 -0400
committerThomas Van Lenten <thomasvl@google.com>2016-05-27 12:52:35 -0400
commit38b9e74691b484d2521fc6d8f421fc3dc14aa143 (patch)
tree86d27bd76f0ce069e207194676619fbf700f69bf /objectivec/GPBMessage.m
parent0f27cab4fb378b94a91c2b1522174ec21719df9d (diff)
downloadprotobuf-38b9e74691b484d2521fc6d8f421fc3dc14aa143.tar.gz
protobuf-38b9e74691b484d2521fc6d8f421fc3dc14aa143.tar.bz2
protobuf-38b9e74691b484d2521fc6d8f421fc3dc14aa143.zip
Add -Woverriding-method-mismatch.
Fixes up the code to avoid some issues with isEqual: methods. Opened https://github.com/google/protobuf/issues/1616 to track the KVC collision.
Diffstat (limited to 'objectivec/GPBMessage.m')
-rw-r--r--objectivec/GPBMessage.m11
1 files changed, 6 insertions, 5 deletions
diff --git a/objectivec/GPBMessage.m b/objectivec/GPBMessage.m
index 77b9dbd3..d1c5594c 100644
--- a/objectivec/GPBMessage.m
+++ b/objectivec/GPBMessage.m
@@ -2563,7 +2563,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
#pragma mark - isEqual: & hash Support
-- (BOOL)isEqual:(GPBMessage *)other {
+- (BOOL)isEqual:(id)other {
if (other == self) {
return YES;
}
@@ -2572,9 +2572,10 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
return NO;
}
+ GPBMessage *otherMsg = other;
GPBDescriptor *descriptor = [[self class] descriptor];
uint8_t *selfStorage = (uint8_t *)messageStorage_;
- uint8_t *otherStorage = (uint8_t *)other->messageStorage_;
+ uint8_t *otherStorage = (uint8_t *)otherMsg->messageStorage_;
for (GPBFieldDescriptor *field in descriptor->fields_) {
if (GPBFieldIsMapOrArray(field)) {
@@ -2668,14 +2669,14 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
} // for(fields)
// nil and empty are equal
- if (extensionMap_.count != 0 || other->extensionMap_.count != 0) {
- if (![extensionMap_ isEqual:other->extensionMap_]) {
+ if (extensionMap_.count != 0 || otherMsg->extensionMap_.count != 0) {
+ if (![extensionMap_ isEqual:otherMsg->extensionMap_]) {
return NO;
}
}
// nil and empty are equal
- GPBUnknownFieldSet *otherUnknowns = other->unknownFields_;
+ GPBUnknownFieldSet *otherUnknowns = otherMsg->unknownFields_;
if ([unknownFields_ countOfFields] != 0 ||
[otherUnknowns countOfFields] != 0) {
if (![unknownFields_ isEqual:otherUnknowns]) {