diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2018-01-23 03:17:21 +0300 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2018-01-23 21:17:39 +0300 |
commit | b2b9d11a14c85296f2435894bcc43b94c10dce07 (patch) | |
tree | c37f312454637fff1b109fb93c7e76c11056c3a6 /src/string_bytes.h | |
parent | 0b1841d83f58caa507f602144a6b7cec831f3235 (diff) |
src: fix fs.write() externalized string handling
* Respect `encoding` argument when the string is externalized.
* Copy the string when the write request can outlive the externalized
string.
This commit removes `StringBytes::GetExternalParts()` because it is
fundamentally broken.
Fixes: https://github.com/nodejs/node/issues/18146
PR-URL: https://github.com/nodejs/node/pull/18216
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/string_bytes.h')
-rw-r--r-- | src/string_bytes.h | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/string_bytes.h b/src/string_bytes.h index 17bbd80c0ab..7a70f06f63d 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -81,12 +81,6 @@ class StringBytes { v8::Local<v8::Value> val, enum encoding enc); - // If the string is external then assign external properties to data and len, - // then return true. If not return false. - static bool GetExternalParts(v8::Local<v8::Value> val, - const char** data, - size_t* len); - // Write the bytes from the string or buffer into the char* // returns the number of bytes written, which will always be // <= buflen. Use StorageSize/Size first to know how much |