Down Integrate Internal Changes
diff --git a/conformance/conformance_cpp.cc b/conformance/conformance_cpp.cc
index c7f4b2d..1cdfdae 100644
--- a/conformance/conformance_cpp.cc
+++ b/conformance/conformance_cpp.cc
@@ -32,13 +32,14 @@
#include <stdarg.h>
#include <unistd.h>
-#include "conformance.pb.h"
-#include <google/protobuf/test_messages_proto3.pb.h>
-#include <google/protobuf/test_messages_proto2.pb.h>
#include <google/protobuf/message.h>
#include <google/protobuf/text_format.h>
#include <google/protobuf/util/json_util.h>
#include <google/protobuf/util/type_resolver_util.h>
+#include "conformance.pb.h"
+#include <google/protobuf/test_messages_proto2.pb.h>
+#include <google/protobuf/test_messages_proto3.pb.h>
+#include <google/protobuf/stubs/status.h>
using conformance::ConformanceRequest;
using conformance::ConformanceResponse;
@@ -51,9 +52,7 @@
using google::protobuf::util::JsonParseOptions;
using google::protobuf::util::JsonToBinaryString;
using google::protobuf::util::NewTypeResolverForDescriptorPool;
-using google::protobuf::util::Status;
using google::protobuf::util::TypeResolver;
-using protobuf_test_messages::proto2::TestAllTypesProto2;
using protobuf_test_messages::proto3::TestAllTypesProto3;
using std::string;
@@ -71,6 +70,10 @@
TypeResolver* type_resolver;
string* type_url;
+namespace google {
+namespace protobuf {
+
+using util::Status;
bool CheckedRead(int fd, void *buf, size_t len) {
size_t ofs = 0;
@@ -80,7 +83,7 @@
if (bytes_read == 0) return false;
if (bytes_read < 0) {
- GOOGLE_LOG(FATAL) << "Error reading from test runner: " << strerror(errno);
+ GOOGLE_LOG(FATAL) << "Error reading from test runner: " << strerror(errno);
}
len -= bytes_read;
@@ -127,7 +130,7 @@
options);
if (!status.ok()) {
response->set_parse_error(string("Parse error: ") +
- status.error_message().as_string());
+ std::string(status.error_message()));
return;
}
@@ -152,8 +155,7 @@
break;
default:
- GOOGLE_LOG(FATAL) << "unknown payload type: "
- << request.payload_case();
+ GOOGLE_LOG(FATAL) << "unknown payload type: " << request.payload_case();
break;
}
@@ -169,7 +171,8 @@
break;
case conformance::PROTOBUF: {
- GOOGLE_CHECK(test_message->SerializeToString(response->mutable_protobuf_payload()));
+ GOOGLE_CHECK(test_message->SerializeToString(
+ response->mutable_protobuf_payload()));
break;
}
@@ -181,7 +184,7 @@
if (!status.ok()) {
response->set_serialize_error(
string("Failed to serialize JSON output: ") +
- status.error_message().as_string());
+ std::string(status.error_message()));
return;
}
break;
@@ -191,13 +194,13 @@
TextFormat::Printer printer;
printer.SetHideUnknownFields(!request.print_unknown_fields());
GOOGLE_CHECK(printer.PrintToString(*test_message,
- response->mutable_text_payload()));
+ response->mutable_text_payload()));
break;
}
default:
GOOGLE_LOG(FATAL) << "Unknown output format: "
- << request.requested_output_format();
+ << request.requested_output_format();
}
}
@@ -243,12 +246,15 @@
return true;
}
+} // namespace protobuf
+} // namespace google
+
int main() {
type_resolver = NewTypeResolverForDescriptorPool(
kTypeUrlPrefix, DescriptorPool::generated_pool());
type_url = new string(GetTypeUrl(TestAllTypesProto3::descriptor()));
while (1) {
- if (!DoTestIo()) {
+ if (!google::protobuf::DoTestIo()) {
fprintf(stderr, "conformance-cpp: received EOF from test runner "
"after %d tests, exiting\n", test_count);
return 0;