]> zoso.dev Git - buffer.git/commitdiff
use writeInt8 when reading from an array
authorDaniel Cousens <github@dcousens.com>
Sat, 24 May 2014 09:32:47 +0000 (19:32 +1000)
committerDaniel Cousens <github@dcousens.com>
Sat, 24 May 2014 09:50:54 +0000 (19:50 +1000)
index.js

index b1375ff0dc77237c0abbdc0d2e94d5f1c110371f..92769c99bc085f934f37eaf382d6b1a35416c73f 100644 (file)
--- a/index.js
+++ b/index.js
@@ -94,7 +94,7 @@ function Buffer (subject, encoding, noZero) {
       if (Buffer.isBuffer(subject))
         buf[i] = subject.readUInt8(i)
       else
-        buf[i] = subject[i]
+        buf.writeInt8(subject[i], i)
     }
   } else if (type === 'string') {
     buf.write(subject, 0, encoding)