diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2019-06-30 15:55:26 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2019-09-29 17:10:05 +0200 |
commit | c539e0ca5c9d23567e7cd9a60a375f73ee4166d7 (patch) | |
tree | 86693d5c6c70a39786340845b1f153db0b737134 /nx-X11 | |
parent | 7fa6c88089bb0731ba7e1c3c4e0a25acdff4e521 (diff) | |
download | nx-libs-c539e0ca5c9d23567e7cd9a60a375f73ee4166d7.tar.gz nx-libs-c539e0ca5c9d23567e7cd9a60a375f73ee4166d7.tar.bz2 nx-libs-c539e0ca5c9d23567e7cd9a60a375f73ee4166d7.zip |
NXproperty.c: reformat GetWindowProperty to increase readability
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 9d8a46c4f..a0c355b41 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -549,14 +549,17 @@ ProcGetProperty(ClientPtr client) #ifdef NXAGENT_CLIPBOARD /* GetWindowProperty clipboard use only */ +/* FIXME: that's wrong, it is also called in Window.c and Events. */ +/* FIXME: should be moved to a different file, is not derived from + dix */ int GetWindowProperty(pWin, property, longOffset, longLength, delete, type, actualType, format, nItems, bytesAfter, propData ) WindowPtr pWin; Atom property; - long longOffset; - long longLength; - Bool delete; + long longOffset; + long longLength; + Bool delete; Atom type; Atom *actualType; int *format; @@ -569,24 +572,24 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, if (!pWin) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: invalid window\n", __func__); -#endif + #endif return BadWindow; } if (!ValidAtom(property)) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: invalid atom [%d]\n", __func__, property); -#endif + #endif return(BadAtom); } if ((type != AnyPropertyType) && !ValidAtom(type)) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: invalid type [%d]\n", __func__, type); -#endif + #endif return(BadAtom); } @@ -604,14 +607,14 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, if (!pProp) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: property not found [%d]\n", __func__, property); -#endif + #endif return (BadAtom); } /* If the request type and actual type don't match. Return the - property information, but not the data. */ + property information, but not the data. */ if (((type != pProp->type) && (type != AnyPropertyType)) @@ -624,20 +627,20 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, return(Success); } -/* - * Return type, format, value to client - */ + /* + * Return type, format, value to client + */ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ ind = 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) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: negative property len\n", __func__); -#endif + #endif return BadValue; } @@ -650,9 +653,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, if (delete && (*bytesAfter == 0)) { /* send the event */ - xEvent event; - - memset(&event, 0, sizeof(xEvent)); + xEvent event = {0}; event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; @@ -663,7 +664,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, if (len) { - *propData = (unsigned char *)(pProp->data) + ind; + *propData = (unsigned char *)(pProp->data) + ind; } if (delete && (*bytesAfter == 0)) |