Skip to content

Commit

Permalink
Remove process._byteLength
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Sep 17, 2010
1 parent 9628e28 commit 776754c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 28 deletions.
12 changes: 0 additions & 12 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -994,17 +994,6 @@ Local<Value> ExecuteString(Local<String> source, Local<Value> filename) {
return scope.Close(result);
}

static Handle<Value> ByteLength(const Arguments& args) {
HandleScope scope;

if (args.Length() < 1 || !args[0]->IsString()) {
return ThrowException(Exception::Error(String::New("Bad argument.")));
}

Local<Integer> length = Integer::New(DecodeBytes(args[0], ParseEncoding(args[1], UTF8)));

return scope.Close(length);
}

static Handle<Value> Loop(const Arguments& args) {
HandleScope scope;
Expand Down Expand Up @@ -1608,7 +1597,6 @@ static void Load(int argc, char *argv[]) {
// define various internal methods
NODE_SET_METHOD(process, "loop", Loop);
NODE_SET_METHOD(process, "compile", Compile);
NODE_SET_METHOD(process, "_byteLength", ByteLength);
NODE_SET_METHOD(process, "_needTickCallback", NeedTickCallback);
NODE_SET_METHOD(process, "reallyExit", Exit);
NODE_SET_METHOD(process, "chdir", Chdir);
Expand Down
1 change: 1 addition & 0 deletions src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ process.unwatchFile = removed("process.unwatchFile() has moved to fs.unwatchFile
process.mixin = removed('process.mixin() has been removed.');
process.createChildProcess = removed("childProcess API has changed. See doc/api.txt.");
process.inherits = removed("process.inherits() has moved to sys.inherits.");
process._byteLength = removed("process._byteLength() has moved to Buffer.byteLength");

process.assert = function (x, msg) {
if (!x) throw new Error(msg || "assertion error");
Expand Down
5 changes: 5 additions & 0 deletions test/simple/test-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,8 @@ assert.equal(sb, s);
b = new Buffer("abcde");
assert.equal("bcde", b.slice(1).toString());

// byte length
assert.equal(14, Buffer.byteLength("Il était tué"));
assert.equal(14, Buffer.byteLength("Il était tué", "utf8"));
assert.equal(12, Buffer.byteLength("Il était tué", "ascii"));
assert.equal(12, Buffer.byteLength("Il était tué", "binary"));
16 changes: 0 additions & 16 deletions test/simple/test-byte-length.js

This file was deleted.

0 comments on commit 776754c

Please sign in to comment.