diff options
author | Antonin Kral <a.kral@bobek.cz> | 2010-03-25 19:21:32 +0100 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2010-03-25 19:21:32 +0100 |
commit | 0ca01a91ae0a3562e54c226e7b9512feb2ea83d0 (patch) | |
tree | 2b3886e435b0217d6afd63a213b04d32bb4b4f6f /db/dbmessage.h | |
parent | a696359b248adef0cc8576fce3f473535e995136 (diff) | |
download | mongodb-0ca01a91ae0a3562e54c226e7b9512feb2ea83d0.tar.gz |
Imported Upstream version 1.4.0
Diffstat (limited to 'db/dbmessage.h')
-rw-r--r-- | db/dbmessage.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/db/dbmessage.h b/db/dbmessage.h index 54a2ac3..ba5cf94 100644 --- a/db/dbmessage.h +++ b/db/dbmessage.h @@ -16,7 +16,7 @@ #pragma once -#include "storage.h" +#include "diskloc.h" #include "jsobj.h" #include "namespace.h" #include "../util/message.h" @@ -133,8 +133,10 @@ namespace mongo { return nextjsobj != 0; } BSONObj nextJsObj() { - if ( nextjsobj == data ) + if ( nextjsobj == data ) { nextjsobj += strlen(data) + 1; // skip namespace + massert( 13066 , "Message contains no documents", theEnd > nextjsobj ); + } massert( 10304 , "Remaining data too small for BSON object", theEnd - nextjsobj > 3 ); BSONObj js(nextjsobj); massert( 10305 , "Invalid object size", js.objsize() > 3 ); @@ -180,7 +182,7 @@ namespace mongo { int ntoreturn; int queryOptions; BSONObj query; - auto_ptr< FieldMatcher > fields; + BSONObj fields; /* parses the message into the above fields */ QueryMessage(DbMessage& d) { @@ -189,11 +191,7 @@ namespace mongo { ntoreturn = d.pullInt(); query = d.nextJsObj(); if ( d.moreJSObjs() ) { - BSONObj o = d.nextJsObj(); - if (!o.isEmpty()){ - fields = auto_ptr< FieldMatcher >(new FieldMatcher() ); - fields->add( o ); - } + fields = d.nextJsObj(); } queryOptions = d.msg().data->dataAsInt(); } @@ -222,9 +220,8 @@ namespace mongo { qr->startingFrom = startingFrom; qr->nReturned = nReturned; b.decouple(); - Message *resp = new Message(); - resp->setData(qr, true); // transport will free - p->reply(requestMsg, *resp, requestMsg.data->id); + Message resp(qr, true); + p->reply(requestMsg, resp, requestMsg.data->id); } } // namespace mongo |