aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFeng Xiao <xfxyjwf@gmail.com>2018-08-09 21:21:01 -0700
committerFeng Xiao <xfxyjwf@gmail.com>2018-08-09 21:21:01 -0700
commitacd5b05e9f1ec2153574807463af0612267b6067 (patch)
tree7f0d6bee5ea04e9f3e8e8ce9be5b168d5ff5c05d /src
parent8e4fd1b4e8a1b29faefaff1ce794b7a2f607d994 (diff)
downloadprotobuf-acd5b05e9f1ec2153574807463af0612267b6067.tar.gz
protobuf-acd5b05e9f1ec2153574807463af0612267b6067.tar.bz2
protobuf-acd5b05e9f1ec2153574807463af0612267b6067.zip
Fix failing tests.
1. Fix C++ tests. * Add missing files to Makefile.am and fix distcheck in tests.sh * Remove BUILT_SOURCES from conformance/Makefile.am. * Add some missing override keyword. * Add a type cast to int64 because our StrCat() in stubs can't handle size_t. 2. Fix Java tests. * Add missing test dependency on guava in pom.xml. * Include newly referenced test data in test resources. * Manually fix map_lite_test.proto which is overwritten because it's mapped from map_test.proto in google3. * Add back "optimize_for = LITE_RUNTIME" which is still needed to keep the opensource test passing as it's still running lite tests. * Add a type cast in newBuilder() because without it the code doesn't compile with openjdk javac 1.8 (the compiler can't figure if it's the right type due to complex generic typing). 3. Fix Python tests. * Remove/replace references to <hash_map>. * Suppress more warnings in setup.py. * Replace incorrect header inclusion for google/protobuf/proto_api.h. * Add strings::EndsWith to google/protobuf/stubs/strutil.h because it's referenced in the updated python C extension code. * Replace proto2 with google::protobuf. The proto2 name is leaked to opensource because we removed the subsitition rule for proto2 namespace but only fixed C++ source code and forgot to update python C extension code.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am5
-rw-r--r--src/google/protobuf/compiler/java/java_message_lite.cc4
-rw-r--r--src/google/protobuf/descriptor_database.h2
-rw-r--r--src/google/protobuf/stubs/strutil.h9
-rw-r--r--src/google/protobuf/text_format.cc5
5 files changed, 20 insertions, 5 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index af264a95..1aabf972 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -112,6 +112,9 @@ nobase_include_HEADERS = \
google/protobuf/message_lite.h \
google/protobuf/metadata.h \
google/protobuf/metadata_lite.h \
+ google/protobuf/port.h \
+ google/protobuf/port_def.inc \
+ google/protobuf/port_undef.inc \
google/protobuf/reflection.h \
google/protobuf/reflection_ops.h \
google/protobuf/repeated_field.h \
@@ -690,6 +693,7 @@ COMMON_TEST_SOURCES = \
google/protobuf/test_util.cc \
google/protobuf/test_util.h \
google/protobuf/test_util.inc \
+ google/protobuf/test_util2.h \
google/protobuf/testing/googletest.cc \
google/protobuf/testing/googletest.h \
google/protobuf/testing/file.cc \
@@ -743,6 +747,7 @@ protobuf_test_SOURCES = \
google/protobuf/proto3_arena_lite_unittest.cc \
google/protobuf/proto3_arena_unittest.cc \
google/protobuf/proto3_lite_unittest.cc \
+ google/protobuf/proto3_lite_unittest.inc \
google/protobuf/reflection_ops_unittest.cc \
google/protobuf/repeated_field_reflection_unittest.cc \
google/protobuf/repeated_field_unittest.cc \
diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc
index d2cc5f95..85a7453d 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -737,10 +737,10 @@ void ImmutableMessageLiteGenerator::GenerateSerializeOneExtensionRange(
void ImmutableMessageLiteGenerator::GenerateBuilder(io::Printer* printer) {
printer->Print(
"public static Builder newBuilder() {\n"
- " return DEFAULT_INSTANCE.createBuilder();\n"
+ " return (Builder) DEFAULT_INSTANCE.createBuilder();\n"
"}\n"
"public static Builder newBuilder($classname$ prototype) {\n"
- " return DEFAULT_INSTANCE.createBuilder(prototype);\n"
+ " return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);\n"
"}\n"
"\n",
"classname", name_resolver_->GetImmutableClassName(descriptor_));
diff --git a/src/google/protobuf/descriptor_database.h b/src/google/protobuf/descriptor_database.h
index 15ed8c64..0a87a147 100644
--- a/src/google/protobuf/descriptor_database.h
+++ b/src/google/protobuf/descriptor_database.h
@@ -164,7 +164,7 @@ class LIBPROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase {
bool FindAllExtensionNumbers(const string& extendee_type,
std::vector<int>* output) override;
- bool FindAllFileNames(std::vector<string>* output);
+ bool FindAllFileNames(std::vector<string>* output) override;
private:
// So that it can use DescriptorIndex.
diff --git a/src/google/protobuf/stubs/strutil.h b/src/google/protobuf/stubs/strutil.h
index d6bcbc32..ec5512d6 100644
--- a/src/google/protobuf/stubs/strutil.h
+++ b/src/google/protobuf/stubs/strutil.h
@@ -913,6 +913,15 @@ LIBPROTOBUF_EXPORT void CleanStringLineEndings(const string& src, string* dst,
LIBPROTOBUF_EXPORT void CleanStringLineEndings(string* str,
bool auto_end_last_line);
+namespace strings {
+inline bool EndsWith(StringPiece text, StringPiece suffix) {
+ return suffix.empty() ||
+ (text.size() >= suffix.size() &&
+ memcmp(text.data() + (text.size() - suffix.size()), suffix.data(),
+ suffix.size()) == 0);
+}
+} // namespace strings
+
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc
index 09267be1..93c24b23 100644
--- a/src/google/protobuf/text_format.cc
+++ b/src/google/protobuf/text_format.cc
@@ -1356,8 +1356,9 @@ bool CheckParseInputSize(StringPiece input,
io::ErrorCollector* error_collector) {
if (input.size() > INT_MAX) {
error_collector->AddError(
- -1, 0, StrCat("Input size too large: ", input.size(), " bytes",
- " > ", INT_MAX, " bytes."));
+ -1, 0, StrCat("Input size too large: ",
+ static_cast<int64>(input.size()), " bytes",
+ " > ", INT_MAX, " bytes."));
return false;
}
return true;