aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/wire_format.h
diff options
context:
space:
mode:
authorGravatar jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2014-07-18 00:47:59 +0000
committerGravatar jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2014-07-18 00:47:59 +0000
commit4de8f55113007fdc8e34107950e605fc0209d465 (patch)
tree92b7da8757a7740d9e1f2d3ead233542947d8c8c /src/google/protobuf/wire_format.h
parentc5553a3d18f80132b9079c5504bc0aa1f7f950a0 (diff)
down integrate to svn
Diffstat (limited to 'src/google/protobuf/wire_format.h')
-rw-r--r--src/google/protobuf/wire_format.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/google/protobuf/wire_format.h b/src/google/protobuf/wire_format.h
index 6cc90029..0c05c0d8 100644
--- a/src/google/protobuf/wire_format.h
+++ b/src/google/protobuf/wire_format.h
@@ -79,7 +79,7 @@ class LIBPROTOBUF_EXPORT WireFormat {
static inline WireFormatLite::WireType WireTypeForField(
const FieldDescriptor* field);
- // Given a FieldSescriptor::Type return its WireType
+ // Given a FieldDescriptor::Type return its WireType
static inline WireFormatLite::WireType WireTypeForFieldType(
FieldDescriptor::Type type);
@@ -180,7 +180,7 @@ class LIBPROTOBUF_EXPORT WireFormat {
// of packed repeated fields.
static uint32 MakeTag(const FieldDescriptor* field);
- // Parse a single field. The input should start out positioned immidately
+ // Parse a single field. The input should start out positioned immediately
// after the tag.
static bool ParseAndMergeField(
uint32 tag,
@@ -228,14 +228,34 @@ class LIBPROTOBUF_EXPORT WireFormat {
};
// Verifies that a string field is valid UTF8, logging an error if not.
+ // This function will not be called by newly generated protobuf code
+ // but remains present to support existing code.
static void VerifyUTF8String(const char* data, int size, Operation op);
+ // The NamedField variant takes a field name in order to produce an
+ // informative error message if verification fails.
+ static void VerifyUTF8StringNamedField(const char* data,
+ int size,
+ Operation op,
+ const char* field_name);
private:
// Verifies that a string field is valid UTF8, logging an error if not.
static void VerifyUTF8StringFallback(
const char* data,
int size,
- Operation op);
+ Operation op,
+ const char* field_name);
+
+ // Skip a MessageSet field.
+ static bool SkipMessageSetField(io::CodedInputStream* input,
+ uint32 field_number,
+ UnknownFieldSet* unknown_fields);
+
+ // Parse a MessageSet field.
+ static bool ParseAndMergeMessageSetField(uint32 field_number,
+ const FieldDescriptor* field,
+ Message* message,
+ io::CodedInputStream* input);
@@ -293,13 +313,21 @@ inline int WireFormat::TagSize(int field_number, FieldDescriptor::Type type) {
inline void WireFormat::VerifyUTF8String(const char* data, int size,
WireFormat::Operation op) {
#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
- WireFormat::VerifyUTF8StringFallback(data, size, op);
+ WireFormat::VerifyUTF8StringFallback(data, size, op, NULL);
#else
// Avoid the compiler warning about unsued variables.
(void)data; (void)size; (void)op;
#endif
}
+inline void WireFormat::VerifyUTF8StringNamedField(
+ const char* data, int size, WireFormat::Operation op,
+ const char* field_name) {
+#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
+ WireFormat::VerifyUTF8StringFallback(data, size, op, field_name);
+#endif
+}
+
} // namespace internal
} // namespace protobuf