diff options
author | Andrew Morrow <acm@10gen.com> | 2012-11-16 09:55:25 -0500 |
---|---|---|
committer | Andrew Morrow <acm@10gen.com> | 2012-11-18 14:38:04 -0500 |
commit | 975bfa3635741b94ab25244add48131d5142e257 (patch) | |
tree | 8ae59dad571939e9b2294a83efb3eecf73827dd8 /src/mongo/bson/oid.cpp | |
parent | 34619f9cccb7159f8906f8cc9e48bf289084ef03 (diff) | |
download | mongo-975bfa3635741b94ab25244add48131d5142e257.tar.gz |
Add a static constant to OID to capture its data size
Diffstat (limited to 'src/mongo/bson/oid.cpp')
-rw-r--r-- | src/mongo/bson/oid.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/bson/oid.cpp b/src/mongo/bson/oid.cpp index f2f70da93cd..c3414202484 100644 --- a/src/mongo/bson/oid.cpp +++ b/src/mongo/bson/oid.cpp @@ -27,9 +27,13 @@ #define verify MONGO_verify +BOOST_STATIC_ASSERT( sizeof(mongo::OID) == mongo::OID::kOIDSize ); BOOST_STATIC_ASSERT( sizeof(mongo::OID) == 12 ); namespace mongo { + + const size_t OID::kOIDSize; + void OID::hash_combine(size_t &seed) const { boost::hash_combine(seed, x); boost::hash_combine(seed, y); @@ -149,7 +153,7 @@ namespace mongo { void OID::init( const std::string& s ) { verify( s.size() == 24 ); const char *p = s.c_str(); - for( int i = 0; i < 12; i++ ) { + for( size_t i = 0; i < kOIDSize; i++ ) { data[i] = fromHex(p); p += 2; } |