From eaaef0b39b6710574db25a264cc4980e40f678ea Mon Sep 17 00:00:00 2001 From: "xiaofeng@google.com" Date: Tue, 4 Dec 2012 00:59:40 +0000 Subject: Fix issues: 342, 424, 428, 430, 436 --- README.txt | 2 +- python/google/protobuf/pyext/python-proto2.cc | 6 ------ src/Makefile.am | 4 ++-- src/google/protobuf/stubs/common.cc | 2 +- src/google/protobuf/stubs/common_unittest.cc | 6 +++--- src/google/protobuf/wire_format.h | 3 +++ 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/README.txt b/README.txt index a8f66044..17551a5a 100644 --- a/README.txt +++ b/README.txt @@ -115,7 +115,7 @@ For advanced usage information on configure and make, see INSTALL.txt. C++ Installation - Windows ========================== -If you are using Micosoft Visual C++, see vsprojects/readme.txt. +If you are using Microsoft Visual C++, see vsprojects/readme.txt. If you are using Cygwin or MinGW, follow the Unix installation instructions, above. diff --git a/python/google/protobuf/pyext/python-proto2.cc b/python/google/protobuf/pyext/python-proto2.cc index 62753413..eebb752b 100644 --- a/python/google/protobuf/pyext/python-proto2.cc +++ b/python/google/protobuf/pyext/python-proto2.cc @@ -427,9 +427,6 @@ static bool CheckAndSetString( GOOGLE_DCHECK(descriptor->type() == google::protobuf::FieldDescriptor::TYPE_STRING || descriptor->type() == google::protobuf::FieldDescriptor::TYPE_BYTES); if (descriptor->type() == google::protobuf::FieldDescriptor::TYPE_STRING) { -#else - if (descriptor->file()->options().cc_api_version() == 2 && - descriptor->type() == google::protobuf::FieldDescriptor::TYPE_STRING) { if (!PyString_Check(arg) && !PyUnicode_Check(arg)) { FormatTypeError(arg, "str, unicode"); return false; @@ -457,9 +454,6 @@ static bool CheckAndSetString( PyObject* encoded_string = NULL; if (descriptor->type() == google::protobuf::FieldDescriptor::TYPE_STRING) { -#else - if (descriptor->file()->options().cc_api_version() == 2 && - descriptor->type() == google::protobuf::FieldDescriptor::TYPE_STRING) { if (PyString_Check(arg)) { encoded_string = PyString_AsEncodedObject(arg, "utf-8", NULL); } else { diff --git a/src/Makefile.am b/src/Makefile.am index 84d3b032..f43e2d1a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -47,6 +47,8 @@ nobase_include_HEADERS = \ google/protobuf/stubs/common.h \ google/protobuf/stubs/platform_macros.h \ google/protobuf/stubs/once.h \ + google/protobuf/stubs/template_util.h \ + google/protobuf/stubs/type_traits.h \ google/protobuf/descriptor.h \ google/protobuf/descriptor.pb.h \ google/protobuf/descriptor_database.h \ @@ -95,8 +97,6 @@ libprotobuf_lite_la_SOURCES = \ google/protobuf/stubs/stl_util.h \ google/protobuf/stubs/stringprintf.cc \ google/protobuf/stubs/stringprintf.h \ - google/protobuf/stubs/template_util.h \ - google/protobuf/stubs/type_traits.h \ google/protobuf/extension_set.cc \ google/protobuf/generated_message_util.cc \ google/protobuf/message_lite.cc \ diff --git a/src/google/protobuf/stubs/common.cc b/src/google/protobuf/stubs/common.cc index 16d78528..f4bb92dc 100644 --- a/src/google/protobuf/stubs/common.cc +++ b/src/google/protobuf/stubs/common.cc @@ -110,7 +110,7 @@ void DefaultLogHandler(LogLevel level, const char* filename, int line, // We use fprintf() instead of cerr because we want this to work at static // initialization time. - fprintf(stderr, "libprotobuf %s %s:%d] %s\n", + fprintf(stderr, "[libprotobuf %s %s:%d] %s\n", level_names[level], filename, line, message.c_str()); fflush(stderr); // Needed on MSVC. } diff --git a/src/google/protobuf/stubs/common_unittest.cc b/src/google/protobuf/stubs/common_unittest.cc index 4109a52c..43cd6d01 100644 --- a/src/google/protobuf/stubs/common_unittest.cc +++ b/src/google/protobuf/stubs/common_unittest.cc @@ -94,9 +94,9 @@ TEST(LoggingTest, DefaultLogging) { string text = GetCapturedTestStderr(); EXPECT_EQ( - "libprotobuf INFO "__FILE__":" + SimpleItoa(line + 1) + "] A message.\n" - "libprotobuf WARNING "__FILE__":" + SimpleItoa(line + 2) + "] A warning.\n" - "libprotobuf ERROR "__FILE__":" + SimpleItoa(line + 3) + "] An error.\n", + "[libprotobuf INFO "__FILE__":" + SimpleItoa(line + 1) + "] A message.\n" + "[libprotobuf WARNING "__FILE__":" + SimpleItoa(line + 2) + "] A warning.\n" + "[libprotobuf ERROR "__FILE__":" + SimpleItoa(line + 3) + "] An error.\n", text); } diff --git a/src/google/protobuf/wire_format.h b/src/google/protobuf/wire_format.h index 6c3f44a4..6cc90029 100644 --- a/src/google/protobuf/wire_format.h +++ b/src/google/protobuf/wire_format.h @@ -294,6 +294,9 @@ inline void WireFormat::VerifyUTF8String(const char* data, int size, WireFormat::Operation op) { #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED WireFormat::VerifyUTF8StringFallback(data, size, op); +#else + // Avoid the compiler warning about unsued variables. + (void)data; (void)size; (void)op; #endif } -- cgit v1.2.3