Commit 0d1d92d3 authored by EFanZh's avatar EFanZh Committed by Adam Cozzette

Revert "Update signatures of UTF-8 string functions to accept size_t type sizes"

This reverts commit 911e3040fa597e6a82351375d9eb416a6d3fae3a.
parent 00325ed9
......@@ -221,7 +221,7 @@ failure:
// string type_url = 1;
if (this->type_url().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_type_url().data(), this->_internal_type_url().length(),
this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Any.type_url");
target = stream->WriteStringMaybeAliased(
......
......@@ -373,7 +373,7 @@ failure:
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Api.name");
target = stream->WriteStringMaybeAliased(
......@@ -399,7 +399,7 @@ failure:
// string version = 4;
if (this->version().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_version().data(), this->_internal_version().length(),
this->_internal_version().data(), static_cast<int>(this->_internal_version().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Api.version");
target = stream->WriteStringMaybeAliased(
......@@ -756,7 +756,7 @@ failure:
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.name");
target = stream->WriteStringMaybeAliased(
......@@ -766,7 +766,7 @@ failure:
// string request_type_url = 2;
if (this->request_type_url().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_request_type_url().data(), this->_internal_request_type_url().length(),
this->_internal_request_type_url().data(), static_cast<int>(this->_internal_request_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.request_type_url");
target = stream->WriteStringMaybeAliased(
......@@ -782,7 +782,7 @@ failure:
// string response_type_url = 4;
if (this->response_type_url().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_response_type_url().data(), this->_internal_response_type_url().length(),
this->_internal_response_type_url().data(), static_cast<int>(this->_internal_response_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.response_type_url");
target = stream->WriteStringMaybeAliased(
......@@ -1077,7 +1077,7 @@ failure:
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Mixin.name");
target = stream->WriteStringMaybeAliased(
......@@ -1087,7 +1087,7 @@ failure:
// string root = 2;
if (this->root().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_root().data(), this->_internal_root().length(),
this->_internal_root().data(), static_cast<int>(this->_internal_root().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Mixin.root");
target = stream->WriteStringMaybeAliased(
......
......@@ -1030,7 +1030,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
format(
" static bool ValidateKey(std::string* s) {\n"
" return ::$proto_ns$::internal::WireFormatLite::"
"VerifyUtf8String(s->data(), s->size(), "
"VerifyUtf8String(s->data(), static_cast<int>(s->size()), "
"::$proto_ns$::internal::WireFormatLite::PARSE, \"$1$\");\n"
" }\n",
descriptor_->field(0)->full_name());
......@@ -1040,7 +1040,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
" static bool ValidateKey(std::string* s) {\n"
"#ifndef NDEBUG\n"
" ::$proto_ns$::internal::WireFormatLite::VerifyUtf8String(\n"
" s->data(), s->size(), ::$proto_ns$::internal::"
" s->data(), static_cast<int>(s->size()), ::$proto_ns$::internal::"
"WireFormatLite::PARSE, \"$1$\");\n"
"#endif\n"
" return true;\n"
......@@ -1056,7 +1056,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
format(
" static bool ValidateValue(std::string* s) {\n"
" return ::$proto_ns$::internal::WireFormatLite::"
"VerifyUtf8String(s->data(), s->size(), "
"VerifyUtf8String(s->data(), static_cast<int>(s->size()), "
"::$proto_ns$::internal::WireFormatLite::PARSE, \"$1$\");\n"
" }\n",
descriptor_->field(1)->full_name());
......@@ -1066,7 +1066,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
" static bool ValidateValue(std::string* s) {\n"
"#ifndef NDEBUG\n"
" ::$proto_ns$::internal::WireFormatLite::VerifyUtf8String(\n"
" s->data(), s->size(), ::$proto_ns$::internal::"
" s->data(), static_cast<int>(s->size()), ::$proto_ns$::internal::"
"WireFormatLite::PARSE, \"$1$\");\n"
"#endif\n"
" return true;\n"
......
......@@ -377,7 +377,7 @@ failure:
// optional string suffix = 4;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_suffix().data(), this->_internal_suffix().length(),
this->_internal_suffix().data(), static_cast<int>(this->_internal_suffix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.Version.suffix");
target = stream->WriteStringMaybeAliased(
......@@ -688,7 +688,7 @@ failure:
for (int i = 0, n = this->_internal_file_to_generate_size(); i < n; i++) {
const auto& s = this->_internal_file_to_generate(i);
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
s.data(), s.length(),
s.data(), static_cast<int>(s.length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
target = stream->WriteString(1, s, target);
......@@ -698,7 +698,7 @@ failure:
// optional string parameter = 2;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_parameter().data(), this->_internal_parameter().length(),
this->_internal_parameter().data(), static_cast<int>(this->_internal_parameter().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorRequest.parameter");
target = stream->WriteStringMaybeAliased(
......@@ -1001,7 +1001,7 @@ failure:
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.name");
target = stream->WriteStringMaybeAliased(
......@@ -1011,7 +1011,7 @@ failure:
// optional string insertion_point = 2;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_insertion_point().data(), this->_internal_insertion_point().length(),
this->_internal_insertion_point().data(), static_cast<int>(this->_internal_insertion_point().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
target = stream->WriteStringMaybeAliased(
......@@ -1021,7 +1021,7 @@ failure:
// optional string content = 15;
if (cached_has_bits & 0x00000004u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_content().data(), this->_internal_content().length(),
this->_internal_content().data(), static_cast<int>(this->_internal_content().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.content");
target = stream->WriteStringMaybeAliased(
......@@ -1277,7 +1277,7 @@ failure:
// optional string error = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_error().data(), this->_internal_error().length(),
this->_internal_error().data(), static_cast<int>(this->_internal_error().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.error");
target = stream->WriteStringMaybeAliased(
......
This diff is collapsed.
......@@ -197,7 +197,7 @@ failure:
for (int i = 0, n = this->_internal_paths_size(); i < n; i++) {
const auto& s = this->_internal_paths(i);
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
s.data(), s.length(),
s.data(), static_cast<int>(s.length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.FieldMask.paths");
target = stream->WriteString(1, s, target);
......
......@@ -298,7 +298,7 @@ static inline bool HandleString(io::CodedInputStream* input, MessageLite* msg,
if (kValidateUtf8) {
// TODO(b/118759213): fail if proto3
WireFormatLite::VerifyUtf8String(utf8_string_data.data(),
static_cast<size_t>(utf8_string_data.length()),
utf8_string_data.length(),
WireFormatLite::PARSE, field_name);
}
return true;
......
......@@ -181,7 +181,7 @@ failure:
// string file_name = 1;
if (this->file_name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_file_name().data(), this->_internal_file_name().length(),
this->_internal_file_name().data(), static_cast<int>(this->_internal_file_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.SourceContext.file_name");
target = stream->WriteStringMaybeAliased(
......
......@@ -312,7 +312,7 @@ failure:
struct Utf8Check {
static void Check(ConstPtr p) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
p->first.data(), static_cast<int>(p->first.length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Struct.FieldsEntry.key");
}
......@@ -713,7 +713,7 @@ failure:
// string string_value = 3;
if (_internal_has_string_value()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_string_value().data(), this->_internal_string_value().length(),
this->_internal_string_value().data(), static_cast<int>(this->_internal_string_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Value.string_value");
target = stream->WriteStringMaybeAliased(
......
......@@ -127,14 +127,14 @@ namespace internal {
// Checks if the buffer contains structurally-valid UTF-8. Implemented in
// structurally_valid.cc.
PROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char* buf, size_t len);
PROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char* buf, int len);
inline bool IsStructurallyValidUTF8(const std::string& str) {
return IsStructurallyValidUTF8(str.data(), str.length());
return IsStructurallyValidUTF8(str.data(), static_cast<int>(str.length()));
}
// Returns initial number of bytes of structually valid UTF-8.
PROTOBUF_EXPORT size_t UTF8SpnStructurallyValid(const StringPiece& str);
PROTOBUF_EXPORT int UTF8SpnStructurallyValid(const StringPiece& str);
// Coerce UTF-8 byte string in src_str to be
// a structurally-valid equal-length string by selectively
......
......@@ -386,8 +386,8 @@ static inline bool InStateZero(const UTF8ScanObj* st, const uint8* Tbl) {
// Set number of bytes scanned. Return reason for exiting
int UTF8GenericScan(const UTF8ScanObj* st,
const char * str,
size_t str_length,
size_t* bytes_consumed) {
int str_length,
int* bytes_consumed) {
*bytes_consumed = 0;
if (str_length == 0) return kExitOK;
......@@ -496,8 +496,8 @@ int UTF8GenericScan(const UTF8ScanObj* st,
int UTF8GenericScanFastAscii(const UTF8ScanObj* st,
const char * str,
size_t str_length,
size_t* bytes_consumed) {
int str_length,
int* bytes_consumed) {
*bytes_consumed = 0;
if (str_length == 0) return kExitOK;
......@@ -505,8 +505,8 @@ int UTF8GenericScanFastAscii(const UTF8ScanObj* st,
const uint8* src = isrc;
const uint8* srclimit = isrc + str_length;
const uint8* srclimit8 = srclimit - 7;
size_t n;
size_t rest_consumed;
int n;
int rest_consumed;
int exit_reason;
do {
// Check initial few bytes one at a time until 8-byte aligned
......@@ -553,19 +553,19 @@ InitDetector init_detector;
} // namespace
bool IsStructurallyValidUTF8(const char* buf, size_t len) {
bool IsStructurallyValidUTF8(const char* buf, int len) {
if (!module_initialized_) return true;
size_t bytes_consumed = 0;
int bytes_consumed = 0;
UTF8GenericScanFastAscii(&utf8acceptnonsurrogates_obj,
buf, len, &bytes_consumed);
return (bytes_consumed == len);
}
size_t UTF8SpnStructurallyValid(const StringPiece& str) {
int UTF8SpnStructurallyValid(const StringPiece& str) {
if (!module_initialized_) return str.size();
size_t bytes_consumed = 0;
int bytes_consumed = 0;
UTF8GenericScanFastAscii(&utf8acceptnonsurrogates_obj,
str.data(), str.size(), &bytes_consumed);
return bytes_consumed;
......@@ -587,8 +587,8 @@ char* UTF8CoerceToStructurallyValid(const StringPiece& src_str,
char* idst,
const char replace_char) {
const char* isrc = src_str.data();
const size_t len = src_str.length();
size_t n = UTF8SpnStructurallyValid(src_str);
const int len = src_str.length();
int n = UTF8SpnStructurallyValid(src_str);
if (n == len) { // Normal case -- all is cool, return
return const_cast<char*>(isrc);
} else { // Unusual case -- copy w/o bad bytes
......
......@@ -47,7 +47,7 @@ TEST(StructurallyValidTest, ValidUTF8String) {
EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data(),
valid_str.size()));
// Additional check for pointer alignment
for (size_t i = 1; i < 8; ++i) {
for (int i = 1; i < 8; ++i) {
EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data() + i,
valid_str.size() - i));
}
......@@ -58,7 +58,7 @@ TEST(StructurallyValidTest, InvalidUTF8String) {
EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data(),
invalid_str.size()));
// Additional check for pointer alignment
for (size_t i = 1; i < 8; ++i) {
for (int i = 1; i < 8; ++i) {
EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data() + i,
invalid_str.size() - i));
}
......
......@@ -375,9 +375,9 @@ void Type::unsafe_arena_set_allocated_source_context(
}
source_context_ = source_context;
if (source_context) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.source_context)
}
......@@ -570,7 +570,7 @@ failure:
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Type.name");
target = stream->WriteStringMaybeAliased(
......@@ -589,7 +589,7 @@ failure:
for (int i = 0, n = this->_internal_oneofs_size(); i < n; i++) {
const auto& s = this->_internal_oneofs(i);
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
s.data(), s.length(),
s.data(), static_cast<int>(s.length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Type.oneofs");
target = stream->WriteString(3, s, target);
......@@ -998,7 +998,7 @@ failure:
// string name = 4;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.name");
target = stream->WriteStringMaybeAliased(
......@@ -1008,7 +1008,7 @@ failure:
// string type_url = 6;
if (this->type_url().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_type_url().data(), this->_internal_type_url().length(),
this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.type_url");
target = stream->WriteStringMaybeAliased(
......@@ -1038,7 +1038,7 @@ failure:
// string json_name = 10;
if (this->json_name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_json_name().data(), this->_internal_json_name().length(),
this->_internal_json_name().data(), static_cast<int>(this->_internal_json_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.json_name");
target = stream->WriteStringMaybeAliased(
......@@ -1048,7 +1048,7 @@ failure:
// string default_value = 11;
if (this->default_value().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_default_value().data(), this->_internal_default_value().length(),
this->_internal_default_value().data(), static_cast<int>(this->_internal_default_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.default_value");
target = stream->WriteStringMaybeAliased(
......@@ -1262,9 +1262,9 @@ void Enum::unsafe_arena_set_allocated_source_context(
}
source_context_ = source_context;
if (source_context) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.source_context)
}
......@@ -1442,7 +1442,7 @@ failure:
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Enum.name");
target = stream->WriteStringMaybeAliased(
......@@ -1749,7 +1749,7 @@ failure:
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.EnumValue.name");
target = stream->WriteStringMaybeAliased(
......@@ -1901,9 +1901,9 @@ void Option::unsafe_arena_set_allocated_value(
}
value_ = value;
if (value) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.value)
}
......@@ -2039,7 +2039,7 @@ failure:
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), this->_internal_name().length(),
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Option.name");
target = stream->WriteStringMaybeAliased(
......
......@@ -158,7 +158,7 @@ util::Status JsonStreamParser::Parse(StringPiece json) {
}
// Find the structurally valid UTF8 prefix and parse only that.
size_t n = internal::UTF8SpnStructurallyValid(chunk);
int n = internal::UTF8SpnStructurallyValid(chunk);
if (n > 0) {
util::Status status = ParseChunk(chunk.substr(0, n));
......
......@@ -268,10 +268,10 @@ class PROTOBUF_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, size_t size, Operation op);
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, size_t size,
static void VerifyUTF8StringNamedField(const char* data, int size,
Operation op, const char* field_name);
private:
......@@ -337,7 +337,7 @@ inline size_t WireFormat::TagSize(int field_number,
static_cast<WireFormatLite::FieldType>(implicit_cast<int>(type)));
}
inline void WireFormat::VerifyUTF8String(const char* data, size_t size,
inline void WireFormat::VerifyUTF8String(const char* data, int size,
WireFormat::Operation op) {
#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
WireFormatLite::VerifyUtf8String(
......@@ -350,7 +350,7 @@ inline void WireFormat::VerifyUTF8String(const char* data, size_t size,
#endif
}
inline void WireFormat::VerifyUTF8StringNamedField(const char* data, size_t size,
inline void WireFormat::VerifyUTF8StringNamedField(const char* data, int size,
WireFormat::Operation op,
const char* field_name) {
#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
......
......@@ -581,7 +581,7 @@ void PrintUTF8ErrorLog(const char* field_name, const char* operation_str,
<< "bytes. " << stacktrace;
}
bool WireFormatLite::VerifyUtf8String(const char* data, size_t size, Operation op,
bool WireFormatLite::VerifyUtf8String(const char* data, int size, Operation op,
const char* field_name) {
if (!IsStructurallyValidUTF8(data, size)) {
const char* operation_str = NULL;
......
......@@ -325,7 +325,7 @@ class PROTOBUF_EXPORT WireFormatLite {
};
// Returns true if the data is valid UTF-8.
static bool VerifyUtf8String(const char* data, size_t size, Operation op,
static bool VerifyUtf8String(const char* data, int size, Operation op,
const char* field_name);
template <typename MessageType>
......
......@@ -1819,7 +1819,7 @@ failure:
// string value = 1;
if (this->value().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_value().data(), this->_internal_value().length(),
this->_internal_value().data(), static_cast<int>(this->_internal_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.StringValue.value");
target = stream->WriteStringMaybeAliased(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment