diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/binaryXHR.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/js/binaryXHR.js b/js/binaryXHR.js index ef8478c..8ce4b0f 100644 --- a/js/binaryXHR.js +++ b/js/binaryXHR.js | |||
@@ -30,11 +30,9 @@ InvalidBinaryFile.prototype.toString = function() { | |||
30 | // ===================================================================== | 30 | // ===================================================================== |
31 | // BinaryFile class | 31 | // BinaryFile class |
32 | // Allows access to element inside a binary stream | 32 | // Allows access to element inside a binary stream |
33 | function BinaryFile(strData, iDataOffset, iDataLength) { | 33 | function BinaryFile(data) { |
34 | "use strict"; | 34 | "use strict"; |
35 | var data = strData; | 35 | var dataLength; |
36 | var dataOffset = iDataOffset || 0; | ||
37 | var dataLength = 0; | ||
38 | // added | 36 | // added |
39 | var doubleMantExpHi=Math.pow(2,-28); | 37 | var doubleMantExpHi=Math.pow(2,-28); |
40 | var doubleMantExpLo=Math.pow(2,-52); | 38 | var doubleMantExpLo=Math.pow(2,-52); |
@@ -46,21 +44,21 @@ function BinaryFile(strData, iDataOffset, iDataLength) { | |||
46 | return data; | 44 | return data; |
47 | }; | 45 | }; |
48 | 46 | ||
49 | if (typeof strData === "string") { | 47 | if (typeof data === "string") { |
50 | dataLength = iDataLength || data.length; | 48 | dataLength = data.length; |
51 | 49 | ||
52 | this.getByteAt = function(iOffset) { | 50 | this.getByteAt = function(iOffset) { |
53 | return data.charCodeAt(iOffset + dataOffset) & 0xFF; | 51 | return data.charCodeAt(iOffset) & 0xFF; |
54 | }; | 52 | }; |
55 | } else if (typeof strData === "unknown") { | 53 | } else if (typeof data === "unknown") { |
56 | // Correct. "unknown" as type. MS JScript 8 added this. | 54 | // Correct. "unknown" as type. MS JScript 8 added this. |
57 | dataLength = iDataLength || IEBinary_getLength(data); | 55 | dataLength = IEBinary_getLength(data); |
58 | 56 | ||
59 | this.getByteAt = function(iOffset) { | 57 | this.getByteAt = function(iOffset) { |
60 | return IEBinary_getByteAt(data, iOffset + dataOffset); | 58 | return IEBinary_getByteAt(data, iOffset); |
61 | }; | 59 | }; |
62 | } else { | 60 | } else { |
63 | throw new InvalidBinaryFile("Unsupported type " + (typeof strData)); | 61 | throw new InvalidBinaryFile("Unsupported type " + (typeof data)); |
64 | } | 62 | } |
65 | 63 | ||
66 | if (switch_endian) { | 64 | if (switch_endian) { |