aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2008-09-19 16:53:32 +0000
committerGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2008-09-19 16:53:32 +0000
commit4410396f11bbce82ed806f93ab9befb8034619b1 (patch)
tree1f965a83c84fcf1988d7d8f442817ab1038fb4c9
parent4014b9f83f612cd6ca4348b0d2ca9974d44e671d (diff)
Work around absence of hash_map.
Also, update version numbers to 2.0.2-SNAPSHOT.
-rw-r--r--configure.ac2
-rw-r--r--java/pom.xml2
-rwxr-xr-xpython/setup.py2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/google/protobuf/descriptor.pb.h4
-rw-r--r--src/google/protobuf/stubs/common.h10
-rw-r--r--src/google/protobuf/stubs/hash.h55
7 files changed, 62 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index f23b2532..203a2ff9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ AC_PREREQ(2.59)
# * java/pom.xml
# * python/setup.py
# * src/google/protobuf/stubs/common.h
-AC_INIT(protobuf, 2.0.1, protobuf@googlegroups.com)
+AC_INIT(protobuf, 2.0.2-SNAPSHOT, protobuf@googlegroups.com)
AC_CONFIG_SRCDIR(src/google/protobuf/message.cc)
AM_CONFIG_HEADER(config.h)
diff --git a/java/pom.xml b/java/pom.xml
index 82f45bdc..de27241f 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -10,7 +10,7 @@
</parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
- <version>2.0.1</version>
+ <version>2.0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Protocol Buffer Java API</name>
<description>
diff --git a/python/setup.py b/python/setup.py
index 44d0f39b..96896d57 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -102,7 +102,7 @@ if __name__ == '__main__':
generate_proto("../src/google/protobuf/descriptor.proto")
setup(name = 'protobuf',
- version = '2.0.1',
+ version = '2.0.2-SNAPSHOT',
packages = [ 'google' ],
namespace_packages = [ 'google' ],
test_suite = 'setup.MakeTestSuite',
diff --git a/src/Makefile.am b/src/Makefile.am
index 2997cdd5..7ba52706 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,7 +55,7 @@ nobase_include_HEADERS = \
lib_LTLIBRARIES = libprotobuf.la libprotoc.la
libprotobuf_la_LIBADD = $(PTHREAD_LIBS)
-libprotobuf_la_LDFLAGS = -version-info 0:0:0
+libprotobuf_la_LDFLAGS = -version-info 2:0:0
libprotobuf_la_SOURCES = \
google/protobuf/stubs/common.cc \
google/protobuf/stubs/hash.cc \
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index 926e9bd0..a1a5f1f3 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -7,12 +7,12 @@
#include <google/protobuf/stubs/common.h>
-#if GOOGLE_PROTOBUF_VERSION < 2000001
+#if GOOGLE_PROTOBUF_VERSION < 2000002
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 2000001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 2000002 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index 89070d63..2cc42f16 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -65,24 +65,24 @@ namespace internal {
// The current version, represented as a single integer to make comparison
// easier: major * 10^6 + minor * 10^3 + micro
-#define GOOGLE_PROTOBUF_VERSION 2000001
+#define GOOGLE_PROTOBUF_VERSION 2000002
// The minimum library version which works with the current version of the
// headers.
-#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 2000001
+#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 2000002
// The minimum header version which works with the current version of
// the library. This constant should only be used by protoc's C++ code
// generator.
-static const int kMinHeaderVersionForLibrary = 2000001;
+static const int kMinHeaderVersionForLibrary = 2000002;
// The minimum protoc version which works with the current version of the
// headers.
-#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 2000001
+#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 2000002
// The minimum header version which works with the current version of
// protoc. This constant should only be used in VerifyVersion().
-static const int kMinHeaderVersionForProtoc = 2000001;
+static const int kMinHeaderVersionForProtoc = 2000002;
// Verifies that the headers and libraries are compatible. Use the macro
// below to call this.
diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h
index a62b3f6e..27b83ed4 100644
--- a/src/google/protobuf/stubs/hash.h
+++ b/src/google/protobuf/stubs/hash.h
@@ -29,15 +29,62 @@
#include HASH_MAP_H
#include HASH_SET_H
#else
-// TODO(kenton): Deal with non-existence of hash_map somehow. Maybe emulate
-// it with map?
-#error "Your STL implementation lacks hash_map and/or hash_set."
+#define MISSING_HASH
+#include <map>
+#include <set>
#endif
namespace google {
namespace protobuf {
-#ifdef _MSC_VER
+#ifdef MISSING_HASH
+
+// This system doesn't have hash_map or hash_set. Emulate them using map and
+// set.
+
+// Make hash<T> be the same as less<T>. Note that everywhere where custom
+// hash functions are defined in the protobuf code, they are also defined such
+// that they can be used as "less" functions, which is required by MSVC anyway.
+template <typename Key>
+struct hash {
+ // Dummy, just to make derivative hash functions compile.
+ int operator()(const Key& key) {
+ GOOGLE_LOG(FATAL) << "Should never be called.";
+ return 0;
+ }
+
+ inline bool operator()(const Key& a, const Key& b) const {
+ return a < b;
+ }
+};
+
+// Make sure char* is compared by value.
+template <>
+struct hash<const char*> {
+ // Dummy, just to make derivative hash functions compile.
+ int operator()(const char* key) {
+ GOOGLE_LOG(FATAL) << "Should never be called.";
+ return 0;
+ }
+
+ inline bool operator()(const char* a, const char* b) const {
+ return strcmp(a, b) < 0;
+ }
+};
+
+template <typename Key, typename Data,
+ typename HashFcn = hash<Key>,
+ typename EqualKey = int >
+class hash_map : public std::map<Key, Data, HashFcn> {
+};
+
+template <typename Key,
+ typename HashFcn = hash<Key>,
+ typename EqualKey = int >
+class hash_set : public std::set<Key, HashFcn> {
+};
+
+#elif defined(_MSC_VER)
template <typename Key>
struct hash : public HASH_NAMESPACE::hash_compare<Key> {