|
|
|
@ -965,27 +965,18 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) { |
|
|
|
|
extensionRegistry:(id<GPBExtensionRegistry>)extensionRegistry |
|
|
|
|
error:(NSError **)errorPtr { |
|
|
|
|
if ((self = [self init])) { |
|
|
|
|
@try { |
|
|
|
|
[self mergeFromData:data extensionRegistry:extensionRegistry]; |
|
|
|
|
if (errorPtr) { |
|
|
|
|
*errorPtr = nil; |
|
|
|
|
} |
|
|
|
|
} @catch (NSException *exception) { |
|
|
|
|
if (![self mergeFromData:data extensionRegistry:extensionRegistry error:errorPtr]) { |
|
|
|
|
[self release]; |
|
|
|
|
self = nil; |
|
|
|
|
if (errorPtr) { |
|
|
|
|
*errorPtr = ErrorFromException(exception); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
if (self && !self.initialized) { |
|
|
|
|
} else if (!self.initialized) { |
|
|
|
|
[self release]; |
|
|
|
|
self = nil; |
|
|
|
|
if (errorPtr) { |
|
|
|
|
*errorPtr = MessageError(GPBMessageErrorCodeMissingRequiredField, nil); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return self; |
|
|
|
|
} |
|
|
|
@ -2004,6 +1995,27 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (BOOL)mergeFromData:(NSData *)data |
|
|
|
|
extensionRegistry:(nullable id<GPBExtensionRegistry>)extensionRegistry |
|
|
|
|
error:(NSError **)errorPtr { |
|
|
|
|
GPBCodedInputStream *input = [[GPBCodedInputStream alloc] initWithData:data]; |
|
|
|
|
@try { |
|
|
|
|
[self mergeFromCodedInputStream:input extensionRegistry:extensionRegistry]; |
|
|
|
|
[input checkLastTagWas:0]; |
|
|
|
|
if (errorPtr) { |
|
|
|
|
*errorPtr = nil; |
|
|
|
|
} |
|
|
|
|
} @catch (NSException *exception) { |
|
|
|
|
[input release]; |
|
|
|
|
if (errorPtr) { |
|
|
|
|
*errorPtr = ErrorFromException(exception); |
|
|
|
|
} |
|
|
|
|
return NO; |
|
|
|
|
} |
|
|
|
|
[input release]; |
|
|
|
|
return YES; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#pragma mark - Parse From Data Support |
|
|
|
|
|
|
|
|
|
+ (instancetype)parseFromData:(NSData *)data error:(NSError **)errorPtr { |
|
|
|
|