diff options
author | Jonathan Reams <jbreams@mongodb.com> | 2017-09-27 09:53:00 -0400 |
---|---|---|
committer | Jonathan Reams <jbreams@mongodb.com> | 2017-09-29 12:06:35 -0400 |
commit | 8e5e2ece9578f0d5ddcd345fbba7d9c5a86631c8 (patch) | |
tree | 029573c53b8ef1e3892c54d0674bde6df050b68c /site_scons | |
parent | fb4b207cddb61a9b1c5e010be693ba41156e7f58 (diff) | |
download | mongo-8e5e2ece9578f0d5ddcd345fbba7d9c5a86631c8.tar.gz |
SERVER-31222 JSFile source member should not be a reference
Diffstat (limited to 'site_scons')
-rw-r--r-- | site_scons/site_tools/jstoh.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/site_scons/site_tools/jstoh.py b/site_scons/site_tools/jstoh.py index 62424a6cd4f..dc90b324b28 100644 --- a/site_scons/site_tools/jstoh.py +++ b/site_scons/site_tools/jstoh.py @@ -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") |