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

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

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: 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"
50 switch (dataType) { 48 switch (dataType) {
51 case GPBDataTypeBool: 49 case GPBDataTypeBool:
52 return 1; 50 return 1;
53 case GPBDataTypeFixed32: 51 case GPBDataTypeFixed32:
54 case GPBDataTypeSFixed32: 52 case GPBDataTypeSFixed32:
55 case GPBDataTypeFloat: 53 case GPBDataTypeFloat:
56 return 4; 54 return 4;
57 case GPBDataTypeFixed64: 55 case GPBDataTypeFixed64:
58 case GPBDataTypeSFixed64: 56 case GPBDataTypeSFixed64:
59 case GPBDataTypeDouble: 57 case GPBDataTypeDouble:
60 return 8; 58 return 8;
61 default: 59 default:
62 return 0; 60 return 0;
63 } 61 }
64 #pragma clang diagnostic pop
65 } 62 }
66 63
67 static size_t ComputePBSerializedSizeNoTagOfObject(GPBDataType dataType, id obje ct) { 64 static size_t ComputePBSerializedSizeNoTagOfObject(GPBDataType dataType, id obje ct) {
68 #define FIELD_CASE(TYPE, ACCESSOR) \ 65 #define FIELD_CASE(TYPE, ACCESSOR) \
69 case GPBDataType##TYPE: \ 66 case GPBDataType##TYPE: \
70 return GPBCompute##TYPE##SizeNoTag([(NSNumber *)object ACCESSOR]); 67 return GPBCompute##TYPE##SizeNoTag([(NSNumber *)object ACCESSOR]);
71 #define FIELD_CASE2(TYPE) \ 68 #define FIELD_CASE2(TYPE) \
72 case GPBDataType##TYPE: \ 69 case GPBDataType##TYPE: \
73 return GPBCompute##TYPE##SizeNoTag(object); 70 return GPBCompute##TYPE##SizeNoTag(object);
74 switch (dataType) { 71 switch (dataType) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 for (id value in values) { 254 for (id value in values) {
258 WriteObjectNoTagToCodedOutputStream(value, description, output); 255 WriteObjectNoTagToCodedOutputStream(value, description, output);
259 } 256 }
260 } else { 257 } else {
261 for (id value in values) { 258 for (id value in values) {
262 WriteObjectIncludingTagToCodedOutputStream(value, description, output); 259 WriteObjectIncludingTagToCodedOutputStream(value, description, output);
263 } 260 }
264 } 261 }
265 } 262 }
266 263
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
273 void GPBExtensionMergeFromInputStream(GPBExtensionDescriptor *extension, 264 void GPBExtensionMergeFromInputStream(GPBExtensionDescriptor *extension,
274 BOOL isPackedOnStream, 265 BOOL isPackedOnStream,
275 GPBCodedInputStream *input, 266 GPBCodedInputStream *input,
276 GPBExtensionRegistry *extensionRegistry, 267 GPBExtensionRegistry *extensionRegistry,
277 GPBMessage *message) { 268 GPBMessage *message) {
278 GPBExtensionDescription *description = extension->description_; 269 GPBExtensionDescription *description = extension->description_;
279 GPBCodedInputStreamState *state = &input->state_; 270 GPBCodedInputStreamState *state = &input->state_;
280 if (isPackedOnStream) { 271 if (isPackedOnStream) {
281 NSCAssert(GPBExtensionIsRepeated(description), 272 NSCAssert(GPBExtensionIsRepeated(description),
282 @"How was it packed if it isn't repeated?"); 273 @"How was it packed if it isn't repeated?");
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 [input readMessage:message extensionRegistry:extensionRegistry]; 371 [input readMessage:message extensionRegistry:extensionRegistry];
381 } 372 }
382 } 373 }
383 374
384 return message; 375 return message;
385 } 376 }
386 } 377 }
387 378
388 return nil; 379 return nil;
389 } 380 }
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