summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2022-11-02 12:05:01 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-02 22:47:27 +0000
commit082a22c0addd26f8065693ba81d3507b26e02311 (patch)
tree4d51b887e38b1d9da58e2697a6e666cc87ca620c
parente39ef953f5836461e8593f9dd77e90b484390a4c (diff)
downloadmongo-082a22c0addd26f8065693ba81d3507b26e02311.tar.gz
SERVER-71024 Fix Windows/Ninja build of bindata.cpp
-rw-r--r--src/mongo/scripting/mozjs/bindata.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/scripting/mozjs/bindata.cpp b/src/mongo/scripting/mozjs/bindata.cpp
index a20aec48088..cf34248de56 100644
--- a/src/mongo/scripting/mozjs/bindata.cpp
+++ b/src/mongo/scripting/mozjs/bindata.cpp
@@ -50,6 +50,11 @@
namespace mongo {
namespace mozjs {
+// Windows compiler fails to resolve the correct base64 identifier
+// specified in the MONGO_ATTACH macro below.
+// Explicitly set precedence on the one we want here.
+using base64 = typename BinDataInfo::Functions::base64;
+
const JSFunctionSpec BinDataInfo::methods[5] = {
MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(base64, BinDataInfo),
MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(hex, BinDataInfo),
@@ -81,7 +86,7 @@ void hexToBinData(JSContext* cx,
uassert(
ErrorCodes::BadValue, "BinData hex string must be an even length", hexstr.size() % 2 == 0);
- std::string encoded = base64::encode(hexblob::decode(hexstr));
+ std::string encoded = mongo::base64::encode(hexblob::decode(hexstr));
JS::RootedValueArray<2> args(cx);
args[0].setInt32(type);
@@ -243,7 +248,7 @@ void BinDataInfo::construct(JSContext* cx, JS::CallArgs args) {
auto str = ValueWriter(cx, utf).toString();
- auto tmpBase64 = base64::decode(str);
+ auto tmpBase64 = mongo::base64::decode(str);
JS::RootedObject thisv(cx);
scope->getProto<BinDataInfo>().newObject(&thisv);