diff options
author | Tyler Kaye <tyler.kaye@mongodb.com> | 2017-06-07 15:06:51 -0400 |
---|---|---|
committer | Tyler Kaye <tkaye@princeton.edu> | 2017-06-12 11:48:40 -0400 |
commit | d86fe12469ee5852a4dae7e2ff85894c9e5b91fa (patch) | |
tree | 7e7839c73b4dc392794b839a18bc605a58c00aaa /src/mongo/scripting | |
parent | 7aecd4552f0e913e4e4a169c366b7d450e32e05b (diff) | |
download | mongo-d86fe12469ee5852a4dae7e2ff85894c9e5b91fa.tar.gz |
SERVER-10601 --> remove parseLL() function definition and use in numberlong.cpp
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r-- | src/mongo/scripting/mozjs/numberlong.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/scripting/mozjs/numberlong.cpp b/src/mongo/scripting/mozjs/numberlong.cpp index d211ed44081..f03a0631805 100644 --- a/src/mongo/scripting/mozjs/numberlong.cpp +++ b/src/mongo/scripting/mozjs/numberlong.cpp @@ -33,6 +33,7 @@ #include <boost/optional.hpp> #include <js/Conversions.h> +#include "mongo/base/parse_number.h" #include "mongo/scripting/mozjs/implscope.h" #include "mongo/scripting/mozjs/objectwrapper.h" #include "mongo/scripting/mozjs/valuereader.h" @@ -170,7 +171,10 @@ void NumberLongInfo::construct(JSContext* cx, JS::CallArgs args) { // For string values we call strtoll because we expect non-number string // values to fail rather than return 0 (which is the behavior of ToInt64). std::string str = ValueWriter(cx, arg).toString(); - numLong = parseLL(str.c_str()); + + // Call parseNumberFromStringWithBase() function to convert string to a number + Status status = parseNumberFromStringWithBase(str, 10, &numLong); + uassert(ErrorCodes::BadValue, "could not convert string to long long", status.isOK()); } else { numLong = ValueWriter(cx, arg).toInt64(); } |