File tree 2 files changed +11
-25
lines changed
2 files changed +11
-25
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,14 @@ namespace node {
13
13
14
14
using v8::HandleScope;
15
15
using v8::Local;
16
+ using v8::NewStringType;
16
17
using v8::Object;
17
18
using v8::String;
18
19
19
20
Local<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 ();
21
24
}
22
25
23
26
void DefineJavaScript (Environment* env, Local<Object> target) {
@@ -26,10 +29,10 @@ void DefineJavaScript(Environment* env, Local<Object> target) {
26
29
for (int i = 0 ; natives[i].name ; i++) {
27
30
if (natives[i].source != node_native) {
28
31
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 ( );
33
36
target->Set (name, source);
34
37
}
35
38
}
Original file line number Diff line number Diff line change 42
42
43
43
44
44
def 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 ' )
63
46
64
47
65
48
def CompressScript (lines , do_jsmin ):
@@ -220,7 +203,7 @@ def ReadMacros(lines):
220
203
221
204
struct _native {
222
205
const char* name;
223
- const char* source;
206
+ const unsigned char* source;
224
207
size_t source_len;
225
208
};
226
209
@@ -242,7 +225,7 @@ def ReadMacros(lines):
242
225
"""
243
226
244
227
SOURCE_DECLARATION = """\
245
- const char %(escaped_id)s_native[] = { %(data)s };
228
+ const unsigned char %(escaped_id)s_native[] = { %(data)s };
246
229
"""
247
230
248
231
You can’t perform that action at this time.
0 commit comments