0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

Clean up object size check

This commit is contained in:
Aaron 2009-01-21 11:14:35 -05:00
parent e6f024873d
commit 92368e6f00

View File

@ -78,14 +78,11 @@ namespace mongo {
massert( "Remaining data too small for BSON object", theEnd - nextjsobj > 3 );
BSONObj js(nextjsobj);
massert( "Invalid object size", js.objsize() > 3 );
assert( js.objsize() < ( theEnd - data ) );
if ( js.objsize() <= 0 )
nextjsobj = null;
else {
nextjsobj += js.objsize();
if ( nextjsobj >= theEnd )
nextjsobj = 0;
}
massert( "Next object larger than available space",
js.objsize() < ( theEnd - data ) );
nextjsobj += js.objsize();
if ( nextjsobj >= theEnd )
nextjsobj = 0;
return js;
}