Skip to content

Commit 4f56d8a

Browse files
committed
Rename Buffer.utf8Length to Buffer.utf8ByteLength
1 parent 7855316 commit 4f56d8a

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

lib/net.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Socket.prototype._sendString = function (data, encoding) {
215215
charsWritten = buffer.utf8Write(data,
216216
buffer.used,
217217
buffer.length - buffer.used);
218-
bytesWritten = process.Buffer.utf8Length(data.slice(0, charsWritten));
218+
bytesWritten = process.Buffer.utf8ByteLength(data.slice(0, charsWritten));
219219
} else {
220220
// ascii
221221
buffer.isFd = false;

src/node_buffer.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ Handle<Value> Buffer::Unpack(const Arguments &args) {
327327
}
328328

329329

330-
// var nbytes = Buffer.utf8Length("string")
331-
Handle<Value> Buffer::Utf8Length(const Arguments &args) {
330+
// var nbytes = Buffer.utf8ByteLength("string")
331+
Handle<Value> Buffer::Utf8ByteLength(const Arguments &args) {
332332
HandleScope scope;
333333
if (!args[0]->IsString()) {
334334
return ThrowException(Exception::TypeError(String::New(
@@ -368,7 +368,9 @@ void Buffer::Initialize(Handle<Object> target) {
368368
NODE_SET_PROTOTYPE_METHOD(constructor_template, "asciiWrite", Buffer::AsciiWrite);
369369
NODE_SET_PROTOTYPE_METHOD(constructor_template, "unpack", Buffer::Unpack);
370370

371-
NODE_SET_METHOD(constructor_template->GetFunction(), "utf8Length", Buffer::Utf8Length);
371+
NODE_SET_METHOD(constructor_template->GetFunction(),
372+
"utf8ByteLength",
373+
Buffer::Utf8ByteLength);
372374

373375
target->Set(String::NewSymbol("Buffer"), constructor_template->GetFunction());
374376
}

src/node_buffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Buffer : public ObjectWrap {
4545
static v8::Handle<v8::Value> Utf8Slice(const v8::Arguments &args);
4646
static v8::Handle<v8::Value> AsciiWrite(const v8::Arguments &args);
4747
static v8::Handle<v8::Value> Utf8Write(const v8::Arguments &args);
48-
static v8::Handle<v8::Value> Utf8Length(const v8::Arguments &args);
48+
static v8::Handle<v8::Value> Utf8ByteLength(const v8::Arguments &args);
4949
static v8::Handle<v8::Value> Unpack(const v8::Arguments &args);
5050

5151
int AsciiWrite(char *string, int offset, int length);

0 commit comments

Comments
 (0)