[Spice-devel] [patch spice-html5 1/2] implement and use a new dataview getUint64
Aric Stewart
aric at codeweavers.com
Mon Sep 16 09:13:25 PDT 2013
Apologies I did not head these patches correctly.
---
spicedataview.js | 12 ++++++++++++
spicemsg.js | 6 ++----
spicetype.js | 15 ++++-----------
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-implement-and-use-a-new-dataview-getUint64.txt
Type: text/x-patch
Size: 3720 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130916/5a2fcacc/attachment-0001.bin>
More information about the Spice-devel
mailing list