diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-12-10 17:33:56 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2014-12-14 16:01:47 +0100 |
commit | 56fde66c46653e5c0fbc6e8960d8a013af35f42b (patch) | |
tree | c73a2e4a7ddfea89b553c8af6746abe2c3623b0c /src/string_bytes.h | |
parent | a60056df3cad2867d337fc1d7adeebe66f89031a (diff) | |
download | android-node-v8-56fde66c46653e5c0fbc6e8960d8a013af35f42b.tar.gz android-node-v8-56fde66c46653e5c0fbc6e8960d8a013af35f42b.tar.bz2 android-node-v8-56fde66c46653e5c0fbc6e8960d8a013af35f42b.zip |
src: redo unaligned access workaround
Introduce two-byte overloads of node::Encode() and StringBytes::Encode()
that ensure that the input is suitably aligned.
Revisits commit 535fec8 from yesterday.
Diffstat (limited to 'src/string_bytes.h')
-rw-r--r-- | src/string_bytes.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/string_bytes.h b/src/string_bytes.h index 10fee30913..a67bd45e49 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -71,11 +71,16 @@ class StringBytes { int* chars_written = nullptr); // Take the bytes in the src, and turn it into a Buffer or String. + // Don't call with encoding=UCS2. static v8::Local<v8::Value> Encode(v8::Isolate* isolate, const char* buf, size_t buflen, enum encoding encoding); + static v8::Local<v8::Value> Encode(v8::Isolate* isolate, + const uint16_t* buf, + size_t buflen); + // Deprecated legacy interface NODE_DEPRECATED("Use IsValidString(isolate, ...)", |