mirror of https://github.com/nodejs/node.git
Rename Buffer.utf8Length to Buffer.utf8ByteLength
parent
785531691b
commit
4f56d8ae24
|
@ -215,7 +215,7 @@ Socket.prototype._sendString = function (data, encoding) {
|
|||
charsWritten = buffer.utf8Write(data,
|
||||
buffer.used,
|
||||
buffer.length - buffer.used);
|
||||
bytesWritten = process.Buffer.utf8Length(data.slice(0, charsWritten));
|
||||
bytesWritten = process.Buffer.utf8ByteLength(data.slice(0, charsWritten));
|
||||
} else {
|
||||
// ascii
|
||||
buffer.isFd = false;
|
||||
|
|
|
@ -327,8 +327,8 @@ Handle<Value> Buffer::Unpack(const Arguments &args) {
|
|||
}
|
||||
|
||||
|
||||
// var nbytes = Buffer.utf8Length("string")
|
||||
Handle<Value> Buffer::Utf8Length(const Arguments &args) {
|
||||
// var nbytes = Buffer.utf8ByteLength("string")
|
||||
Handle<Value> Buffer::Utf8ByteLength(const Arguments &args) {
|
||||
HandleScope scope;
|
||||
if (!args[0]->IsString()) {
|
||||
return ThrowException(Exception::TypeError(String::New(
|
||||
|
@ -368,7 +368,9 @@ void Buffer::Initialize(Handle<Object> target) {
|
|||
NODE_SET_PROTOTYPE_METHOD(constructor_template, "asciiWrite", Buffer::AsciiWrite);
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor_template, "unpack", Buffer::Unpack);
|
||||
|
||||
NODE_SET_METHOD(constructor_template->GetFunction(), "utf8Length", Buffer::Utf8Length);
|
||||
NODE_SET_METHOD(constructor_template->GetFunction(),
|
||||
"utf8ByteLength",
|
||||
Buffer::Utf8ByteLength);
|
||||
|
||||
target->Set(String::NewSymbol("Buffer"), constructor_template->GetFunction());
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class Buffer : public ObjectWrap {
|
|||
static v8::Handle<v8::Value> Utf8Slice(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> AsciiWrite(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Utf8Write(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Utf8Length(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Utf8ByteLength(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Unpack(const v8::Arguments &args);
|
||||
|
||||
int AsciiWrite(char *string, int offset, int length);
|
||||
|
|
Loading…
Reference in New Issue