summaryrefslogtreecommitdiff
path: root/tools/tool.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-06-18 21:24:41 +0200
committerAntonin Kral <a.kral@bobek.cz>2011-06-18 21:24:41 +0200
commit64b33ee522375a8dc15be2875dfb7db4502259b0 (patch)
tree44979e0aaf6bb576f4a737a93e071e28809b6779 /tools/tool.cpp
parent4d87ff4aa74d7ae975268ac43eee152dc3f5b7e9 (diff)
Imported Upstream version 1.8.2upstream/1.8.2
Diffstat (limited to 'tools/tool.cpp')
-rw-r--r--tools/tool.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/tool.cpp b/tools/tool.cpp
index f687269cf00..54dc5dfb2c5 100644
--- a/tools/tool.cpp
+++ b/tools/tool.cpp
@@ -400,14 +400,14 @@ namespace mongo {
ProgressMeter m( fileLength );
while ( read < fileLength ) {
- int readlen = fread(buf, 4, 1, file);
+ size_t amt = fread(buf, 1, 4, file);
+ assert( amt == 4 );
+
int size = ((int*)buf)[0];
- if ( size >= BUF_SIZE ) {
- cerr << "got an object of size: " << size << " terminating..." << endl;
- }
- uassert( 10264 , "invalid object size" , size < BUF_SIZE );
+ uassert( 10264 , str::stream() << "invalid object size: " << size , size < BUF_SIZE );
- readlen = fread(buf+4, size-4, 1, file);
+ amt = fread(buf+4, 1, size-4, file);
+ assert( amt == (size_t)( size - 4 ) );
BSONObj o( buf );
if ( _objcheck && ! o.valid() ) {