Skip to content

Commit 88293bd

Browse files
committed
MINOR fix compiler warnings
1 parent 53e63fd commit 88293bd

File tree

3 files changed

+59
-56
lines changed

3 files changed

+59
-56
lines changed

SConstruct

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ if useJavaHome:
328328

329329

330330
if nix:
331-
env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wnon-virtual-dtor" )
331+
env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare" )
332+
env.Append( CXXFLAGS=" -Wnon-virtual-dtor " )
332333
env.Append( LINKFLAGS=" -fPIC " )
333334
env.Append( LIBS=[] )
334335

db/storage.cpp

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
1-
// storage.cpp
2-
3-
#include "stdafx.h"
4-
#include "pdfile.h"
5-
#include "reccache.h"
6-
#include "rec.h"
7-
#include "db.h"
8-
9-
namespace mongo {
10-
11-
void writerThread();
12-
13-
static int inited;
14-
1+
// storage.cpp
2+
3+
#include "stdafx.h"
4+
#include "pdfile.h"
5+
#include "reccache.h"
6+
#include "rec.h"
7+
#include "db.h"
8+
9+
namespace mongo {
10+
11+
void writerThread();
12+
13+
#if defined(_RECSTORE)
14+
static int inited;
15+
#endif
16+
1517
// pick your store for indexes by setting this typedef
1618
// this doesn't need to be an ifdef, we can make it dynamic
1719
#if defined(_RECSTORE)
1820
RecStoreInterface *btreeStore = new CachedBasicRecStore();
1921
#else
2022
RecStoreInterface *btreeStore = new MongoMemMapped_RecStore();
2123
#endif
22-
23-
void BasicRecStore::init(const char *fn, unsigned recsize)
24-
{
25-
massert( "compile packing problem recstore?", sizeof(RecStoreHeader) == 8192);
26-
filename = fn;
27-
f.open(fn);
28-
uassert( string("couldn't open file:")+fn, f.is_open() );
29-
len = f.len();
30-
if( len == 0 ) {
31-
log() << "creating recstore file " << fn << '\n';
32-
h.recsize = recsize;
33-
len = sizeof(RecStoreHeader);
34-
f.write(0, (const char *) &h, sizeof(RecStoreHeader));
35-
}
36-
else {
37-
f.read(0, (char *) &h, sizeof(RecStoreHeader));
38-
massert(string("recstore was not closed cleanly: ")+fn, h.cleanShutdown==0);
39-
massert(string("recstore recsize mismatch, file:")+fn, h.recsize == recsize);
40-
massert(string("bad recstore [1], file:")+fn, (h.leof-sizeof(RecStoreHeader)) % recsize == 0);
41-
if( h.leof > len ) {
42-
stringstream ss;
43-
ss << "bad recstore, file:" << fn << " leof:" << h.leof << " len:" << len;
44-
massert(ss.str(), false);
45-
}
46-
if( h.cleanShutdown )
47-
log() << "warning: non-clean shutdown for file " << fn << '\n';
48-
h.cleanShutdown = 2;
49-
writeHeader();
50-
f.fsync();
51-
}
52-
#if defined(_RECSTORE)
53-
if( inited++ == 0 ) {
54-
boost::thread t(writerThread);
55-
}
56-
#endif
57-
}
58-
59-
}
24+
25+
void BasicRecStore::init(const char *fn, unsigned recsize)
26+
{
27+
massert( "compile packing problem recstore?", sizeof(RecStoreHeader) == 8192);
28+
filename = fn;
29+
f.open(fn);
30+
uassert( string("couldn't open file:")+fn, f.is_open() );
31+
len = f.len();
32+
if( len == 0 ) {
33+
log() << "creating recstore file " << fn << '\n';
34+
h.recsize = recsize;
35+
len = sizeof(RecStoreHeader);
36+
f.write(0, (const char *) &h, sizeof(RecStoreHeader));
37+
}
38+
else {
39+
f.read(0, (char *) &h, sizeof(RecStoreHeader));
40+
massert(string("recstore was not closed cleanly: ")+fn, h.cleanShutdown==0);
41+
massert(string("recstore recsize mismatch, file:")+fn, h.recsize == recsize);
42+
massert(string("bad recstore [1], file:")+fn, (h.leof-sizeof(RecStoreHeader)) % recsize == 0);
43+
if( h.leof > len ) {
44+
stringstream ss;
45+
ss << "bad recstore, file:" << fn << " leof:" << h.leof << " len:" << len;
46+
massert(ss.str(), false);
47+
}
48+
if( h.cleanShutdown )
49+
log() << "warning: non-clean shutdown for file " << fn << '\n';
50+
h.cleanShutdown = 2;
51+
writeHeader();
52+
f.fsync();
53+
}
54+
#if defined(_RECSTORE)
55+
if( inited++ == 0 ) {
56+
boost::thread t(writerThread);
57+
}
58+
#endif
59+
}
60+
61+
}

dbtests/perf/perftest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ namespace QueryTests {
541541
client_->insert( ns_.c_str(), obj );
542542
}
543543
void run() {
544-
ASSERT_EQUALS( 100000, client_->count( ns_, BSON( "a" << 1 ) ) );
544+
ASSERT_EQUALS( 100000U, client_->count( ns_, BSON( "a" << 1 ) ) );
545545
}
546546
string ns_;
547547
};
@@ -555,7 +555,7 @@ namespace QueryTests {
555555
client_->ensureIndex( ns_, obj );
556556
}
557557
void run() {
558-
ASSERT_EQUALS( 100000, client_->count( ns_, BSON( "a" << GTE << 1 ) ) );
558+
ASSERT_EQUALS( 100000U, client_->count( ns_, BSON( "a" << GTE << 1 ) ) );
559559
}
560560
string ns_;
561561
};
@@ -569,7 +569,7 @@ namespace QueryTests {
569569
client_->ensureIndex( ns_, obj );
570570
}
571571
void run() {
572-
ASSERT_EQUALS( 100000, client_->count( ns_, BSON( "a" << 1 ) ) );
572+
ASSERT_EQUALS( 100000U, client_->count( ns_, BSON( "a" << 1 ) ) );
573573
}
574574
string ns_;
575575
};

0 commit comments

Comments
 (0)