diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2021-01-30 16:10:19 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2021-01-30 16:10:19 +0100 |
commit | 8b2b4111384133491a11bb67a7272532b582a814 (patch) | |
tree | 9c727a9f4a31da58d6af28b6565b17db04051c7e /nx-X11/programs | |
parent | 5a00da5eca15ce16401dbdfc6595949beb8a3e76 (diff) | |
download | nx-libs-8b2b4111384133491a11bb67a7272532b582a814.tar.gz nx-libs-8b2b4111384133491a11bb67a7272532b582a814.tar.bz2 nx-libs-8b2b4111384133491a11bb67a7272532b582a814.zip |
NXproperty.c: simplify and reformat GetWindowProperty()
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 3ca79cea7..9e14a3cca 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -466,9 +466,6 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, unsigned long *bytesAfter; unsigned char **propData; { - PropertyPtr pProp, prevProp; - unsigned long n, len, ind; - if (!pWin) { #ifdef DEBUG @@ -484,6 +481,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, #endif return BadAtom; } + if ((type != AnyPropertyType) && !ValidAtom(type)) { #ifdef DEBUG @@ -492,8 +490,8 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, return BadAtom; } - pProp = wUserProps (pWin); - prevProp = (PropertyPtr)NULL; + PropertyPtr pProp = wUserProps (pWin); + PropertyPtr prevProp = (PropertyPtr)NULL; while (pProp) { @@ -522,14 +520,14 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, *format = pProp->format; *nItems = 0; *actualType = pProp->type; - return(Success); + return Success; } /* * Return type, format, value to client */ - n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ - ind = longOffset << 2; + unsigned long n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ + unsigned long ind = longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ @@ -542,7 +540,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, return BadValue; } - len = min(n - ind, 4 * longLength); + unsigned long len = min(n - ind, 4 * longLength); *bytesAfter = n - (ind + len); *format = pProp->format; @@ -566,7 +564,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, } if (delete && (*bytesAfter == 0)) - { /* delete the Property */ + { /* delete the property */ if (prevProp == (PropertyPtr)NULL) /* takes care of head */ { if (!(pWin->optional->userProps = pProp->next)) |