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

Side by Side Diff: third_party/protobuf/objectivec/GPBWireFormat.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 GPBWireFormat GPBWireFormatGetTagWireType(uint32_t tag) { 44 GPBWireFormat GPBWireFormatGetTagWireType(uint32_t tag) {
45 return (GPBWireFormat)(tag & GPBWireFormatTagTypeMask); 45 return (GPBWireFormat)(tag & GPBWireFormatTagTypeMask);
46 } 46 }
47 47
48 uint32_t GPBWireFormatGetTagFieldNumber(uint32_t tag) { 48 uint32_t GPBWireFormatGetTagFieldNumber(uint32_t tag) {
49 return GPBLogicalRightShift32(tag, GPBWireFormatTagTypeBits); 49 return GPBLogicalRightShift32(tag, GPBWireFormatTagTypeBits);
50 } 50 }
51 51
52 BOOL GPBWireFormatIsValidTag(uint32_t tag) {
53 uint32_t formatBits = (tag & GPBWireFormatTagTypeMask);
54 // The valid GPBWireFormat* values are 0-5, anything else is not a valid tag.
55 BOOL result = (formatBits <= 5);
56 return result;
57 }
58
52 GPBWireFormat GPBWireFormatForType(GPBDataType type, BOOL isPacked) { 59 GPBWireFormat GPBWireFormatForType(GPBDataType type, BOOL isPacked) {
53 if (isPacked) { 60 if (isPacked) {
54 return GPBWireFormatLengthDelimited; 61 return GPBWireFormatLengthDelimited;
55 } 62 }
56 63
57 static const GPBWireFormat format[GPBDataType_Count] = { 64 static const GPBWireFormat format[GPBDataType_Count] = {
58 GPBWireFormatVarint, // GPBDataTypeBool 65 GPBWireFormatVarint, // GPBDataTypeBool
59 GPBWireFormatFixed32, // GPBDataTypeFixed32 66 GPBWireFormatFixed32, // GPBDataTypeFixed32
60 GPBWireFormatFixed32, // GPBDataTypeSFixed32 67 GPBWireFormatFixed32, // GPBDataTypeSFixed32
61 GPBWireFormatFixed32, // GPBDataTypeFloat 68 GPBWireFormatFixed32, // GPBDataTypeFloat
62 GPBWireFormatFixed64, // GPBDataTypeFixed64 69 GPBWireFormatFixed64, // GPBDataTypeFixed64
63 GPBWireFormatFixed64, // GPBDataTypeSFixed64 70 GPBWireFormatFixed64, // GPBDataTypeSFixed64
64 GPBWireFormatFixed64, // GPBDataTypeDouble 71 GPBWireFormatFixed64, // GPBDataTypeDouble
65 GPBWireFormatVarint, // GPBDataTypeInt32 72 GPBWireFormatVarint, // GPBDataTypeInt32
66 GPBWireFormatVarint, // GPBDataTypeInt64 73 GPBWireFormatVarint, // GPBDataTypeInt64
67 GPBWireFormatVarint, // GPBDataTypeSInt32 74 GPBWireFormatVarint, // GPBDataTypeSInt32
68 GPBWireFormatVarint, // GPBDataTypeSInt64 75 GPBWireFormatVarint, // GPBDataTypeSInt64
69 GPBWireFormatVarint, // GPBDataTypeUInt32 76 GPBWireFormatVarint, // GPBDataTypeUInt32
70 GPBWireFormatVarint, // GPBDataTypeUInt64 77 GPBWireFormatVarint, // GPBDataTypeUInt64
71 GPBWireFormatLengthDelimited, // GPBDataTypeBytes 78 GPBWireFormatLengthDelimited, // GPBDataTypeBytes
72 GPBWireFormatLengthDelimited, // GPBDataTypeString 79 GPBWireFormatLengthDelimited, // GPBDataTypeString
73 GPBWireFormatLengthDelimited, // GPBDataTypeMessage 80 GPBWireFormatLengthDelimited, // GPBDataTypeMessage
74 GPBWireFormatStartGroup, // GPBDataTypeGroup 81 GPBWireFormatStartGroup, // GPBDataTypeGroup
75 GPBWireFormatVarint // GPBDataTypeEnum 82 GPBWireFormatVarint // GPBDataTypeEnum
76 }; 83 };
77 return format[type]; 84 return format[type];
78 } 85 }
OLDNEW
« no previous file with comments | « third_party/protobuf/objectivec/GPBWireFormat.h ('k') | third_party/protobuf/objectivec/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698