Browse Source

Remove process._byteLength

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
776754c33f
  1. 12
      src/node.cc
  2. 1
      src/node.js
  3. 5
      test/simple/test-buffer.js
  4. 16
      test/simple/test-byte-length.js

12
src/node.cc

@ -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;
@ -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);

1
src/node.js

@ -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");

5
test/simple/test-buffer.js

@ -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
test/simple/test-byte-length.js

@ -1,16 +0,0 @@
common = require("../common");
assert = common.assert
assert.equal(14, process._byteLength("Il était tué"));
assert.equal(14, process._byteLength("Il était tué", "utf8"));
assert.equal(12, process._byteLength("Il était tué", "ascii"));
assert.equal(12, process._byteLength("Il était tué", "binary"));
assert.throws(function() {
process._byteLength();
});
assert.throws(function() {
process._byteLength(5);
});
Loading…
Cancel
Save