Permalink
Browse files

also use ByteBuffer.readUTF8StringBytes for Node.js,

  • Loading branch information...
1 parent f6976a2 commit 7657428bb6825b44afd1252c05907ebc6e2e87de @nrenner nrenner committed Mar 5, 2014
Showing with 2 additions and 9 deletions.
  1. +0 −5 lib/browser/buffer.js
  2. +0 −1 lib/nodejs/buffer.js
  3. +2 −3 lib/pbfParser.js
View
@@ -2,16 +2,11 @@ function readPBFElementFromBuffer(buffer, pbfDecode, callback){
return callback(null, pbfDecode(buffer));
}
-function pbfBufferToBuffer(src, srcOffset, len){
- return src.readUTF8StringBytes(len, srcOffset).string;
-}
-
function blobDataToBuffer(blob){
return new Uint8Array(blob.toArrayBuffer());
}
module.exports = {
readPBFElementFromBuffer: readPBFElementFromBuffer,
- pbfBufferToBuffer: pbfBufferToBuffer,
blobDataToBuffer: blobDataToBuffer
};
View
@@ -48,6 +48,5 @@ function blobDataToBuffer(blob){
module.exports = {
readPBFElementFromBuffer: readPBFElementFromBuffer,
- pbfBufferToBuffer: pbfBufferToBuffer,
blobDataToBuffer: blobDataToBuffer
};
View
@@ -88,11 +88,10 @@ function getStringTableEntry(i){
s = this.s[i];
- // TODO specify toString encoding
-
// obviously someone is missinterpreting the meanding of 'offset'
// and 'length'. they should be named 'start' and 'end' instead.
- return buf.pbfBufferToBuffer(s, s.offset, s.length - s.offset).toString();
+ return s.readUTF8StringBytes(s.length - s.offset, s.offset).string;
+
}
function extendStringTable(st){

0 comments on commit 7657428

Please sign in to comment.