File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 5
5
// This is a stripped down shim to allow node_api.cc to build outside of the node source tree.
6
6
//
7
7
8
+ #include " util-inl.h"
8
9
#include < stdio.h>
9
10
10
11
// Windows 8+ does not like abort() in Release mode
Original file line number Diff line number Diff line change
1
+ #ifndef SRC_UTIL_INL_H_
2
+ #define SRC_UTIL_INL_H_
3
+
4
+ #include " util.h"
5
+ #include " v8.h"
6
+
7
+ namespace node {
8
+
9
+ inline v8::Local<v8::String> OneByteString (v8::Isolate* isolate,
10
+ const char * data,
11
+ int length) {
12
+ return v8::String::NewFromOneByte (isolate,
13
+ reinterpret_cast <const uint8_t *>(data),
14
+ v8::NewStringType::kNormal ,
15
+ length).ToLocalChecked ();
16
+ }
17
+
18
+ inline v8::Local<v8::String> OneByteString (v8::Isolate* isolate,
19
+ const signed char * data,
20
+ int length) {
21
+ return v8::String::NewFromOneByte (isolate,
22
+ reinterpret_cast <const uint8_t *>(data),
23
+ v8::NewStringType::kNormal ,
24
+ length).ToLocalChecked ();
25
+ }
26
+
27
+ inline v8::Local<v8::String> OneByteString (v8::Isolate* isolate,
28
+ const unsigned char * data,
29
+ int length) {
30
+ return v8::String::NewFromOneByte (isolate,
31
+ reinterpret_cast <const uint8_t *>(data),
32
+ v8::NewStringType::kNormal ,
33
+ length).ToLocalChecked ();
34
+ }
35
+
36
+ } // namespace node
37
+
38
+ #endif // SRC_UTIL_INL_H_
Original file line number Diff line number Diff line change
1
+ #ifndef SRC_UTIL_H_
2
+ #define SRC_UTIL_H_
3
+
4
+ #define FIXED_ONE_BYTE_STRING (isolate , string ) \
5
+ (node::OneByteString((isolate), (string), sizeof(string) - 1))
6
+
7
+ #endif // SRC_UTIL_H_
You can’t perform that action at this time.
0 commit comments