File tree Expand file tree Collapse file tree 2 files changed +11
-25
lines changed Expand file tree Collapse file tree 2 files changed +11
-25
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,14 @@ namespace node {
1313
1414using v8::HandleScope;
1515using v8::Local;
16+ using v8::NewStringType;
1617using v8::Object;
1718using v8::String;
1819
1920Local<String> MainSource (Environment* env) {
20- return OneByteString (env->isolate (), node_native, sizeof (node_native) - 1 );
21+ return String::NewFromUtf8 (
22+ env->isolate (), reinterpret_cast <const char *>(node_native),
23+ NewStringType::kNormal , sizeof (node_native) - 1 ).ToLocalChecked ();
2124}
2225
2326void DefineJavaScript (Environment* env, Local<Object> target) {
@@ -26,10 +29,10 @@ void DefineJavaScript(Environment* env, Local<Object> target) {
2629 for (int i = 0 ; natives[i].name ; i++) {
2730 if (natives[i].source != node_native) {
2831 Local<String> name = String::NewFromUtf8 (env->isolate (), natives[i].name );
29- Local<String> source = String::NewFromUtf8 (env-> isolate (),
30- natives[i]. source ,
31- String:: kNormalString ,
32- natives[i].source_len );
32+ Local<String> source =
33+ String::NewFromUtf8 (
34+ env-> isolate (), reinterpret_cast < const char *>(natives[i]. source ) ,
35+ NewStringType:: kNormal , natives[i].source_len ). ToLocalChecked ( );
3336 target->Set (name, source);
3437 }
3538 }
Original file line number Diff line number Diff line change 4242
4343
4444def ToCArray (filename , lines ):
45- result = []
46- row = 1
47- col = 0
48- for chr in lines :
49- col += 1
50- if chr == "\n " or chr == "\r " :
51- row += 1
52- col = 0
53-
54- value = ord (chr )
55-
56- if value >= 128 :
57- print 'non-ascii value ' + filename + ':' + str (row ) + ':' + str (col )
58- sys .exit (1 );
59-
60- result .append (str (value ))
61- result .append ("0" )
62- return ", " .join (result )
45+ return ',' .join (str (ord (c )) for c in lines + '\0 ' )
6346
6447
6548def CompressScript (lines , do_jsmin ):
@@ -220,7 +203,7 @@ def ReadMacros(lines):
220203
221204struct _native {
222205 const char* name;
223- const char* source;
206+ const unsigned char* source;
224207 size_t source_len;
225208};
226209
@@ -242,7 +225,7 @@ def ReadMacros(lines):
242225"""
243226
244227SOURCE_DECLARATION = """\
245- const char %(escaped_id)s_native[] = { %(data)s };
228+ const unsigned char %(escaped_id)s_native[] = { %(data)s };
246229"""
247230
248231
You can’t perform that action at this time.
0 commit comments