Browse Source

Fix issues: 200 202 211 215 237 246.

liujisi@google.com 15 years ago
parent
commit
5d8d2b0542

+ 1 - 1
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
   ])

+ 1 - 1
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. */

+ 1 - 0
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;
 

+ 1 - 0
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() {
   }

+ 1 - 1
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 =

+ 4 - 4
src/google/protobuf/repeated_field.h

@@ -616,14 +616,14 @@ inline void RepeatedField<Element>::Truncate(int new_size) {
 
 template <typename Element>
 inline void RepeatedField<Element>::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 <typename Element>
 inline void RepeatedField<Element>::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));
 }
 
 

+ 12 - 0
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();
 }