aboutsummaryrefslogtreecommitdiffstats
path: root/src/google/protobuf/compiler/javanano/javanano_enum_field.h
diff options
context:
space:
mode:
authorMax Cai <maxtroy@google.com>2014-01-15 18:47:56 +0000
committerMax Cai <maxtroy@google.com>2014-01-16 12:41:15 +0000
commitd888895a3b5cf764856d3a94ed526bf9994c1800 (patch)
tree813ff16316503cf10e22e894e99debd9ed812317 /src/google/protobuf/compiler/javanano/javanano_enum_field.h
parenta8af729b5ef822971f025a7e8ff197545986910d (diff)
downloadexternal_protobuf-d888895a3b5cf764856d3a94ed526bf9994c1800.zip
external_protobuf-d888895a3b5cf764856d3a94ed526bf9994c1800.tar.gz
external_protobuf-d888895a3b5cf764856d3a94ed526bf9994c1800.tar.bz2
Add validation when parsing enum fields.
Invalid values from the wire are silently ignored. Unlike full/lite, the invalid values are not stored into the unknown fields, because there's no way to get them out from Nano's unknown fields without a matching Extension. Edited README and slightly moved it towards a standalone section for Nano, independent of the Micro section. Change-Id: I2c1eb07f4d6d8f3aea242b8ddd95b9c966f3f177
Diffstat (limited to 'src/google/protobuf/compiler/javanano/javanano_enum_field.h')
-rw-r--r--src/google/protobuf/compiler/javanano/javanano_enum_field.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_enum_field.h b/src/google/protobuf/compiler/javanano/javanano_enum_field.h
index c477af2..55bf635 100644
--- a/src/google/protobuf/compiler/javanano/javanano_enum_field.h
+++ b/src/google/protobuf/compiler/javanano/javanano_enum_field.h
@@ -37,6 +37,7 @@
#include <map>
#include <string>
+#include <vector>
#include <google/protobuf/compiler/javanano/javanano_field.h>
namespace google {
@@ -62,6 +63,7 @@ class EnumFieldGenerator : public FieldGenerator {
private:
const FieldDescriptor* descriptor_;
map<string, string> variables_;
+ vector<string> canonical_values_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
};
@@ -84,6 +86,7 @@ class AccessorEnumFieldGenerator : public FieldGenerator {
private:
const FieldDescriptor* descriptor_;
map<string, string> variables_;
+ vector<string> canonical_values_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorEnumFieldGenerator);
};
@@ -109,6 +112,7 @@ class RepeatedEnumFieldGenerator : public FieldGenerator {
const FieldDescriptor* descriptor_;
map<string, string> variables_;
+ vector<string> canonical_values_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);
};