Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1197)

Side by Side Diff: third_party/protobuf/objectivec/GPBExtensionInternals.m

Issue 2599263002: third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Address comments Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 27 matching lines...) Expand all
38 #import "GPBMessage_PackagePrivate.h" 38 #import "GPBMessage_PackagePrivate.h"
39 #import "GPBUtilities_PackagePrivate.h" 39 #import "GPBUtilities_PackagePrivate.h"
40 40
41 static id NewSingleValueFromInputStream(GPBExtensionDescriptor *extension, 41 static id NewSingleValueFromInputStream(GPBExtensionDescriptor *extension,
42 GPBCodedInputStream *input, 42 GPBCodedInputStream *input,
43 GPBExtensionRegistry *extensionRegistry, 43 GPBExtensionRegistry *extensionRegistry,
44 GPBMessage *existingValue) 44 GPBMessage *existingValue)
45 __attribute__((ns_returns_retained)); 45 __attribute__((ns_returns_retained));
46 46
47 GPB_INLINE size_t DataTypeSize(GPBDataType dataType) { 47 GPB_INLINE size_t DataTypeSize(GPBDataType dataType) {
48 #pragma clang diagnostic push
49 #pragma clang diagnostic ignored "-Wswitch-enum"
48 switch (dataType) { 50 switch (dataType) {
49 case GPBDataTypeBool: 51 case GPBDataTypeBool:
50 return 1; 52 return 1;
51 case GPBDataTypeFixed32: 53 case GPBDataTypeFixed32:
52 case GPBDataTypeSFixed32: 54 case GPBDataTypeSFixed32:
53 case GPBDataTypeFloat: 55 case GPBDataTypeFloat:
54 return 4; 56 return 4;
55 case GPBDataTypeFixed64: 57 case GPBDataTypeFixed64:
56 case GPBDataTypeSFixed64: 58 case GPBDataTypeSFixed64:
57 case GPBDataTypeDouble: 59 case GPBDataTypeDouble:
58 return 8; 60 return 8;
59 default: 61 default:
60 return 0; 62 return 0;
61 } 63 }
64 #pragma clang diagnostic pop
62 } 65 }
63 66
64 static size_t ComputePBSerializedSizeNoTagOfObject(GPBDataType dataType, id obje ct) { 67 static size_t ComputePBSerializedSizeNoTagOfObject(GPBDataType dataType, id obje ct) {
65 #define FIELD_CASE(TYPE, ACCESSOR) \ 68 #define FIELD_CASE(TYPE, ACCESSOR) \
66 case GPBDataType##TYPE: \ 69 case GPBDataType##TYPE: \
67 return GPBCompute##TYPE##SizeNoTag([(NSNumber *)object ACCESSOR]); 70 return GPBCompute##TYPE##SizeNoTag([(NSNumber *)object ACCESSOR]);
68 #define FIELD_CASE2(TYPE) \ 71 #define FIELD_CASE2(TYPE) \
69 case GPBDataType##TYPE: \ 72 case GPBDataType##TYPE: \
70 return GPBCompute##TYPE##SizeNoTag(object); 73 return GPBCompute##TYPE##SizeNoTag(object);
71 switch (dataType) { 74 switch (dataType) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 for (id value in values) { 257 for (id value in values) {
255 WriteObjectNoTagToCodedOutputStream(value, description, output); 258 WriteObjectNoTagToCodedOutputStream(value, description, output);
256 } 259 }
257 } else { 260 } else {
258 for (id value in values) { 261 for (id value in values) {
259 WriteObjectIncludingTagToCodedOutputStream(value, description, output); 262 WriteObjectIncludingTagToCodedOutputStream(value, description, output);
260 } 263 }
261 } 264 }
262 } 265 }
263 266
267 // Direct access is use for speed, to avoid even internally declaring things
268 // read/write, etc. The warning is enabled in the project to ensure code calling
269 // protos can turn on -Wdirect-ivar-access without issues.
270 #pragma clang diagnostic push
271 #pragma clang diagnostic ignored "-Wdirect-ivar-access"
272
264 void GPBExtensionMergeFromInputStream(GPBExtensionDescriptor *extension, 273 void GPBExtensionMergeFromInputStream(GPBExtensionDescriptor *extension,
265 BOOL isPackedOnStream, 274 BOOL isPackedOnStream,
266 GPBCodedInputStream *input, 275 GPBCodedInputStream *input,
267 GPBExtensionRegistry *extensionRegistry, 276 GPBExtensionRegistry *extensionRegistry,
268 GPBMessage *message) { 277 GPBMessage *message) {
269 GPBExtensionDescription *description = extension->description_; 278 GPBExtensionDescription *description = extension->description_;
270 GPBCodedInputStreamState *state = &input->state_; 279 GPBCodedInputStreamState *state = &input->state_;
271 if (isPackedOnStream) { 280 if (isPackedOnStream) {
272 NSCAssert(GPBExtensionIsRepeated(description), 281 NSCAssert(GPBExtensionIsRepeated(description),
273 @"How was it packed if it isn't repeated?"); 282 @"How was it packed if it isn't repeated?");
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 [input readMessage:message extensionRegistry:extensionRegistry]; 380 [input readMessage:message extensionRegistry:extensionRegistry];
372 } 381 }
373 } 382 }
374 383
375 return message; 384 return message;
376 } 385 }
377 } 386 }
378 387
379 return nil; 388 return nil;
380 } 389 }
390
391 #pragma clang diagnostic pop
OLDNEW
« no previous file with comments | « third_party/protobuf/objectivec/GPBDictionary.m ('k') | third_party/protobuf/objectivec/GPBExtensionRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698