XQuartz: pbproxy: 64bit fixes: Properly process an array of Atoms
(cherry picked from commit 1b659cda1a
)
This commit is contained in:
parent
1747120043
commit
7ece2cb220
|
@ -41,6 +41,7 @@
|
||||||
struct propdata {
|
struct propdata {
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
size_t length;
|
size_t length;
|
||||||
|
int format;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct atom_list {
|
struct atom_list {
|
||||||
|
|
|
@ -77,7 +77,7 @@ static struct {
|
||||||
|
|
||||||
@implementation x_selection
|
@implementation x_selection
|
||||||
|
|
||||||
static struct propdata null_propdata = {NULL, 0};
|
static struct propdata null_propdata = {NULL, 0, 0};
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static void
|
static void
|
||||||
|
@ -212,6 +212,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
|
|
||||||
pdata->data = buf;
|
pdata->data = buf;
|
||||||
pdata->length = buflen;
|
pdata->length = buflen;
|
||||||
|
pdata->format = format;
|
||||||
|
|
||||||
return /*success*/ False;
|
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) find_preferred:(struct propdata *)pdata
|
||||||
{
|
{
|
||||||
Atom a = None;
|
Atom a = None;
|
||||||
size_t i;
|
size_t i, step;
|
||||||
Bool png = False, jpeg = False, utf8 = False, string = False;
|
Bool png = False, jpeg = False, utf8 = False, string = False;
|
||||||
|
|
||||||
TRACE ();
|
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;
|
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;
|
a = (Atom)*(uint32_t *)(pdata->data + i);
|
||||||
memcpy (&a, pdata->data + i, sizeof (a));
|
|
||||||
|
|
||||||
if (a == atoms->image_png)
|
if (a == atoms->image_png)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user