summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2009-09-05 14:03:19 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2009-09-06 14:06:01 -0700
commit9c7869265fd5387a4d8ab7b4e8227982c4dc61d7 (patch)
tree7d3823bb2d4152ad72e6b93afa1dabe731bc518a
parentfb55aa6bab036cc4bf84d9b29a8df99940dd8a3f (diff)
XQuartz: pbproxy: 64bit fixes: Properly process an array of Atoms
(cherry picked from commit 1b659cda1af02762a31cc7875e457b08c8dc68b5)
-rw-r--r--hw/xquartz/pbproxy/x-selection.h1
-rw-r--r--hw/xquartz/pbproxy/x-selection.m14
2 files changed, 8 insertions, 7 deletions
diff --git a/hw/xquartz/pbproxy/x-selection.h b/hw/xquartz/pbproxy/x-selection.h
index d5bfcb5e7..fc903d0af 100644
--- a/hw/xquartz/pbproxy/x-selection.h
+++ b/hw/xquartz/pbproxy/x-selection.h
@@ -41,6 +41,7 @@
struct propdata {
unsigned char *data;
size_t length;
+ int format;
};
struct atom_list {
diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index cd540be98..4f2d848fb 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -77,7 +77,7 @@ static struct {
@implementation x_selection
-static struct propdata null_propdata = {NULL, 0};
+static struct propdata null_propdata = {NULL, 0, 0};
#ifdef DEBUG
static void
@@ -212,6 +212,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
pdata->data = buf;
pdata->length = buflen;
+ pdata->format = format;
return /*success*/ False;
}
@@ -223,21 +224,20 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
- (Atom) find_preferred:(struct propdata *)pdata
{
Atom a = None;
- size_t i;
+ size_t i, step;
Bool png = False, jpeg = False, utf8 = False, string = False;
TRACE ();
- if (pdata->length % sizeof (a))
+ if (pdata->format != 32)
{
- fprintf(stderr, "Atom list is not a multiple of the size of an atom!\n");
+ fprintf(stderr, "Atom list is expected to be formatted as an array of 32bit values.\n");
return None;
}
- for (i = 0; i < pdata->length; i += sizeof (a))
+ for (i = 0, step = pdata->format >> 3; i < pdata->length; i += step)
{
- a = None;
- memcpy (&a, pdata->data + i, sizeof (a));
+ a = (Atom)*(uint32_t *)(pdata->data + i);
if (a == atoms->image_png)
{