0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-31222 JSFile source member should not be a reference

This commit is contained in:
Jonathan Reams 2017-09-27 09:53:00 -04:00
parent fb4b207cdd
commit 8e5e2ece95
2 changed files with 5 additions and 5 deletions

View File

@ -8,8 +8,8 @@ def jsToHeader(target, source):
h = [
'#include "mongo/base/string_data.h"',
'#include "mongo/scripting/engine.h"',
'namespace mongo {',
'struct JSFile{ const char* name; const StringData& source; };',
'namespace JSFiles{',
]
@ -21,7 +21,7 @@ def jsToHeader(target, source):
objname = os.path.split(filename)[1].split('.')[0]
stringname = '_jscode_raw_' + objname
h.append('const char ' + stringname + "[] = {")
h.append('constexpr char ' + stringname + "[] = {")
with open(filename, 'r') as f:
for line in f:
@ -30,8 +30,8 @@ def jsToHeader(target, source):
h.append("0};")
# symbols aren't exported w/o this
h.append('extern const JSFile %s;' % objname)
h.append('const JSFile %s = { "%s", StringData(%s) };' %
(objname, filename.replace('\\', '/'), stringname))
h.append('const JSFile %s = { "%s", StringData(%s, sizeof(%s) - 1) };' %
(objname, filename.replace('\\', '/'), stringname, stringname))
h.append("} // namespace JSFiles")
h.append("} // namespace mongo")

View File

@ -43,7 +43,7 @@ class OperationContext;
struct JSFile {
const char* name;
const StringData& source;
const StringData source;
};
class Scope {