Fix issues: 200 202 211 215 237 246.

pull/3335/head
liujisi@google.com 14 years ago
parent 2726e7a6eb
commit 5d8d2b0542
  1. 2
      configure.ac
  2. 2
      java/src/main/java/com/google/protobuf/CodedOutputStream.java
  3. 1
      java/src/main/java/com/google/protobuf/GeneratedMessage.java
  4. 1
      java/src/main/java/com/google/protobuf/GeneratedMessageLite.java
  5. 2
      src/google/protobuf/io/coded_stream.h
  6. 8
      src/google/protobuf/repeated_field.h
  7. 12
      src/google/protobuf/stubs/common.cc

@ -118,7 +118,7 @@ AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1])
AS_IF([test "$with_protoc" != "no"], [ AS_IF([test "$with_protoc" != "no"], [
PROTOC=$with_protoc PROTOC=$with_protoc
AS_IF([test "$with_protoc" == "yes"], [ AS_IF([test "$with_protoc" = "yes"], [
# No argument given. Use system protoc. # No argument given. Use system protoc.
PROTOC=protoc PROTOC=protoc
]) ])

@ -396,7 +396,7 @@ public final class CodedOutputStream {
* for converting the enum value to its numeric value. * for converting the enum value to its numeric value.
*/ */
public void writeEnumNoTag(final int value) throws IOException { public void writeEnumNoTag(final int value) throws IOException {
writeRawVarint32(value); writeInt32NoTag(value);
} }
/** Write an {@code sfixed32} field to the stream. */ /** Write an {@code sfixed32} field to the stream. */

@ -56,6 +56,7 @@ import java.util.TreeMap;
*/ */
public abstract class GeneratedMessage extends AbstractMessage public abstract class GeneratedMessage extends AbstractMessage
implements Serializable { implements Serializable {
private static final long serialVersionUID = 1L;
private final UnknownFieldSet unknownFields; private final UnknownFieldSet unknownFields;

@ -47,6 +47,7 @@ import java.util.Map;
*/ */
public abstract class GeneratedMessageLite extends AbstractMessageLite public abstract class GeneratedMessageLite extends AbstractMessageLite
implements Serializable { implements Serializable {
private static final long serialVersionUID = 1L;
protected GeneratedMessageLite() { protected GeneratedMessageLite() {
} }

@ -567,7 +567,7 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// char text[] = "Hello world!"; // char text[] = "Hello world!";
// //
// int coded_size = sizeof(magic_number) + // int coded_size = sizeof(magic_number) +
// CodedOutputStream::Varint32Size(strlen(text)) + // CodedOutputStream::VarintSize32(strlen(text)) +
// strlen(text); // strlen(text);
// //
// uint8* buffer = // uint8* buffer =

@ -616,14 +616,14 @@ inline void RepeatedField<Element>::Truncate(int new_size) {
template <typename Element> template <typename Element>
inline void RepeatedField<Element>::MoveArray( inline void RepeatedField<Element>::MoveArray(
Element to[], Element from[], int size) { Element to[], Element from[], int array_size) {
memcpy(to, from, size * sizeof(Element)); memcpy(to, from, array_size * sizeof(Element));
} }
template <typename Element> template <typename Element>
inline void RepeatedField<Element>::CopyArray( inline void RepeatedField<Element>::CopyArray(
Element to[], const Element from[], int size) { Element to[], const Element from[], int array_size) {
memcpy(to, from, size * sizeof(Element)); memcpy(to, from, array_size * sizeof(Element));
} }

@ -177,6 +177,12 @@ LogMessage::LogMessage(LogLevel level, const char* filename, int line)
: level_(level), filename_(filename), line_(line) {} : level_(level), filename_(filename), line_(line) {}
LogMessage::~LogMessage() {} LogMessage::~LogMessage() {}
#if defined(_MSC_VER) && defined(_CPPUNWIND)
#define PROTOBUF_USE_EXCEPTIONS
#elif defined(__EXCEPTIONS)
#define PROTOBUF_USE_EXCEPTIONS
#endif
void LogMessage::Finish() { void LogMessage::Finish() {
bool suppress = false; bool suppress = false;
@ -191,10 +197,16 @@ void LogMessage::Finish() {
} }
if (level_ == LOGLEVEL_FATAL) { if (level_ == LOGLEVEL_FATAL) {
#ifdef PROTOBUF_USE_EXCEPTIONS
throw -1;
#else
abort(); abort();
#endif
} }
} }
#undef PROTOBUF_USE_EXCEPTIONS
void LogFinisher::operator=(LogMessage& other) { void LogFinisher::operator=(LogMessage& other) {
other.Finish(); other.Finish();
} }

Loading…
Cancel
Save