src: allow UTF-16 in generic StringBytes decode call

This allows removing a number of special cases in other
parts of the code, at least one of which was incorrect
in expecting aligned input when that was not guaranteed.

Fixes: https://github.com/nodejs/node/issues/22358

PR-URL: https://github.com/nodejs/node/pull/22622
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
Anna Henningsen authored and Michaël Zasso committed 2018-09-06 08:54:25 +02:00
1 parent 45388f7546
commit 79556e5f4e
6 files changed
+40 -96

No files matched your search

-1
View File
@@ -90,7 +90,6 @@ 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::MaybeLocal<v8::Value> Encode(v8::Isolate* isolate,
const char* buf,
size_t buflen,