diff options
author | Dwight <dwight@10gen.com> | 2011-10-03 13:43:34 -0400 |
---|---|---|
committer | Dwight <dwight@10gen.com> | 2011-10-03 13:43:34 -0400 |
commit | ae30374ed8d08950880558eb6dd0e545629c716f (patch) | |
tree | 5a060562b3984f90527e80324228062210821747 /bson | |
parent | 6d7e7fdf0d48c7e674dab1989e884a2b9aa02ed1 (diff) | |
parent | ffc77a17edc8b86496ef200b9a568ca9c6aeace9 (diff) | |
download | mongo-ae30374ed8d08950880558eb6dd0e545629c716f.tar.gz |
Merge branch 'master' of github.com:mongodb/mongo
Conflicts:
db/btree.cpp
db/db.vcxproj
dbtests/test.vcxproj
server.h
util/concurrency/rwlock.h
util/concurrency/value.h
Diffstat (limited to 'bson')
-rw-r--r-- | bson/bson-inl.h | 2 | ||||
-rw-r--r-- | bson/bsonobj.h | 5 | ||||
-rw-r--r-- | bson/bsonobjbuilder.h | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/bson/bson-inl.h b/bson/bson-inl.h index d8221d78df0..00f7ac87212 100644 --- a/bson/bson-inl.h +++ b/bson/bson-inl.h @@ -124,7 +124,7 @@ dodouble: int lsz = l.objsize(); // our bin data size in bytes, not including the subtype byte int rsz = r.objsize(); if ( lsz - rsz != 0 ) return lsz - rsz; - return memcmp(l.value()+4, r.value()+4, lsz+1); + return memcmp(l.value()+4, r.value()+4, lsz+1 /*+1 for subtype byte*/); } case RegEx: { int c = strcmp(l.regex(), r.regex()); diff --git a/bson/bsonobj.h b/bson/bsonobj.h index b3258a2c1d7..6adeb960887 100644 --- a/bson/bsonobj.h +++ b/bson/bsonobj.h @@ -254,6 +254,11 @@ namespace mongo { BSONElement getFieldUsingIndexNames(const char *fieldName, const BSONObj &indexKey) const; + /** arrays are bson objects with numeric and increasing field names + @return true if field names are numeric and increasing + */ + bool couldBeArray() const; + /** @return the raw data of the object */ const char *objdata() const { return _objdata; diff --git a/bson/bsonobjbuilder.h b/bson/bsonobjbuilder.h index f61d45879f3..86a52ac0cde 100644 --- a/bson/bsonobjbuilder.h +++ b/bson/bsonobjbuilder.h @@ -24,6 +24,7 @@ #include <limits> #include <cmath> +#include <boost/static_assert.hpp> #include "bsonelement.h" #include "bsonobj.h" #include "bsonmisc.h" @@ -764,6 +765,11 @@ namespace mongo { } void fill (int upTo){ + // if this is changed make sure to update error message and jstests/set7.js + const int maxElems = 1500000; + BOOST_STATIC_ASSERT(maxElems < (BSONObjMaxUserSize/10)); + uassert(15891, "can't backfill array to larger than 1,500,000 elements", upTo <= maxElems); + while( _i < upTo ) append( nullElt() ); } |