int num;
prop_ret = NULL;
- XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
- XA_CARDINAL, &type_ret, &format_ret, &num_ret,
- &bytes_after, &prop_ret);
- if (prop_ret && type_ret == XA_CARDINAL && format_ret == 32)
+ if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
+ XA_CARDINAL, &type_ret, &format_ret, &num_ret,
+ &bytes_after, &prop_ret) != Success)
+ return -1;
+
+ if (type_ret != XA_CARDINAL || format_ret != 32)
+ {
+ num = -1;
+ }
+ else if (num_ret == 0 || !prop_ret)
+ {
+ num = 0;
+ }
+ else
{
if (num_ret < len)
len = num_ret;
-
for (i = 0; i < len; i++)
- val[i] = ((unsigned long*)prop_ret)[i];
-
+ val[i] = ((unsigned long *)prop_ret)[i];
num = len;
}
- else
- {
- num = -1;
- }
if (prop_ret)
XFree(prop_ret);
unsigned int i, *val;
int num;
+ *plst = NULL;
prop_ret = NULL;
if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
XA_CARDINAL, &type_ret, &format_ret, &num_ret,
&bytes_after, &prop_ret) != Success)
return -1;
- if (type_ret == None || num_ret == 0)
+ if (type_ret != XA_CARDINAL || format_ret != 32)
+ {
+ num = -1;
+ }
+ else if (num_ret == 0 || !prop_ret)
{
num = 0;
- *plst = NULL;
}
- else if (prop_ret && type_ret == XA_CARDINAL && format_ret == 32)
+ else
{
val = malloc(num_ret * sizeof(unsigned int));
for (i = 0; i < num_ret; i++)
num = num_ret;
*plst = val;
}
- else
- {
- num = -1;
- *plst = NULL;
- }
if (prop_ret)
XFree(prop_ret);
&bytes_after, &prop_ret) != Success)
return -1;
- if (type_ret == None)
+ if (type_ret != type || format_ret != 32)
+ {
+ num = -1;
+ }
+ else if (num_ret == 0 || !prop_ret)
{
num = 0;
}
- else if (prop_ret && type_ret == type && format_ret == 32)
+ else
{
if (num_ret < len)
len = num_ret;
lst[i] = ((unsigned long *)prop_ret)[i];
num = len;
}
- else
- {
- num = -1;
- }
if (prop_ret)
XFree(prop_ret);
&bytes_after, &prop_ret) != Success)
return -1;
- if (type_ret == None || num_ret == 0)
+ if (type_ret != type || format_ret != 32)
+ {
+ num = -1;
+ }
+ else if (num_ret == 0 || !prop_ret)
{
num = 0;
}
- else if (prop_ret && type_ret == type && format_ret == 32)
+ else
{
alst = malloc(num_ret * sizeof(Ecore_X_ID));
for (i = 0; i < num_ret; i++)
alst[i] = ((unsigned long *)prop_ret)[i];
- *val = alst;
num = num_ret;
- }
- else
- {
- num = -1;
+ *val = alst;
}
if (prop_ret)
XFree(prop_ret);