[Pkg-javascript-commits] [node-browserify-aes] 04/43: Cleanup bufferToArray()

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 14:41:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-browserify-aes.

commit 2ad27678293398fe23262afdbfdd43cae895c9dd
Author: Dung Tran <tad88.dev at gmail.com>
Date:   Sat Jan 7 14:01:38 2017 +0700

    Cleanup bufferToArray()
---
 aes.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/aes.js b/aes.js
index 4829057..5ce97eb 100644
--- a/aes.js
+++ b/aes.js
@@ -81,10 +81,10 @@ AES.keySize = 256 / 8
 AES.prototype.keySize = AES.keySize
 
 function bufferToArray (buf) {
-  var len = buf.length / 4
+  // Convert unexpected float to int
+  var len = (buf.length / 4) | 0
   var out = new Array(len)
-  var i = -1
-  while (++i < len) {
+  for (var i = 0; i < len; i++) {
     out[i] = buf.readUInt32BE(i * 4)
   }
   return out

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browserify-aes.git



More information about the Pkg-javascript-commits mailing list