summaryrefslogtreecommitdiff
path: root/src/mongo/bson
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2014-12-05 16:45:07 -0500
committerAndrew Morrow <acm@mongodb.com>2014-12-06 13:03:46 -0500
commita6788ec72a9dabb38bd92a8ab653e32034e9e02e (patch)
treeff4d51e3e64ce16b396020a30fffd3c69d9d93aa /src/mongo/bson
parentee6fa9cf4870f81de1a4005cce2be6a91ac551ac (diff)
downloadmongo-a6788ec72a9dabb38bd92a8ab653e32034e9e02e.tar.gz
SERVER-16427 Return a correct empty StringData for fieldNameStringData on EOO
Diffstat (limited to 'src/mongo/bson')
-rw-r--r--src/mongo/bson/bsonelement.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h
index 5cbfadc434f..e9d4e4b1939 100644
--- a/src/mongo/bson/bsonelement.h
+++ b/src/mongo/bson/bsonelement.h
@@ -169,7 +169,7 @@ namespace mongo {
}
const StringData fieldNameStringData() const {
- return StringData(fieldName(), fieldNameSize() - 1);
+ return StringData(fieldName(), eoo() ? 0 : fieldNameSize() - 1);
}
/** raw data of the element's value (so be careful). */
@@ -647,8 +647,8 @@ namespace mongo {
}
inline BSONElement::BSONElement() {
- static char z = 0;
- data = &z;
+ static const char kEooElement[] = "";
+ data = kEooElement;
fieldNameSize_ = 0;
totalSize = 1;
}