diff options
-rw-r--r-- | src/mongo/bson/bsonobjbuilder.h | 2 | ||||
-rw-r--r-- | src/mongo/bson/util/builder.h | 6 | ||||
-rw-r--r-- | src/mongo/db/index/index_build_interceptor.cpp | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/bson/bsonobjbuilder.h b/src/mongo/bson/bsonobjbuilder.h index a7860a45588..4dad20d270d 100644 --- a/src/mongo/bson/bsonobjbuilder.h +++ b/src/mongo/bson/bsonobjbuilder.h @@ -663,7 +663,7 @@ protected: // BufBuilder but do not own it ourselves, then we must call _done to write in the // length. Otherwise, we own this memory and its lifetime ends with us, therefore // we can elide the write. - return !_doneCalled && _b.buf() && _buf.getSize() == 0; + return !_doneCalled && _b.buf() && _buf.capacity() == 0; } // Must be called by derived class destructors. diff --git a/src/mongo/bson/util/builder.h b/src/mongo/bson/util/builder.h index ad0286afde7..70daf863547 100644 --- a/src/mongo/bson/util/builder.h +++ b/src/mongo/bson/util/builder.h @@ -387,15 +387,15 @@ public: str.copyTo(grow(len), includeEndingNull); } - /** @return length of current std::string */ + /** Returns the length of data in the current buffer */ int len() const { return l; } void setlen(int newLen) { l = newLen; } - /** @return size of the buffer */ - int getSize() const { + /** Returns the capacity of the buffer */ + int capacity() const { return _buf.capacity(); } diff --git a/src/mongo/db/index/index_build_interceptor.cpp b/src/mongo/db/index/index_build_interceptor.cpp index 835441e7109..77d13478b30 100644 --- a/src/mongo/db/index/index_build_interceptor.cpp +++ b/src/mongo/db/index/index_build_interceptor.cpp @@ -483,7 +483,7 @@ Status IndexBuildInterceptor::sideWrite(OperationContext* opCtx, // from getBuffer(). builder.reset(); keyString.serialize(builder); - BSONBinData binData(builder.buf(), builder.getSize(), BinDataGeneral); + BSONBinData binData(builder.buf(), builder.len(), BinDataGeneral); toInsert.emplace_back(BSON("op" << (op == Op::kInsert ? "i" : "d") << "key" << binData)); } @@ -494,7 +494,7 @@ Status IndexBuildInterceptor::sideWrite(OperationContext* opCtx, for (const auto& keyString : multikeyMetadataKeys) { builder.reset(); keyString.serialize(builder); - BSONBinData binData(builder.buf(), builder.getSize(), BinDataGeneral); + BSONBinData binData(builder.buf(), builder.len(), BinDataGeneral); toInsert.emplace_back(BSON("op" << "i" << "key" << binData)); |