summaryrefslogtreecommitdiff
path: root/dix/property.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-21 12:55:09 -0700
committerKeith Packard <keithp@keithp.com>2012-03-21 13:54:42 -0700
commit9838b7032ea9792bec21af424c53c07078636d21 (patch)
treeb72d0827dac50f0f3b8eab29b3b7639546d735d7 /dix/property.c
parent75199129c603fc8567185ac31866c9518193cb78 (diff)
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'dix/property.c')
-rw-r--r--dix/property.c506
1 files changed, 243 insertions, 263 deletions
diff --git a/dix/property.c b/dix/property.c
index d933d5cec..b1b83124f 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -76,13 +75,12 @@ PrintPropertys(WindowPtr pWin)
int j;
pProp = pWin->userProps;
- while (pProp)
- {
+ while (pProp) {
ErrorF("[dix] %x %x\n", pProp->propertyName, pProp->type);
ErrorF("[dix] property format: %d\n", pProp->format);
ErrorF("[dix] property data: \n");
- for (j=0; j<(pProp->format/8)*pProp->size; j++)
- ErrorF("[dix] %c\n", pProp->data[j]);
+ for (j = 0; j < (pProp->format / 8) * pProp->size; j++)
+ ErrorF("[dix] %c\n", pProp->data[j]);
pProp = pProp->next;
}
}
@@ -90,18 +88,19 @@ PrintPropertys(WindowPtr pWin)
int
dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
- ClientPtr client, Mask access_mode)
+ ClientPtr client, Mask access_mode)
{
PropertyPtr pProp;
int rc = BadMatch;
+
client->errorValue = propertyName;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
- if (pProp->propertyName == propertyName)
- break;
+ if (pProp->propertyName == propertyName)
+ break;
if (pProp)
- rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode);
+ rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode);
*result = pProp;
return rc;
}
@@ -117,17 +116,18 @@ deliverPropertyNotifyEvent(WindowPtr pWin, int state, Atom atom)
event.u.property.state = state;
event.u.property.atom = atom;
event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
}
int
ProcRotateProperties(ClientPtr client)
{
- int i, j, delta, rc;
+ int i, j, delta, rc;
+
REQUEST(xRotatePropertiesReq);
WindowPtr pWin;
- Atom * atoms;
- PropertyPtr * props; /* array of pointer */
+ Atom *atoms;
+ PropertyPtr *props; /* array of pointer */
PropertyPtr pProp, saved;
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
@@ -136,70 +136,67 @@ ProcRotateProperties(ClientPtr client)
if (rc != Success || stuff->nAtoms <= 0)
return rc;
- atoms = (Atom *) & stuff[1];
+ atoms = (Atom *) &stuff[1];
props = malloc(stuff->nAtoms * sizeof(PropertyPtr));
saved = malloc(stuff->nAtoms * sizeof(PropertyRec));
if (!props || !saved) {
- rc = BadAlloc;
- goto out;
+ rc = BadAlloc;
+ goto out;
}
- for (i = 0; i < stuff->nAtoms; i++)
- {
+ for (i = 0; i < stuff->nAtoms; i++) {
if (!ValidAtom(atoms[i])) {
- rc = BadAtom;
- client->errorValue = atoms[i];
- goto out;
+ rc = BadAtom;
+ client->errorValue = atoms[i];
+ goto out;
}
for (j = i + 1; j < stuff->nAtoms; j++)
- if (atoms[j] == atoms[i])
- {
- rc = BadMatch;
- goto out;
+ if (atoms[j] == atoms[i]) {
+ rc = BadMatch;
+ goto out;
}
- rc = dixLookupProperty(&pProp, pWin, atoms[i], client,
- DixReadAccess|DixWriteAccess);
- if (rc != Success)
- goto out;
+ rc = dixLookupProperty(&pProp, pWin, atoms[i], client,
+ DixReadAccess | DixWriteAccess);
+ if (rc != Success)
+ goto out;
props[i] = pProp;
- saved[i] = *pProp;
+ saved[i] = *pProp;
}
delta = stuff->nPositions;
/* If the rotation is a complete 360 degrees, then moving the properties
- around and generating PropertyNotify events should be skipped. */
+ around and generating PropertyNotify events should be skipped. */
- if (abs(delta) % stuff->nAtoms)
- {
- while (delta < 0) /* faster if abs value is small */
+ if (abs(delta) % stuff->nAtoms) {
+ while (delta < 0) /* faster if abs value is small */
delta += stuff->nAtoms;
- for (i = 0; i < stuff->nAtoms; i++)
- {
- j = (i + delta) % stuff->nAtoms;
- deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]);
-
- /* Preserve name and devPrivates */
- props[j]->type = saved[i].type;
- props[j]->format = saved[i].format;
- props[j]->size = saved[i].size;
- props[j]->data = saved[i].data;
- }
+ for (i = 0; i < stuff->nAtoms; i++) {
+ j = (i + delta) % stuff->nAtoms;
+ deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]);
+
+ /* Preserve name and devPrivates */
+ props[j]->type = saved[i].type;
+ props[j]->format = saved[i].format;
+ props[j]->size = saved[i].size;
+ props[j]->data = saved[i].data;
+ }
}
-out:
+ out:
free(saved);
free(props);
return rc;
}
-int
+int
ProcChangeProperty(ClientPtr client)
-{
+{
WindowPtr pWin;
char format, mode;
unsigned long len;
int sizeInBytes, totalSize, err;
+
REQUEST(xChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
@@ -207,50 +204,46 @@ ProcChangeProperty(ClientPtr client)
format = stuff->format;
mode = stuff->mode;
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
- (mode != PropModePrepend))
- {
- client->errorValue = mode;
- return BadValue;
+ (mode != PropModePrepend)) {
+ client->errorValue = mode;
+ return BadValue;
}
- if ((format != 8) && (format != 16) && (format != 32))
- {
- client->errorValue = format;
+ if ((format != 8) && (format != 16) && (format != 32)) {
+ client->errorValue = format;
return BadValue;
}
len = stuff->nUnits;
if (len > bytes_to_int32(0xffffffff - sizeof(xChangePropertyReq)))
- return BadLength;
- sizeInBytes = format>>3;
+ return BadLength;
+ sizeInBytes = format >> 3;
totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
err = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess);
if (err != Success)
- return err;
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+ return err;
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
- if (!ValidAtom(stuff->type))
- {
- client->errorValue = stuff->type;
- return BadAtom;
+ if (!ValidAtom(stuff->type)) {
+ client->errorValue = stuff->type;
+ return BadAtom;
}
err = dixChangeWindowProperty(client, pWin, stuff->property, stuff->type,
- (int)format, (int)mode, len, &stuff[1],
- TRUE);
+ (int) format, (int) mode, len, &stuff[1],
+ TRUE);
if (err != Success)
- return err;
+ return err;
else
- return Success;
+ return Success;
}
int
dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
- Atom type, int format, int mode, unsigned long len,
- pointer value, Bool sendevent)
+ Atom type, int format, int mode, unsigned long len,
+ pointer value, Bool sendevent)
{
PropertyPtr pProp;
PropertyRec savedProp;
@@ -258,126 +251,116 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
unsigned char *data;
Mask access_mode;
- sizeInBytes = format>>3;
+ sizeInBytes = format >> 3;
totalSize = len * sizeInBytes;
access_mode = (mode == PropModeReplace) ? DixWriteAccess : DixBlendAccess;
/* first see if property already exists */
rc = dixLookupProperty(&pProp, pWin, property, pClient, access_mode);
- if (rc == BadMatch) /* just add to list */
- {
- if (!pWin->optional && !MakeWindowOptional (pWin))
- return BadAlloc;
- pProp = dixAllocateObjectWithPrivates(PropertyRec, PRIVATE_PROPERTY);
- if (!pProp)
- return BadAlloc;
+ if (rc == BadMatch) { /* just add to list */
+ if (!pWin->optional && !MakeWindowOptional(pWin))
+ return BadAlloc;
+ pProp = dixAllocateObjectWithPrivates(PropertyRec, PRIVATE_PROPERTY);
+ if (!pProp)
+ return BadAlloc;
data = malloc(totalSize);
- if (!data && len)
- {
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
- return BadAlloc;
- }
+ if (!data && len) {
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ return BadAlloc;
+ }
memcpy(data, value, totalSize);
pProp->propertyName = property;
pProp->type = type;
pProp->format = format;
pProp->data = data;
- pProp->size = len;
- rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
- DixCreateAccess|DixWriteAccess);
- if (rc != Success) {
- free(data);
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
- pClient->errorValue = property;
- return rc;
- }
+ pProp->size = len;
+ rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
+ DixCreateAccess | DixWriteAccess);
+ if (rc != Success) {
+ free(data);
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ pClient->errorValue = property;
+ return rc;
+ }
pProp->next = pWin->optional->userProps;
pWin->optional->userProps = pProp;
}
- else if (rc == Success)
- {
- /* To append or prepend to a property the request format and type
- must match those of the already defined property. The
- existing format and type are irrelevant when using the mode
- "PropModeReplace" since they will be written over. */
+ else if (rc == Success) {
+ /* To append or prepend to a property the request format and type
+ must match those of the already defined property. The
+ existing format and type are irrelevant when using the mode
+ "PropModeReplace" since they will be written over. */
if ((format != pProp->format) && (mode != PropModeReplace))
- return BadMatch;
+ return BadMatch;
if ((pProp->type != type) && (mode != PropModeReplace))
return BadMatch;
- /* save the old values for later */
- savedProp = *pProp;
-
- if (mode == PropModeReplace)
- {
- data = malloc(totalSize);
- if (!data && len)
- return BadAlloc;
- memcpy(data, value, totalSize);
- pProp->data = data;
- pProp->size = len;
- pProp->type = type;
- pProp->format = format;
- }
- else if (len == 0)
- {
- /* do nothing */
- }
- else if (mode == PropModeAppend)
- {
- data = malloc((pProp->size + len) * sizeInBytes);
- if (!data)
- return BadAlloc;
- memcpy(data, pProp->data, pProp->size * sizeInBytes);
- memcpy(data + pProp->size * sizeInBytes, value, totalSize);
+ /* save the old values for later */
+ savedProp = *pProp;
+
+ if (mode == PropModeReplace) {
+ data = malloc(totalSize);
+ if (!data && len)
+ return BadAlloc;
+ memcpy(data, value, totalSize);
+ pProp->data = data;
+ pProp->size = len;
+ pProp->type = type;
+ pProp->format = format;
+ }
+ else if (len == 0) {
+ /* do nothing */
+ }
+ else if (mode == PropModeAppend) {
+ data = malloc((pProp->size + len) * sizeInBytes);
+ if (!data)
+ return BadAlloc;
+ memcpy(data, pProp->data, pProp->size * sizeInBytes);
+ memcpy(data + pProp->size * sizeInBytes, value, totalSize);
pProp->data = data;
pProp->size += len;
- }
- else if (mode == PropModePrepend)
- {
+ }
+ else if (mode == PropModePrepend) {
data = malloc(sizeInBytes * (len + pProp->size));
- if (!data)
- return BadAlloc;
+ if (!data)
+ return BadAlloc;
memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes);
memcpy(data, value, totalSize);
pProp->data = data;
pProp->size += len;
- }
-
- /* Allow security modules to check the new content */
- access_mode |= DixPostAccess;
- rc = XaceHookPropertyAccess(pClient, pWin, &pProp, access_mode);
- if (rc == Success)
- {
- if (savedProp.data != pProp->data)
- free(savedProp.data);
- }
- else
- {
- if (savedProp.data != pProp->data)
- free(pProp->data);
- *pProp = savedProp;
- return rc;
- }
+ }
+
+ /* Allow security modules to check the new content */
+ access_mode |= DixPostAccess;
+ rc = XaceHookPropertyAccess(pClient, pWin, &pProp, access_mode);
+ if (rc == Success) {
+ if (savedProp.data != pProp->data)
+ free(savedProp.data);
+ }
+ else {
+ if (savedProp.data != pProp->data)
+ free(pProp->data);
+ *pProp = savedProp;
+ return rc;
+ }
}
else
- return rc;
+ return rc;
if (sendevent)
- deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName);
+ deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName);
return Success;
}
int
-ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
- int mode, unsigned long len, pointer value,
- Bool sendevent)
+ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
+ int mode, unsigned long len, pointer value, Bool sendevent)
{
return dixChangeWindowProperty(serverClient, pWin, property, type, format,
- mode, len, value, sendevent);
+ mode, len, value, sendevent);
}
int
@@ -388,24 +371,25 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
rc = dixLookupProperty(&pProp, pWin, propName, client, DixDestroyAccess);
if (rc == BadMatch)
- return Success; /* Succeed if property does not exist */
+ return Success; /* Succeed if property does not exist */
if (rc == Success) {
- if (pWin->optional->userProps == pProp) {
- /* Takes care of head */
+ if (pWin->optional->userProps == pProp) {
+ /* Takes care of head */
if (!(pWin->optional->userProps = pProp->next))
- CheckWindowOptionalNeed (pWin);
- } else {
- /* Need to traverse to find the previous element */
- prevProp = pWin->optional->userProps;
- while (prevProp->next != pProp)
- prevProp = prevProp->next;
- prevProp->next = pProp->next;
- }
-
- deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
- free(pProp->data);
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ CheckWindowOptionalNeed(pWin);
+ }
+ else {
+ /* Need to traverse to find the previous element */
+ prevProp = pWin->optional->userProps;
+ while (prevProp->next != pProp)
+ prevProp = prevProp->next;
+ prevProp->next = pProp->next;
+ }
+
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
+ free(pProp->data);
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
}
return rc;
}
@@ -415,14 +399,13 @@ DeleteAllWindowProperties(WindowPtr pWin)
{
PropertyPtr pProp, pNextProp;
- pProp = wUserProps (pWin);
- while (pProp)
- {
- deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
- pNextProp = pProp->next;
+ pProp = wUserProps(pWin);
+ while (pProp) {
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
+ pNextProp = pProp->next;
free(pProp->data);
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
- pProp = pNextProp;
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ pProp = pNextProp;
}
if (pWin->optional)
@@ -430,11 +413,8 @@ DeleteAllWindowProperties(WindowPtr pWin)
}
static int
-NullPropertyReply(
- ClientPtr client,
- ATOM propertyType,
- int format,
- xGetPropertyReply *reply)
+NullPropertyReply(ClientPtr client,
+ ATOM propertyType, int format, xGetPropertyReply * reply)
{
reply->nItems = 0;
reply->length = 0;
@@ -464,32 +444,30 @@ ProcGetProperty(ClientPtr client)
WindowPtr pWin;
xGetPropertyReply reply;
Mask win_mode = DixGetPropAccess, prop_mode = DixReadAccess;
+
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
if (stuff->delete) {
- UpdateCurrentTime();
- win_mode |= DixSetPropAccess;
- prop_mode |= DixDestroyAccess;
+ UpdateCurrentTime();
+ win_mode |= DixSetPropAccess;
+ prop_mode |= DixDestroyAccess;
}
rc = dixLookupWindow(&pWin, stuff->window, client, win_mode);
if (rc != Success)
- return rc;
+ return rc;
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
- if ((stuff->delete != xTrue) && (stuff->delete != xFalse))
- {
- client->errorValue = stuff->delete;
- return BadValue;
+ if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) {
+ client->errorValue = stuff->delete;
+ return BadValue;
}
- if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
- {
- client->errorValue = stuff->type;
- return BadAtom;
+ if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) {
+ client->errorValue = stuff->type;
+ return BadAtom;
}
memset(&reply, 0, sizeof(xGetPropertyReply));
@@ -498,39 +476,36 @@ ProcGetProperty(ClientPtr client)
rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode);
if (rc == BadMatch)
- return NullPropertyReply(client, None, 0, &reply);
+ return NullPropertyReply(client, None, 0, &reply);
else if (rc != Success)
- return rc;
+ return rc;
/* If the request type and actual type don't match. Return the
- property information, but not the data. */
-
- if (((stuff->type != pProp->type) &&
- (stuff->type != AnyPropertyType))
- )
- {
- reply.bytesAfter = pProp->size;
- reply.format = pProp->format;
- reply.length = 0;
- reply.nItems = 0;
- reply.propertyType = pProp->type;
- WriteReplyToClient(client, sizeof(xGenericReply), &reply);
- return Success;
+ property information, but not the data. */
+
+ if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType))
+ ) {
+ reply.bytesAfter = pProp->size;
+ reply.format = pProp->format;
+ reply.length = 0;
+ reply.nItems = 0;
+ reply.propertyType = pProp->type;
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
+ return Success;
}
/*
* Return type, format, value to client
*/
- n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
- ind = stuff->longOffset << 2;
+ n = (pProp->format / 8) * pProp->size; /* size (bytes) of prop */
+ ind = stuff->longOffset << 2;
- /* If longOffset is invalid such that it causes "len" to
- be negative, it's a value error. */
+ /* If longOffset is invalid such that it causes "len" to
+ be negative, it's a value error. */
- if (n < ind)
- {
- client->errorValue = stuff->longOffset;
- return BadValue;
+ if (n < ind) {
+ client->errorValue = stuff->longOffset;
+ return BadValue;
}
len = min(n - ind, 4 * stuff->longLength);
@@ -538,40 +513,45 @@ ProcGetProperty(ClientPtr client)
reply.bytesAfter = n - (ind + len);
reply.format = pProp->format;
reply.length = bytes_to_int32(len);
- reply.nItems = len / (pProp->format / 8 );
+ reply.nItems = len / (pProp->format / 8);
reply.propertyType = pProp->type;
if (stuff->delete && (reply.bytesAfter == 0))
- deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
- if (len)
- {
- switch (reply.format) {
- case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
- default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
- }
- WriteSwappedDataToClient(client, len,
- (char *)pProp->data + ind);
+ if (len) {
+ switch (reply.format) {
+ case 32:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
+ break;
+ case 16:
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
+ break;
+ default:
+ client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
+ break;
+ }
+ WriteSwappedDataToClient(client, len, (char *) pProp->data + ind);
}
if (stuff->delete && (reply.bytesAfter == 0)) {
- /* Delete the Property */
- if (pWin->optional->userProps == pProp) {
- /* Takes care of head */
+ /* Delete the Property */
+ if (pWin->optional->userProps == pProp) {
+ /* Takes care of head */
if (!(pWin->optional->userProps = pProp->next))
- CheckWindowOptionalNeed (pWin);
- } else {
- /* Need to traverse to find the previous element */
- prevProp = pWin->optional->userProps;
- while (prevProp->next != pProp)
- prevProp = prevProp->next;
- prevProp->next = pProp->next;
- }
-
- free(pProp->data);
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ CheckWindowOptionalNeed(pWin);
+ }
+ else {
+ /* Need to traverse to find the previous element */
+ prevProp = pWin->optional->userProps;
+ while (prevProp->next != pProp)
+ prevProp = prevProp->next;
+ prevProp->next = pProp->next;
+ }
+
+ free(pProp->data);
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
}
return Success;
}
@@ -581,9 +561,10 @@ ProcListProperties(ClientPtr client)
{
Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
- int rc, numProps = 0;
+ int rc, numProps = 0;
WindowPtr pWin;
PropertyPtr pProp, realProp;
+
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -592,20 +573,20 @@ ProcListProperties(ClientPtr client)
return rc;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
- numProps++;
+ numProps++;
if (numProps && !(pAtoms = malloc(numProps * sizeof(Atom))))
- return BadAlloc;
+ return BadAlloc;
numProps = 0;
temppAtoms = pAtoms;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
- realProp = pProp;
- rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
- if (rc == Success && realProp == pProp) {
- *temppAtoms++ = pProp->propertyName;
- numProps++;
- }
+ realProp = pProp;
+ rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
+ if (rc == Success && realProp == pProp) {
+ *temppAtoms++ = pProp->propertyName;
+ numProps++;
+ }
}
xlpr.type = X_Reply;
@@ -613,31 +594,30 @@ ProcListProperties(ClientPtr client)
xlpr.length = bytes_to_int32(numProps * sizeof(Atom));
xlpr.sequenceNumber = client->sequence;
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
- if (numProps)
- {
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ if (numProps) {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
}
free(pAtoms);
return Success;
}
-int
+int
ProcDeleteProperty(ClientPtr client)
{
WindowPtr pWin;
+
REQUEST(xDeletePropertyReq);
int result;
-
+
REQUEST_SIZE_MATCH(xDeletePropertyReq);
UpdateCurrentTime();
result = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess);
if (result != Success)
return result;
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
+ if (!ValidAtom(stuff->property)) {
+ client->errorValue = stuff->property;
+ return BadAtom;
}
return DeleteProperty(client, pWin, stuff->property);