summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonobjbuilder.h
diff options
context:
space:
mode:
authorAdam Midvidy <amidvidy@gmail.com>2014-09-19 16:43:33 -0400
committerBenety Goh <benety@mongodb.com>2014-09-19 16:50:23 -0400
commit78c5f9dd5ac65eae251df3e87175a0af076d90d9 (patch)
treee305dcd559f6b8f8a1ed987e6938e5b8406fea19 /src/mongo/bson/bsonobjbuilder.h
parent63dd64abac9002e71348b7550234131cd01a87f5 (diff)
downloadmongo-78c5f9dd5ac65eae251df3e87175a0af076d90d9.tar.gz
SERVER-15210 SERVER-15211 remove OID undefined behavior and make it endian aware
Closes #784 Signed-off-by: Benety Goh <benety@mongodb.com>
Diffstat (limited to 'src/mongo/bson/bsonobjbuilder.h')
-rw-r--r--src/mongo/bson/bsonobjbuilder.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/bson/bsonobjbuilder.h b/src/mongo/bson/bsonobjbuilder.h
index 52a9ecc0e2e..cf84f004221 100644
--- a/src/mongo/bson/bsonobjbuilder.h
+++ b/src/mongo/bson/bsonobjbuilder.h
@@ -306,14 +306,14 @@ namespace mongo {
_b.appendNum((char) jstOID);
_b.appendStr(fieldName);
if ( oid )
- _b.appendBuf( (void *) oid, 12 );
+ _b.appendBuf( oid->view().view(), OID::kOIDSize );
else {
OID tmp;
if ( generateIfBlank )
tmp.init();
else
tmp.clear();
- _b.appendBuf( (void *) &tmp, 12 );
+ _b.appendBuf( tmp.view().view(), OID::kOIDSize );
}
return *this;
}
@@ -326,7 +326,7 @@ namespace mongo {
BSONObjBuilder& append( const StringData& fieldName, OID oid ) {
_b.appendNum((char) jstOID);
_b.appendStr(fieldName);
- _b.appendBuf( (void *) &oid, 12 );
+ _b.appendBuf( oid.view().view(), OID::kOIDSize );
return *this;
}
@@ -492,7 +492,7 @@ namespace mongo {
_b.appendStr( fieldName );
_b.appendNum( (int) ns.size() + 1 );
_b.appendStr( ns );
- _b.appendBuf( (void *) &oid, 12 );
+ _b.appendBuf( oid.view().view(), OID::kOIDSize );
return *this;
}