Fix compilation errors when built internally.

1. mathlimits.h must be included before the inclusion of cmath (which
     gtest/gtest.h seems to include).
  2. hash function for StringPiece doesn't work.

Change-Id: I358a25d941a25b10b39fe76780eda41557699811
pull/931/head
Feng Xiao 9 years ago
parent 59635c13d9
commit 9659ea9e56
  1. 3
      src/google/protobuf/util/field_comparator_test.cc
  2. 2
      src/google/protobuf/util/internal/protostream_objectwriter.cc
  3. 2
      src/google/protobuf/util/internal/protostream_objectwriter.h

@ -34,9 +34,10 @@
#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/descriptor.h>
#include <gtest/gtest.h>
#include <google/protobuf/stubs/mathutil.h>
#include <gtest/gtest.h>
namespace google {
namespace protobuf {
namespace util {

@ -602,7 +602,7 @@ void ProtoStreamObjectWriter::ProtoElement::TakeOneofIndex(int32 index) {
bool ProtoStreamObjectWriter::ProtoElement::InsertMapKeyIfNotPresent(
StringPiece map_key) {
return InsertIfNotPresent(&map_keys_, map_key);
return InsertIfNotPresent(&map_keys_, map_key.ToString());
}
inline void ProtoStreamObjectWriter::InvalidName(StringPiece unknown_name,

@ -305,7 +305,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public StructuredObjectWriter
// Set of map keys already seen for the type_. Used to validate incoming
// messages so no map key appears more than once.
hash_set<StringPiece> map_keys_;
hash_set<string> map_keys_;
GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS(ProtoElement);
};

Loading…
Cancel
Save