From 839b180dbae98adf6caa54d0fb87b8d0a43081dc Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Mon, 24 Aug 2015 11:25:15 -0700 Subject: Cherry-pick Java utf8 change. --- src/google/protobuf/compiler/java/java_helpers.h | 5 +++++ src/google/protobuf/compiler/java/java_string_field.cc | 4 ---- src/google/protobuf/compiler/java/java_string_field_lite.cc | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/java/java_helpers.h b/src/google/protobuf/compiler/java/java_helpers.h index 99ba6a18..7eef86a7 100644 --- a/src/google/protobuf/compiler/java/java_helpers.h +++ b/src/google/protobuf/compiler/java/java_helpers.h @@ -336,6 +336,11 @@ inline bool IsAnyMessage(const Descriptor* descriptor) { return descriptor->full_name() == "google.protobuf.Any"; } +inline bool CheckUtf8(const FieldDescriptor* descriptor) { + return descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 || + descriptor->file()->options().java_string_check_utf8(); +} + } // namespace java } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/java/java_string_field.cc b/src/google/protobuf/compiler/java/java_string_field.cc index 47e04659..72ebaeca 100644 --- a/src/google/protobuf/compiler/java/java_string_field.cc +++ b/src/google/protobuf/compiler/java/java_string_field.cc @@ -131,10 +131,6 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, GenerateSetBitToLocal(messageBitIndex); } -bool CheckUtf8(const FieldDescriptor* descriptor) { - return descriptor->file()->options().java_string_check_utf8(); -} - } // namespace // =================================================================== diff --git a/src/google/protobuf/compiler/java/java_string_field_lite.cc b/src/google/protobuf/compiler/java/java_string_field_lite.cc index 032715b7..092e3c29 100644 --- a/src/google/protobuf/compiler/java/java_string_field_lite.cc +++ b/src/google/protobuf/compiler/java/java_string_field_lite.cc @@ -115,10 +115,6 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, GenerateSetBitToLocal(messageBitIndex); } -bool CheckUtf8(const FieldDescriptor* descriptor) { - return descriptor->file()->options().java_string_check_utf8(); -} - } // namespace // =================================================================== -- cgit v1.2.3