diff --git a/configure.ac b/configure.ac index d6035ef358..3d8c2112ab 100644 --- a/configure.ac +++ b/configure.ac @@ -118,7 +118,7 @@ AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1]) AS_IF([test "$with_protoc" != "no"], [ PROTOC=$with_protoc - AS_IF([test "$with_protoc" == "yes"], [ + AS_IF([test "$with_protoc" = "yes"], [ # No argument given. Use system protoc. PROTOC=protoc ]) diff --git a/java/src/main/java/com/google/protobuf/CodedOutputStream.java b/java/src/main/java/com/google/protobuf/CodedOutputStream.java index 51a932a381..f3582e2dd9 100644 --- a/java/src/main/java/com/google/protobuf/CodedOutputStream.java +++ b/java/src/main/java/com/google/protobuf/CodedOutputStream.java @@ -396,7 +396,7 @@ public final class CodedOutputStream { * for converting the enum value to its numeric value. */ public void writeEnumNoTag(final int value) throws IOException { - writeRawVarint32(value); + writeInt32NoTag(value); } /** Write an {@code sfixed32} field to the stream. */ diff --git a/java/src/main/java/com/google/protobuf/GeneratedMessage.java b/java/src/main/java/com/google/protobuf/GeneratedMessage.java index fc2e530357..2c22fcab9a 100644 --- a/java/src/main/java/com/google/protobuf/GeneratedMessage.java +++ b/java/src/main/java/com/google/protobuf/GeneratedMessage.java @@ -56,6 +56,7 @@ import java.util.TreeMap; */ public abstract class GeneratedMessage extends AbstractMessage implements Serializable { + private static final long serialVersionUID = 1L; private final UnknownFieldSet unknownFields; diff --git a/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java b/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java index 30a7571574..1813e9b3ed 100644 --- a/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java +++ b/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java @@ -47,6 +47,7 @@ import java.util.Map; */ public abstract class GeneratedMessageLite extends AbstractMessageLite implements Serializable { + private static final long serialVersionUID = 1L; protected GeneratedMessageLite() { } diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 9a41a6440d..1b6b4e18b4 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -567,7 +567,7 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // char text[] = "Hello world!"; // // int coded_size = sizeof(magic_number) + -// CodedOutputStream::Varint32Size(strlen(text)) + +// CodedOutputStream::VarintSize32(strlen(text)) + // strlen(text); // // uint8* buffer = diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index f380e7c0d9..6080ddccce 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -616,14 +616,14 @@ inline void RepeatedField::Truncate(int new_size) { template inline void RepeatedField::MoveArray( - Element to[], Element from[], int size) { - memcpy(to, from, size * sizeof(Element)); + Element to[], Element from[], int array_size) { + memcpy(to, from, array_size * sizeof(Element)); } template inline void RepeatedField::CopyArray( - Element to[], const Element from[], int size) { - memcpy(to, from, size * sizeof(Element)); + Element to[], const Element from[], int array_size) { + memcpy(to, from, array_size * sizeof(Element)); } diff --git a/src/google/protobuf/stubs/common.cc b/src/google/protobuf/stubs/common.cc index 1e2d68d2f0..34a7d13911 100644 --- a/src/google/protobuf/stubs/common.cc +++ b/src/google/protobuf/stubs/common.cc @@ -177,6 +177,12 @@ LogMessage::LogMessage(LogLevel level, const char* filename, int line) : level_(level), filename_(filename), line_(line) {} LogMessage::~LogMessage() {} +#if defined(_MSC_VER) && defined(_CPPUNWIND) + #define PROTOBUF_USE_EXCEPTIONS +#elif defined(__EXCEPTIONS) + #define PROTOBUF_USE_EXCEPTIONS +#endif + void LogMessage::Finish() { bool suppress = false; @@ -191,10 +197,16 @@ void LogMessage::Finish() { } if (level_ == LOGLEVEL_FATAL) { +#ifdef PROTOBUF_USE_EXCEPTIONS + throw -1; +#else abort(); +#endif } } +#undef PROTOBUF_USE_EXCEPTIONS + void LogFinisher::operator=(LogMessage& other) { other.Finish(); }