[Pkg-javascript-commits] [node-iconv-lite] 34/83: Minor cleanup.
matthew pideil
mpideil-guest at moszumanska.debian.org
Tue Apr 1 19:56:48 UTC 2014
This is an automated email from the git hooks/post-receive script.
mpideil-guest pushed a commit to branch master
in repository node-iconv-lite.
commit 233e67e2f5ec2274aba8044206ed0befdbf2ca4d
Author: Alexander Shtuchkin <ashtuchkin at gmail.com>
Date: Mon May 7 23:04:15 2012 +0400
Minor cleanup.
---
index.js | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/index.js b/index.js
index 99e8c0a..a235be1 100644
--- a/index.js
+++ b/index.js
@@ -65,12 +65,7 @@ var iconv = module.exports = {
options.chars = asciiString + options.chars;
if (!options.charsBuf) {
- options.charsBuf = new Buffer(256*2);
- for (var i = 0; i < options.chars.length; i++) {
- var code = options.chars.charCodeAt(i);
- options.charsBuf[i*2+0] = code & 0xFF;
- options.charsBuf[i*2+1] = code >>> 8;
- }
+ options.charsBuf = new Buffer(options.chars, 'ucs2');
}
if (!options.revCharsBuf) {
@@ -96,7 +91,7 @@ var iconv = module.exports = {
fromEncoding: function(buf) {
buf = ensureBuffer(buf);
- // As string are immutable in JS, we use ucs2 buffer to speed up computations.
+ // Strings are immutable in JS -> we use ucs2 buffer to speed up computations.
var charsBuf = options.charsBuf;
var newBuf = new Buffer(buf.length*2);
var idx1 = 0, idx2 = 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-iconv-lite.git
More information about the Pkg-javascript-commits
mailing list