summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAric Stewart <aric@codeweavers.com>2013-09-16 11:11:44 -0500
committerJeremy White <jwhite@codeweavers.com>2013-09-18 09:06:03 -0500
commit295073a95469e1f8633d5f70e6bad8be367b4635 (patch)
tree158f42c06191e8e8733a02da8db953dd9315157d
parent3056d62ae2c305362f1437744d14ab18900efc26 (diff)
implement and use a new dataview getUint64
-rw-r--r--spicedataview.js12
-rw-r--r--spicemsg.js6
-rw-r--r--spicetype.js15
3 files changed, 18 insertions, 15 deletions
diff --git a/spicedataview.js b/spicedataview.js
index 43f0170..800df03 100644
--- a/spicedataview.js
+++ b/spicedataview.js
@@ -66,6 +66,18 @@ SpiceDataView.prototype = {
return (this.getUint16(byteOffset + high, littleEndian) << 16) |
this.getUint16(byteOffset + low, littleEndian);
},
+ getUint64: function (byteOffset, littleEndian)
+ {
+ var low = 4, high = 0;
+ if (littleEndian)
+ {
+ low = 0;
+ high = 4;
+ }
+
+ return (this.getUint32(byteOffset + high, littleEndian) << 32) |
+ this.getUint32(byteOffset + low, littleEndian);
+ },
setUint8: function(byteOffset, b)
{
this.u8[byteOffset] = (b & 0xff);
diff --git a/spicemsg.js b/spicemsg.js
index e342d6a..ca69d42 100644
--- a/spicemsg.js
+++ b/spicemsg.js
@@ -414,9 +414,7 @@ SpiceMsgNotify.prototype =
at = at || 0;
var i;
var dv = new SpiceDataView(a);
- this.time_stamp = [];
- this.time_stamp[0] = dv.getUint32(at, true); at += 4;
- this.time_stamp[1] = dv.getUint32(at, true); at += 4;
+ this.time_stamp = dv.getUint64(at, true); at += 8;
this.severity = dv.getUint32(at, true); at += 4;
this.visibility = dv.getUint32(at, true); at += 4;
this.what = dv.getUint32(at, true); at += 4;
@@ -807,7 +805,7 @@ SpiceMsgDisplayStreamCreate.prototype =
this.id = dv.getUint32(at, true); at += 4;
this.flags = dv.getUint8(at, true); at += 1;
this.codec_type = dv.getUint8(at, true); at += 1;
- /*stamp */ at += 8;
+ this.stamp = dv.getUint64(at, true); at += 8;
this.stream_width = dv.getUint32(at, true); at += 4;
this.stream_height = dv.getUint32(at, true); at += 4;
this.src_width = dv.getUint32(at, true); at += 4;
diff --git a/spicetype.js b/spicetype.js
index 758f37a..951b277 100644
--- a/spicetype.js
+++ b/spicetype.js
@@ -109,8 +109,7 @@ SpiceImageDescriptor.prototype =
{
from_dv: function(dv, at, mb)
{
- this.id = dv.getUint32(at, true); at += 4;
- this.id += (dv.getUint32(at, true) << 32); at += 4;
+ this.id = dv.getUint64(at, true); at += 8;
this.type = dv.getUint8(at, true); at ++;
this.flags = dv.getUint8(at, true); at ++;
this.width = dv.getUint32(at, true); at += 4;
@@ -128,9 +127,7 @@ SpicePalette.prototype =
from_dv: function(dv, at, mb)
{
var i;
- this.unique = [];
- this.unique[0] = dv.getUint32(at, true); at += 4;
- this.unique[1] = dv.getUint32(at, true); at += 4;
+ this.unique = dv.getUint64(at, true); at += 8;
this.num_ents = dv.getUint16(at, true); at += 2;
this.ents = [];
for (i = 0; i < this.num_ents; i++)
@@ -156,9 +153,7 @@ SpiceBitmap.prototype =
this.stride = dv.getUint32(at, true); at += 4;
if (this.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)
{
- this.palette_id = [];
- this.palette_id[0] = dv.getUint32(at, true); at += 4;
- this.palette_id[1] = dv.getUint32(at, true); at += 4;
+ this.palette_id = dv.getUint64(at, true); at += 8;
}
else
{
@@ -425,9 +420,7 @@ SpiceCursorHeader.prototype =
{
from_dv: function(dv, at, mb)
{
- this.unique = [];
- this.unique[0] = dv.getUint32(at, true); at += 4;
- this.unique[1] = dv.getUint32(at, true); at += 4;
+ this.unique = dv.getUint64(at, true); at += 8;
this.type = dv.getUint8(at, true); at ++;
this.width = dv.getUint16(at, true); at += 2;
this.height = dv.getUint16(at, true); at += 2;