~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to src/mongo/db/dbmessage.h

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Robie Basak
  • Date: 2013-05-29 17:44:42 UTC
  • mfrom: (44.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130529174442-z0a4qmoww4y0t458
Tags: 1:2.4.3-1ubuntu1
[ James Page ]
* Merge from Debian unstable, remaining changes:
  - Enable SSL support:
    + d/control: Add libssl-dev to BD's.
    + d/rules: Enabled --ssl option.
    + d/mongodb.conf: Add example SSL configuration options.
  - d/mongodb-server.mongodb.upstart: Add upstart configuration.
  - d/rules: Don't strip binaries during scons build for Ubuntu.
  - d/control: Add armhf to target archs.
  - d/p/SConscript.client.patch: fixup install of client libraries.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
* Dropped changes:
  - d/p/arm-support.patch: Included in Debian.
  - d/p/double-alignment.patch: Included in Debian.
  - d/rules,control: Debian also builds with avaliable system libraries
    now.
* Fix FTBFS due to gcc and boost upgrades in saucy:
  - d/p/0008-ignore-unused-local-typedefs.patch: Add -Wno-unused-typedefs
    to unbreak building with g++-4.8.
  - d/p/0009-boost-1.53.patch: Fixup signed/unsigned casting issue.

[ Robie Basak ]
* d/p/0011-Use-a-signed-char-to-store-BSONType-enumerations.patch: Fixup
  build failure on ARM due to missing signed'ness of char cast.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "../util/net/message.h"
24
24
#include "../client/constants.h"
25
25
#include "instance.h"
 
26
#include "mongo/bson/bson_validate.h"
26
27
 
27
28
namespace mongo {
28
29
 
196
197
                nextjsobj += strlen(data) + 1; // skip namespace
197
198
                massert( 13066 ,  "Message contains no documents", theEnd > nextjsobj );
198
199
            }
199
 
            massert( 10304 ,  "Client Error: Remaining data too small for BSON object", theEnd - nextjsobj > 3 );
 
200
            massert( 10304,
 
201
                     "Client Error: Remaining data too small for BSON object",
 
202
                     theEnd - nextjsobj >= 5 );
 
203
 
 
204
            if ( cmdLine.objcheck ) {
 
205
                Status status = validateBSON( nextjsobj, theEnd - nextjsobj );
 
206
                massert( 10307,
 
207
                         str::stream() << "Client Error: bad object in message: " << status.reason(),
 
208
                         status.isOK() );
 
209
            }
 
210
 
200
211
            BSONObj js(nextjsobj);
201
 
            massert( 10305 ,  "Client Error: Invalid object size", js.objsize() > 3 );
202
 
            massert( 10306 ,  "Client Error: Next object larger than space left in message",
203
 
                     js.objsize() < ( theEnd - data ) );
204
 
            if ( cmdLine.objcheck && !js.valid() ) {
205
 
                massert( 10307 , "Client Error: bad object in message", false);
206
 
            }
 
212
            verify( js.objsize() >= 5 );
 
213
            verify( js.objsize() < ( theEnd - data ) );
 
214
 
207
215
            nextjsobj += js.objsize();
208
216
            if ( nextjsobj >= theEnd )
209
217
                nextjsobj = 0;
212
220
 
213
221
        const Message& msg() const { return m; }
214
222
 
 
223
        const char * markGet() {
 
224
            return nextjsobj;
 
225
        }
 
226
 
215
227
        void markSet() {
216
228
            mark = nextjsobj;
217
229
        }
218
230
 
219
 
        void markReset() {
220
 
            verify( mark );
221
 
            nextjsobj = mark;
 
231
        void markReset( const char * toMark = 0) {
 
232
            if( toMark == 0 ) toMark = mark;
 
233
            verify( toMark );
 
234
            nextjsobj = toMark;
222
235
        }
223
236
 
224
237
    private:
266
279
    /* object reply helper. */
267
280
    void replyToQuery(int queryResultFlags,
268
281
                      AbstractMessagingPort* p, Message& requestMsg,
269
 
                      BSONObj& responseObj);
 
282
                      const BSONObj& responseObj);
270
283
 
271
284
    /* helper to do a reply using a DbResponse object */
272
285
    void replyToQuery( int queryResultFlags, Message& m, DbResponse& dbresponse, BSONObj obj );