2626#include < cmath>
2727#include < boost/static_assert.hpp>
2828#if defined(MONGO_EXPOSE_MACROS)
29- // boost changed it
30- #undef assert
31- #define assert MONGO_assert
29+ #define verify MONGO_verify
3230#endif
3331#include " bsonelement.h"
3432#include " bsonobj.h"
@@ -123,14 +121,14 @@ namespace mongo {
123121
124122 /* * append element to the object we are building */
125123 BSONObjBuilder& append ( const BSONElement& e) {
126- assert ( !e.eoo () ); // do not append eoo, that would corrupt us. the builder auto appends when done() is called.
124+ verify ( !e.eoo () ); // do not append eoo, that would corrupt us. the builder auto appends when done() is called.
127125 _b.appendBuf ((void *) e.rawdata (), e.size ());
128126 return *this ;
129127 }
130128
131129 /* * append an element but with a new name */
132130 BSONObjBuilder& appendAs (const BSONElement& e, const StringData& fieldName) {
133- assert ( !e.eoo () ); // do not append eoo, that would corrupt us. the builder auto appends when done() is called.
131+ verify ( !e.eoo () ); // do not append eoo, that would corrupt us. the builder auto appends when done() is called.
134132 _b.appendNum ((char ) e.type ());
135133 _b.appendStr (fieldName);
136134 _b.appendBuf ((void *) e.value (), e.valuesize ());
@@ -147,12 +145,12 @@ namespace mongo {
147145
148146 /* * add a subobject as a member */
149147 BSONObjBuilder& appendObject (const StringData& fieldName, const char * objdata , int size = 0 ) {
150- assert ( objdata );
148+ verify ( objdata );
151149 if ( size == 0 ) {
152150 size = *((int *)objdata);
153151 }
154152
155- assert ( size > 4 && size < 100000000 );
153+ verify ( size > 4 && size < 100000000 );
156154
157155 _b.appendNum ((char ) Object);
158156 _b.appendStr (fieldName);
@@ -582,7 +580,7 @@ namespace mongo {
582580 /* assume ownership of the buffer - you must then free it (with free()) */
583581 char * decouple (int & l) {
584582 char *x = _done ();
585- assert ( x );
583+ verify ( x );
586584 l = _b.len ();
587585 _b.decouple ();
588586 return x;
0 commit comments