aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google
diff options
context:
space:
mode:
authorGravatar liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2010-12-06 06:20:14 +0000
committerGravatar liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2010-12-06 06:20:14 +0000
commit5d8d2b054224bc5fdc73b886f8e765c360f86734 (patch)
tree650fa406aa2dbacbfb4ff5b640411cb5643d0218 /src/google
parent2726e7a6ebd72eec6f66abe4ced3c88983f20b8e (diff)
Fix issues: 200 202 211 215 237 246.
Diffstat (limited to 'src/google')
-rw-r--r--src/google/protobuf/io/coded_stream.h2
-rw-r--r--src/google/protobuf/repeated_field.h8
-rw-r--r--src/google/protobuf/stubs/common.cc12
3 files changed, 17 insertions, 5 deletions
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
index 9a41a644..1b6b4e18 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 f380e7c0..6080ddcc 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/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));
}
diff --git a/src/google/protobuf/stubs/common.cc b/src/google/protobuf/stubs/common.cc
index 1e2d68d2..34a7d139 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();
}