diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2018-07-16 16:41:38 -0700 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2018-07-16 16:42:10 -0700 |
commit | 79f2adc50a23949d14b0da7d12a5d1451748e82c (patch) | |
tree | a35a24f07f7f934d05aed6fd2089b4a844133ba1 /src | |
parent | dcfe38c58f5be4e0896771dc971fb4b197892709 (diff) | |
download | flatbuffers-79f2adc50a23949d14b0da7d12a5d1451748e82c.tar.gz flatbuffers-79f2adc50a23949d14b0da7d12a5d1451748e82c.tar.bz2 flatbuffers-79f2adc50a23949d14b0da7d12a5d1451748e82c.zip |
Renamed Verifier methods
The name Verify was getting too overloaded, and confused
the VS compiler
Change-Id: I26423a4d513e4def2f4e41d7f278bb683fc12518
Diffstat (limited to 'src')
-rw-r--r-- | src/idl_gen_cpp.cpp | 6 | ||||
-rw-r--r-- | src/reflection.cpp | 24 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index 060f4bc6..5db8e5a0 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -1116,7 +1116,7 @@ class CppGenerator : public BaseGenerator { } } else if (ev.union_type.base_type == BASE_TYPE_STRING) { code_ += getptr; - code_ += " return verifier.Verify(ptr);"; + code_ += " return verifier.VerifyString(ptr);"; } else { FLATBUFFERS_ASSERT(false); } @@ -1503,11 +1503,11 @@ class CppGenerator : public BaseGenerator { break; } case BASE_TYPE_STRING: { - code_ += "{{PRE}}verifier.Verify({{NAME}}())\\"; + code_ += "{{PRE}}verifier.VerifyString({{NAME}}())\\"; break; } case BASE_TYPE_VECTOR: { - code_ += "{{PRE}}verifier.Verify({{NAME}}())\\"; + code_ += "{{PRE}}verifier.VerifyVector({{NAME}}())\\"; switch (field.value.type.element) { case BASE_TYPE_STRING: { diff --git a/src/reflection.cpp b/src/reflection.cpp index a5147f0e..61c1ba73 100644 --- a/src/reflection.cpp +++ b/src/reflection.cpp @@ -507,7 +507,7 @@ bool VerifyVectorOfStructs(flatbuffers::Verifier &v, auto p = parent_table.GetPointer<const uint8_t *>(field_offset); if (required && !p) { return false; } - return !p || v.VerifyVector(p, obj.bytesize()); + return !p || v.VerifyVectorOrString(p, obj.bytesize()); } // forward declare to resolve cyclic deps between VerifyObject and VerifyVector @@ -524,29 +524,29 @@ bool VerifyVector(flatbuffers::Verifier &v, const reflection::Schema &schema, switch (vec_field.type()->element()) { case reflection::None: FLATBUFFERS_ASSERT(false); break; case reflection::UType: - return v.Verify(flatbuffers::GetFieldV<uint8_t>(table, vec_field)); + return v.VerifyVector(flatbuffers::GetFieldV<uint8_t>(table, vec_field)); case reflection::Bool: case reflection::Byte: case reflection::UByte: - return v.Verify(flatbuffers::GetFieldV<int8_t>(table, vec_field)); + return v.VerifyVector(flatbuffers::GetFieldV<int8_t>(table, vec_field)); case reflection::Short: case reflection::UShort: - return v.Verify(flatbuffers::GetFieldV<int16_t>(table, vec_field)); + return v.VerifyVector(flatbuffers::GetFieldV<int16_t>(table, vec_field)); case reflection::Int: case reflection::UInt: - return v.Verify(flatbuffers::GetFieldV<int32_t>(table, vec_field)); + return v.VerifyVector(flatbuffers::GetFieldV<int32_t>(table, vec_field)); case reflection::Long: case reflection::ULong: - return v.Verify(flatbuffers::GetFieldV<int64_t>(table, vec_field)); + return v.VerifyVector(flatbuffers::GetFieldV<int64_t>(table, vec_field)); case reflection::Float: - return v.Verify(flatbuffers::GetFieldV<float>(table, vec_field)); + return v.VerifyVector(flatbuffers::GetFieldV<float>(table, vec_field)); case reflection::Double: - return v.Verify(flatbuffers::GetFieldV<double>(table, vec_field)); + return v.VerifyVector(flatbuffers::GetFieldV<double>(table, vec_field)); case reflection::String: { - auto vecString = + auto vec_string = flatbuffers::GetFieldV<flatbuffers::Offset<flatbuffers::String>>( table, vec_field); - if (v.Verify(vecString) && v.VerifyVectorOfStrings(vecString)) { + if (v.VerifyVector(vec_string) && v.VerifyVectorOfStrings(vec_string)) { return true; } else { return false; @@ -564,7 +564,7 @@ bool VerifyVector(flatbuffers::Verifier &v, const reflection::Schema &schema, auto vec = flatbuffers::GetFieldV<flatbuffers::Offset<flatbuffers::Table>>( table, vec_field); - if (!v.Verify(vec)) return false; + if (!v.VerifyVector(vec)) return false; if (vec) { for (uoffset_t j = 0; j < vec->size(); j++) { if (!VerifyObject(v, schema, *obj, vec->Get(j), true)) { @@ -626,7 +626,7 @@ bool VerifyObject(flatbuffers::Verifier &v, const reflection::Schema &schema, break; case reflection::String: if (!table->VerifyField<uoffset_t>(v, field_def->offset()) || - !v.Verify(flatbuffers::GetFieldS(*table, *field_def))) { + !v.VerifyString(flatbuffers::GetFieldS(*table, *field_def))) { return false; } break; |