aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar xiaofeng@google.com <xiaofeng@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2013-02-25 10:24:11 +0000
committerGravatar xiaofeng@google.com <xiaofeng@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2013-02-25 10:24:11 +0000
commitde3494fe5cbfdb75631bd07877341d56d721730c (patch)
tree7aa02a8aa3c80784ea17a21722ab93bb09cdbabb /src
parente406747cd50270855c75902bb3a6de2e7659763d (diff)
Fix issue 403, issue 456, issue 462
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/compiler/java/java_service.cc6
-rw-r--r--src/google/protobuf/io/coded_stream_inl.h8
-rw-r--r--src/google/protobuf/message.cc2
3 files changed, 13 insertions, 3 deletions
diff --git a/src/google/protobuf/compiler/java/java_service.cc b/src/google/protobuf/compiler/java/java_service.cc
index bbd24806..bcd80359 100644
--- a/src/google/protobuf/compiler/java/java_service.cc
+++ b/src/google/protobuf/compiler/java/java_service.cc
@@ -88,6 +88,12 @@ void ServiceGenerator::Generate(io::Printer* printer) {
GenerateStub(printer);
GenerateBlockingStub(printer);
+ // Add an insertion point.
+ printer->Print(
+ "\n"
+ "// @@protoc_insertion_point(class_scope:$full_name$)\n",
+ "full_name", descriptor_->full_name());
+
printer->Outdent();
printer->Print("}\n\n");
}
diff --git a/src/google/protobuf/io/coded_stream_inl.h b/src/google/protobuf/io/coded_stream_inl.h
index 94495fb8..144f44f0 100644
--- a/src/google/protobuf/io/coded_stream_inl.h
+++ b/src/google/protobuf/io/coded_stream_inl.h
@@ -50,8 +50,12 @@ inline bool CodedInputStream::InternalReadStringInline(string* buffer,
if (BufferSize() >= size) {
STLStringResizeUninitialized(buffer, size);
- memcpy(string_as_array(buffer), buffer_, size);
- Advance(size);
+ // When buffer is empty, string_as_array(buffer) will return NULL but memcpy
+ // requires non-NULL pointers even when size is 0. Hench this check.
+ if (size > 0) {
+ memcpy(string_as_array(buffer), buffer_, size);
+ Advance(size);
+ }
return true;
}
diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc
index b3f8024c..ab7efa99 100644
--- a/src/google/protobuf/message.cc
+++ b/src/google/protobuf/message.cc
@@ -32,7 +32,7 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
-#include <iostream>
+#include <istream>
#include <stack>
#include <google/protobuf/stubs/hash.h>