aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--appveyor.yml6
-rw-r--r--cmake/libprotobuf-lite.cmake2
-rw-r--r--cmake/libprotobuf.cmake2
-rw-r--r--cmake/libprotoc.cmake2
-rw-r--r--cmake/protoc.cmake2
-rw-r--r--src/google/protobuf/descriptor.cc14
6 files changed, 18 insertions, 10 deletions
diff --git a/appveyor.yml b/appveyor.yml
index 05ee0c63..1dd076a4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,11 +1,11 @@
-# Only test one combination: "Visual Studio 12 + Win64 + Debug + DLL". We can
-# test more combinations but AppVeyor just takes too long to finish (each
-# combination takes ~15mins).
configuration:
- Debug
environment:
matrix:
+ # Only test few combinations: "Visual Studio 2015 (14) + Win64/MinGW + Debug + DLL". We can
+ # test more combinations but AppVeyor just takes too long to finish (each
+ # combination takes ~15mins).
- platform: MinGW
language: cpp
image: Visual Studio 2015
diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake
index 06621cb8..1d0b0b84 100644
--- a/cmake/libprotobuf-lite.cmake
+++ b/cmake/libprotobuf-lite.cmake
@@ -48,9 +48,11 @@ set(libprotobuf_lite_includes
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
)
+if (MSVC)
set(libprotobuf_lite_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
+endif()
add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC}
${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${libprotobuf_lite_rc_files})
diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake
index a1fdf7c0..bd570be7 100644
--- a/cmake/libprotobuf.cmake
+++ b/cmake/libprotobuf.cmake
@@ -112,9 +112,11 @@ set(libprotobuf_includes
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h
)
+if (MSVC)
set(libprotobuf_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
+endif()
add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files})
diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
index 2d8b2322..04701818 100644
--- a/cmake/libprotoc.cmake
+++ b/cmake/libprotoc.cmake
@@ -161,9 +161,11 @@ set(libprotoc_headers
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
)
+if (MSVC)
set(libprotoc_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
+endif()
set(js_well_known_types_sources
${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types/any.js
diff --git a/cmake/protoc.cmake b/cmake/protoc.cmake
index 9bf6f5a9..bb160f47 100644
--- a/cmake/protoc.cmake
+++ b/cmake/protoc.cmake
@@ -2,9 +2,11 @@ set(protoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/main.cc
)
+if (MSVC)
set(protoc_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
+endif()
add_executable(protoc ${protoc_files} ${protoc_rc_files})
target_link_libraries(protoc libprotobuf libprotoc)
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index d466dd8b..dae24f9e 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -406,9 +406,10 @@ typedef std::pair<const EnumDescriptor*, int> EnumIntPair;
template<typename PairType>
struct PointerIntegerPairHash {
size_t operator()(const PairType& p) const {
- // FIXME(kenton): What is the best way to compute this hash? I have
- // no idea! This seems a bit better than an XOR.
- return reinterpret_cast<intptr_t>(p.first) * ((1 << 16) - 1) + p.second;
+ static const size_t prime1 = 16777499;
+ static const size_t prime2 = 16777619;
+ return reinterpret_cast<size_t>(p.first) * prime1 ^
+ static_cast<size_t>(p.second) * prime2;
}
#ifdef _MSC_VER
@@ -424,11 +425,10 @@ struct PointerIntegerPairHash {
struct PointerStringPairHash {
size_t operator()(const PointerStringPair& p) const {
- // FIXME(kenton): What is the best way to compute this hash? I have
- // no idea! This seems a bit better than an XOR.
+ static const size_t prime = 16777619;
hash<const char*> cstring_hash;
- return reinterpret_cast<intptr_t>(p.first) * ((1 << 16) - 1) +
- cstring_hash(p.second);
+ return reinterpret_cast<size_t>(p.first) * prime ^
+ static_cast<size_t>(cstring_hash(p.second));
}
#ifdef _MSC_VER