diff options
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/catalog/cursor_manager.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/dbmessage.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/dbmessage.h | 18 | ||||
-rw-r--r-- | src/mongo/db/instance.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/storage/key_string.cpp | 2 |
5 files changed, 17 insertions, 14 deletions
diff --git a/src/mongo/db/catalog/cursor_manager.cpp b/src/mongo/db/catalog/cursor_manager.cpp index f68c6cbc1ab..0ea4f588839 100644 --- a/src/mongo/db/catalog/cursor_manager.cpp +++ b/src/mongo/db/catalog/cursor_manager.cpp @@ -298,7 +298,7 @@ namespace mongo { ConstDataCursor ids(_ids); int numDeleted = 0; for ( int i = 0; i < n; i++ ) { - if ( eraseCursorGlobalIfAuthorized(txn, ids.readLEAndAdvance<int64_t>())) + if ( eraseCursorGlobalIfAuthorized(txn, ids.readAndAdvance<LittleEndian<int64_t>>())) numDeleted++; if ( inShutdown() ) break; diff --git a/src/mongo/db/dbmessage.cpp b/src/mongo/db/dbmessage.cpp index 95593ab545a..2dbbce7704a 100644 --- a/src/mongo/db/dbmessage.cpp +++ b/src/mongo/db/dbmessage.cpp @@ -103,7 +103,7 @@ namespace mongo { const char* p = _nsStart + _nsLen + 1; checkRead<int>(p, 2); - return ConstDataView(p).readLE<int32_t>(sizeof(int32_t)); + return ConstDataView(p).read<LittleEndian<int32_t>>(sizeof(int32_t)); } int DbMessage::pullInt() { @@ -161,7 +161,7 @@ namespace mongo { T DbMessage::read() const { checkRead<T>(_nextjsobj, 1); - return ConstDataView(_nextjsobj).readLE<T>(); + return ConstDataView(_nextjsobj).read<LittleEndian<T>>(); } template<typename T> T DbMessage::readAndAdvance() { diff --git a/src/mongo/db/dbmessage.h b/src/mongo/db/dbmessage.h index 85d4ed731b4..78da93956c2 100644 --- a/src/mongo/db/dbmessage.h +++ b/src/mongo/db/dbmessage.h @@ -116,15 +116,15 @@ namespace mongo { } int64_t getCursorId() const { - return storage().readLE<int64_t>(offsetof(Layout, cursorId)); + return storage().read<LittleEndian<int64_t>>(offsetof(Layout, cursorId)); } int32_t getStartingFrom() const { - return storage().readLE<int32_t>(offsetof(Layout, startingFrom)); + return storage().read<LittleEndian<int32_t>>(offsetof(Layout, startingFrom)); } int32_t getNReturned() const { - return storage().readLE<int32_t>(offsetof(Layout, nReturned)); + return storage().read<LittleEndian<int32_t>>(offsetof(Layout, nReturned)); } const char* data() const { @@ -155,23 +155,23 @@ namespace mongo { } void setCursorId(int64_t value) { - storage().writeLE(value, offsetof(Layout, cursorId)); + storage().write(tagLittleEndian(value), offsetof(Layout, cursorId)); } void setStartingFrom(int32_t value) { - storage().writeLE(value, offsetof(Layout, startingFrom)); + storage().write(tagLittleEndian(value), offsetof(Layout, startingFrom)); } void setNReturned(int32_t value) { - storage().writeLE(value, offsetof(Layout, nReturned)); + storage().write(tagLittleEndian(value), offsetof(Layout, nReturned)); } int32_t getResultFlags() { - return DataView(msgdata().data()).readLE<int32_t>(); + return DataView(msgdata().data()).read<LittleEndian<int32_t>>(); } void setResultFlags(int32_t value) { - DataView(msgdata().data()).writeLE(value); + DataView(msgdata().data()).write(tagLittleEndian(value)); } void setResultFlagsToOk() { @@ -298,7 +298,7 @@ namespace mongo { if ( d.moreJSObjs() ) { fields = d.nextJsObj(); } - queryOptions = DataView(d.msg().header().data()).readLE<int32_t>(); + queryOptions = DataView(d.msg().header().data()).read<LittleEndian<int32_t>>(); } }; diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index c769b93d43d..4554866b796 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -308,7 +308,10 @@ namespace { // TODO: use OP_COMMAND here instead of constructing // a legacy OP_QUERY style command BufBuilder cmdMsgBuf; - cmdMsgBuf.appendNum(DataView(message.header().data()).readLE<int32_t>()); // flags + + int32_t flags = DataView(message.header().data()).read<LittleEndian<int32_t>>(); + cmdMsgBuf.appendNum(flags); + cmdMsgBuf.appendStr(interposedNss.db(), false); // not including null byte cmdMsgBuf.appendStr(".$cmd"); cmdMsgBuf.appendNum(0); // ntoskip diff --git a/src/mongo/db/storage/key_string.cpp b/src/mongo/db/storage/key_string.cpp index 2cd548aadf7..0df4a8d8096 100644 --- a/src/mongo/db/storage/key_string.cpp +++ b/src/mongo/db/storage/key_string.cpp @@ -181,7 +181,7 @@ namespace mongo { template <typename T> T readType(BufReader* reader, bool inverted) { // TODO for C++11 to static_assert that T is integral - T t = ConstDataView(static_cast<const char*>(reader->skip(sizeof(T)))).readNative<T>(); + T t = ConstDataView(static_cast<const char*>(reader->skip(sizeof(T)))).read<T>(); if (inverted) return ~t; return t; |