summaryrefslogtreecommitdiff
path: root/tools/tool.cpp
diff options
context:
space:
mode:
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 f687269..54dc5df 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() ) {