summaryrefslogtreecommitdiff
path: root/src/node_buffer.cc
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2016-06-02 10:55:36 -0600
committerTrevor Norris <trev.norris@gmail.com>2016-06-07 13:51:14 -0600
commit54cc7212df320f1e489edf8dbeabb167a71cbe67 (patch)
tree19764d4f8f0d84373bb9de96844043fad342c9c0 /src/node_buffer.cc
parentc300ba22128ce8e675650adcd1f6b869dc1b5126 (diff)
downloadandroid-node-v8-54cc7212df320f1e489edf8dbeabb167a71cbe67.tar.gz
android-node-v8-54cc7212df320f1e489edf8dbeabb167a71cbe67.tar.bz2
android-node-v8-54cc7212df320f1e489edf8dbeabb167a71cbe67.zip
buffer: introduce latin1 encoding term
When node began using the OneByte API (f150d56) it also switched to officially supporting ISO-8859-1. Though at the time no new encoding string was introduced. Introduce the new encoding string 'latin1' to be more explicit. The previous 'binary' and documented as an alias to 'latin1'. While many tests have switched to use 'latin1', there are still plenty that do both 'binary' and 'latin1' checks side-by-side to ensure there is no regression. PR-URL: https://github.com/nodejs/node/pull/7111 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r--src/node_buffer.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index 388decac4a..2472c0bb82 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -491,8 +491,8 @@ void StringSlice<UCS2>(const FunctionCallbackInfo<Value>& args) {
}
-void BinarySlice(const FunctionCallbackInfo<Value>& args) {
- StringSlice<BINARY>(args);
+void Latin1Slice(const FunctionCallbackInfo<Value>& args) {
+ StringSlice<LATIN1>(args);
}
@@ -692,8 +692,8 @@ void Base64Write(const FunctionCallbackInfo<Value>& args) {
}
-void BinaryWrite(const FunctionCallbackInfo<Value>& args) {
- StringWrite<BINARY>(args);
+void Latin1Write(const FunctionCallbackInfo<Value>& args) {
+ StringWrite<LATIN1>(args);
}
@@ -1035,7 +1035,7 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) {
needle_length,
offset,
is_forward);
- } else if (enc == BINARY) {
+ } else if (enc == LATIN1) {
uint8_t* needle_data = static_cast<uint8_t*>(malloc(needle_length));
if (needle_data == nullptr) {
return args.GetReturnValue().Set(-1);
@@ -1183,14 +1183,14 @@ void SetupBufferJS(const FunctionCallbackInfo<Value>& args) {
env->SetMethod(proto, "asciiSlice", AsciiSlice);
env->SetMethod(proto, "base64Slice", Base64Slice);
- env->SetMethod(proto, "binarySlice", BinarySlice);
+ env->SetMethod(proto, "latin1Slice", Latin1Slice);
env->SetMethod(proto, "hexSlice", HexSlice);
env->SetMethod(proto, "ucs2Slice", Ucs2Slice);
env->SetMethod(proto, "utf8Slice", Utf8Slice);
env->SetMethod(proto, "asciiWrite", AsciiWrite);
env->SetMethod(proto, "base64Write", Base64Write);
- env->SetMethod(proto, "binaryWrite", BinaryWrite);
+ env->SetMethod(proto, "latin1Write", Latin1Write);
env->SetMethod(proto, "hexWrite", HexWrite);
env->SetMethod(proto, "ucs2Write", Ucs2Write);
env->SetMethod(proto, "utf8Write", Utf8Write);