diff options
author | jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2014-07-31 00:24:48 +0000 |
---|---|---|
committer | jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2014-07-31 00:24:48 +0000 |
commit | 7ee0f3edc7fe125b5c65865b168c296731f2a567 (patch) | |
tree | 6c0cef0dbe511f4f9c5d7bda53af316b6355ea43 | |
parent | b7aebe40998d9a2526d6edf3f662d5b517dfdd1c (diff) | |
download | protobuf-7ee0f3edc7fe125b5c65865b168c296731f2a567.tar.gz protobuf-7ee0f3edc7fe125b5c65865b168c296731f2a567.tar.bz2 protobuf-7ee0f3edc7fe125b5c65865b168c296731f2a567.zip |
change some files to pass MSVC 2013
-rw-r--r-- | src/google/protobuf/descriptor.cc | 6 | ||||
-rw-r--r-- | src/google/protobuf/extension_set_unittest.cc | 24 | ||||
-rw-r--r-- | src/google/protobuf/repeated_field.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/wire_format_lite_inl.h | 4 | ||||
-rwxr-xr-x | vsprojects/extract_includes.bat | 1 | ||||
-rw-r--r-- | vsprojects/libprotobuf.vcproj | 12 | ||||
-rw-r--r-- | vsprojects/libprotoc.vcproj | 34 |
7 files changed, 70 insertions, 15 deletions
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 706e4bf9..d57b701f 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -204,9 +204,11 @@ struct PointerIntegerPairHash { return reinterpret_cast<intptr_t>(p.first) * ((1 << 16) - 1) + p.second; } +#ifdef _MSC_VER // Used only by MSVC and platforms where hash_map is not available. static const size_t bucket_size = 4; static const size_t min_buckets = 8; +#endif inline bool operator()(const PairType& a, const PairType& b) const { return a.first < b.first || (a.first == b.first && a.second < b.second); @@ -226,6 +228,10 @@ struct PointerStringPairHash { } // Used only by MSVC and platforms where hash_map is not available. + // These two lines produce unused warning, but do not delete them + // unless hash_map is available on MSVC and platforms. + static const size_t bucket_size = 4; + static const size_t min_buckets = 8; inline bool operator()(const PointerStringPair& a, const PointerStringPair& b) const { if (a.first < b.first) return true; diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc index 52e551cd..fb3746aa 100644 --- a/src/google/protobuf/extension_set_unittest.cc +++ b/src/google/protobuf/extension_set_unittest.cc @@ -812,8 +812,8 @@ TEST(ExtensionSetTest, RepeatedFields) { ASSERT_EQ(110, SumAllExtensions<double>( message, unittest::repeated_double_extension, 0)); - typename RepeatedPtrField< ::std::string>::iterator string_iter; - typename RepeatedPtrField< ::std::string>::iterator string_end; + RepeatedPtrField< ::std::string>::iterator string_iter; + RepeatedPtrField< ::std::string>::iterator string_end; for (string_iter = message.MutableRepeatedExtension( unittest::repeated_string_extension)->begin(), string_end = message.MutableRepeatedExtension( @@ -821,8 +821,8 @@ TEST(ExtensionSetTest, RepeatedFields) { string_iter != string_end; ++string_iter) { *string_iter += "test"; } - typename RepeatedPtrField< ::std::string>::const_iterator string_const_iter; - typename RepeatedPtrField< ::std::string>::const_iterator string_const_end; + RepeatedPtrField< ::std::string>::const_iterator string_const_iter; + RepeatedPtrField< ::std::string>::const_iterator string_const_end; for (string_const_iter = message.GetRepeatedExtension( unittest::repeated_string_extension).begin(), string_const_end = message.GetRepeatedExtension( @@ -831,8 +831,8 @@ TEST(ExtensionSetTest, RepeatedFields) { ASSERT_TRUE(*string_iter == "testtest"); } - typename RepeatedField<unittest::TestAllTypes_NestedEnum>::iterator enum_iter; - typename RepeatedField<unittest::TestAllTypes_NestedEnum>::iterator enum_end; + RepeatedField<unittest::TestAllTypes_NestedEnum>::iterator enum_iter; + RepeatedField<unittest::TestAllTypes_NestedEnum>::iterator enum_end; for (enum_iter = message.MutableRepeatedExtension( unittest::repeated_nested_enum_extension)->begin(), enum_end = message.MutableRepeatedExtension( @@ -840,9 +840,9 @@ TEST(ExtensionSetTest, RepeatedFields) { enum_iter != enum_end; ++enum_iter) { *enum_iter = unittest::TestAllTypes::NestedEnum_MAX; } - typename RepeatedField<unittest::TestAllTypes_NestedEnum>::const_iterator + RepeatedField<unittest::TestAllTypes_NestedEnum>::const_iterator enum_const_iter; - typename RepeatedField<unittest::TestAllTypes_NestedEnum>::const_iterator + RepeatedField<unittest::TestAllTypes_NestedEnum>::const_iterator enum_const_end; for (enum_const_iter = message.GetRepeatedExtension( unittest::repeated_nested_enum_extension).begin(), @@ -852,9 +852,9 @@ TEST(ExtensionSetTest, RepeatedFields) { ASSERT_EQ(*enum_const_iter, unittest::TestAllTypes::NestedEnum_MAX); } - typename RepeatedPtrField<unittest::TestAllTypes_NestedMessage>::iterator + RepeatedPtrField<unittest::TestAllTypes_NestedMessage>::iterator msg_iter; - typename RepeatedPtrField<unittest::TestAllTypes_NestedMessage>::iterator + RepeatedPtrField<unittest::TestAllTypes_NestedMessage>::iterator msg_end; for (msg_iter = message.MutableRepeatedExtension( unittest::repeated_nested_message_extension)->begin(), @@ -863,9 +863,9 @@ TEST(ExtensionSetTest, RepeatedFields) { msg_iter != msg_end; ++msg_iter) { msg_iter->set_bb(1234); } - typename RepeatedPtrField<unittest::TestAllTypes_NestedMessage>:: + RepeatedPtrField<unittest::TestAllTypes_NestedMessage>:: const_iterator msg_const_iter; - typename RepeatedPtrField<unittest::TestAllTypes_NestedMessage>:: + RepeatedPtrField<unittest::TestAllTypes_NestedMessage>:: const_iterator msg_const_end; for (msg_const_iter = message.GetRepeatedExtension( unittest::repeated_nested_message_extension).begin(), diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 93d3cbba..d1b23121 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -46,6 +46,10 @@ #ifndef GOOGLE_PROTOBUF_REPEATED_FIELD_H__ #define GOOGLE_PROTOBUF_REPEATED_FIELD_H__ +#ifdef _MSC_VER +#include <algorithm> +#endif + #include <string> #include <iterator> #include <google/protobuf/stubs/common.h> diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h index ba9f9ce3..2b5763ce 100644 --- a/src/google/protobuf/wire_format_lite_inl.h +++ b/src/google/protobuf/wire_format_lite_inl.h @@ -36,6 +36,10 @@ #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_INL_H__ +#ifdef _MSC_VER +#include <algorithm> +#endif + #include <string> #include <google/protobuf/stubs/common.h> #include <google/protobuf/message_lite.h> diff --git a/vsprojects/extract_includes.bat b/vsprojects/extract_includes.bat index 2ddcddbe..beab8c4a 100755 --- a/vsprojects/extract_includes.bat +++ b/vsprojects/extract_includes.bat @@ -35,6 +35,7 @@ copy ..\src\google\protobuf\wire_format_lite_inl.h include\google\protobuf\wire_ copy ..\src\google\protobuf\io\coded_stream.h include\google\protobuf\io\coded_stream.h copy ..\src\google\protobuf\io\gzip_stream.h include\google\protobuf\io\gzip_stream.h copy ..\src\google\protobuf\io\printer.h include\google\protobuf\io\printer.h +copy ..\src\google\protobuf\io\strtod.h include\google\protobuf\io\strtod.h copy ..\src\google\protobuf\io\tokenizer.h include\google\protobuf\io\tokenizer.h copy ..\src\google\protobuf\io\zero_copy_stream.h include\google\protobuf\io\zero_copy_stream.h copy ..\src\google\protobuf\io\zero_copy_stream_impl.h include\google\protobuf\io\zero_copy_stream_impl.h diff --git a/vsprojects/libprotobuf.vcproj b/vsprojects/libprotobuf.vcproj index fd47753d..1a488f7d 100644 --- a/vsprojects/libprotobuf.vcproj +++ b/vsprojects/libprotobuf.vcproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <VisualStudioProject ProjectType="Visual C++" Version="9.00" @@ -196,6 +196,10 @@ > </File> <File + RelativePath="..\src\google\protobuf\io\strtod.h" + > + </File> + <File RelativePath="..\src\google\protobuf\stubs\hash.h" > </File> @@ -204,7 +208,7 @@ > </File> <File - RelativePath="..\src\google\protobuf\stubs\map-util.h" + RelativePath="..\src\google\protobuf\stubs\map_util.h" > </File> <File @@ -368,6 +372,10 @@ > </File> <File + RelativePath="..\src\google\protobuf\io\strtod.cc" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\importer.cc" > </File> diff --git a/vsprojects/libprotoc.vcproj b/vsprojects/libprotoc.vcproj index b7030288..f0a4e179 100644 --- a/vsprojects/libprotoc.vcproj +++ b/vsprojects/libprotoc.vcproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <VisualStudioProject ProjectType="Visual C++" Version="9.00" @@ -248,10 +248,18 @@ > </File> <File + RelativePath="..\src\google\protobuf\compiler\java\java_generator_factory.h" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\java\java_helpers.h" > </File> <File + RelativePath="..\src\google\protobuf\compiler\java\java_lazy_message_field.h" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\java\java_message.h" > </File> @@ -260,6 +268,10 @@ > </File> <File + RelativePath="..\src\google\protobuf\compiler\java\java_name_resolver.h" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\java\java_primitive_field.h" > </File> @@ -268,6 +280,10 @@ > </File> <File + RelativePath="..\src\google\protobuf\compiler\java\java_shared_code_generator.h" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\java\java_string_field.h" > </File> @@ -392,10 +408,18 @@ > </File> <File + RelativePath="..\src\google\protobuf\compiler\java\java_generator_factory.cc" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\java\java_helpers.cc" > </File> <File + RelativePath="..\src\google\protobuf\compiler\java\java_lazy_message_field.cc" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\java\java_message.cc" > </File> @@ -404,6 +428,10 @@ > </File> <File + RelativePath="..\src\google\protobuf\compiler\java\java_name_resolver.cc" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\java\java_primitive_field.cc" > </File> @@ -412,6 +440,10 @@ > </File> <File + RelativePath="..\src\google\protobuf\compiler\java\java_shared_code_generator.cc" + > + </File> + <File RelativePath="..\src\google\protobuf\compiler\java\java_string_field.cc" > </File> |