From 22bea6840a42ed0dd52074b87f10392f0ffc18f6 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 20 Jan 2010 17:13:15 -0800 Subject: [PATCH 1/2] SERVER-357 use sized integer types explicitly --- scripting/engine_spidermonkey.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp index ecba2cdf449..3466d2f6860 100644 --- a/scripting/engine_spidermonkey.cpp +++ b/scripting/engine_spidermonkey.cpp @@ -32,6 +32,9 @@ return JS_FALSE; \ } +using boost::uint32_t; +using boost::uint64_t; + namespace mongo { string trim( string s ){ @@ -160,9 +163,9 @@ namespace mongo { // NOTE No validation of passed in object long long toNumberLongUnsafe( JSObject *o ) { - unsigned long long val = - ( (unsigned long long)( getNumber( o , "top" ) ) << 32 ) + - ( unsigned )( getNumber( o , "bottom" ) ); + uint64_t val = + ( (uint64_t)( getNumber( o , "top" ) ) << 32 ) + + ( uint32_t)( getNumber( o , "bottom" ) ); return val; } @@ -565,7 +568,7 @@ namespace mongo { return OBJECT_TO_JSVAL( o ); } case NumberLong: { - unsigned long long val = (unsigned long long)e.numberLong(); + uint64_t val = (uint64_t)e.numberLong(); JSObject * o = JS_NewObject( _context , &numberlong_class , 0 , 0 ); // using 2 doubles here instead of a single double because certain double // bit patterns represent undefined values and sm might trash them From 1e85d9cacdbd03edf63106d9f028ccb10c7ccc3c Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 20 Jan 2010 17:17:36 -0800 Subject: [PATCH 2/2] MINOR remove unnecessary 'using' directive --- scripting/engine_spidermonkey.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp index 3466d2f6860..0042223d4c5 100644 --- a/scripting/engine_spidermonkey.cpp +++ b/scripting/engine_spidermonkey.cpp @@ -32,9 +32,6 @@ return JS_FALSE; \ } -using boost::uint32_t; -using boost::uint64_t; - namespace mongo { string trim( string s ){