diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-07-05 08:34:17 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-07-05 08:34:17 +0200 |
commit | 320a8cc0c7fa472970bc3698c7e77b6406ca343b (patch) | |
tree | d13d3a78686c3d44fd4d89adfd1b57ddd4274533 /nx-X11/lib/X11 | |
parent | 854f3fa49351ec72da432f195806162fcf5e5ddc (diff) | |
parent | b15fc63f4c0c4c741af1255d17907ba3b98b5cf9 (diff) | |
download | nx-libs-320a8cc0c7fa472970bc3698c7e77b6406ca343b.tar.gz nx-libs-320a8cc0c7fa472970bc3698c7e77b6406ca343b.tar.bz2 nx-libs-320a8cc0c7fa472970bc3698c7e77b6406ca343b.zip |
Merge branch 'sunweaver-pr/silencing-compiler-warnings' into 3.6.x
Attributes GH PR #168: https://github.com/ArcticaProject/nx-libs/pull/168
Reviewed by: Vadim Troshchinskiy <vadim@qindel.com> -- Mon, 04 Jul 2016 11:15:20 -0700
Diffstat (limited to 'nx-X11/lib/X11')
-rw-r--r-- | nx-X11/lib/X11/Host.c | 73 | ||||
-rw-r--r-- | nx-X11/lib/X11/LiHosts.c | 4 | ||||
-rw-r--r-- | nx-X11/lib/X11/XKBMisc.c | 12 | ||||
-rw-r--r-- | nx-X11/lib/X11/imInsClbk.c | 2 | ||||
-rw-r--r-- | nx-X11/lib/X11/imTrX.c | 2 | ||||
-rw-r--r-- | nx-X11/lib/X11/lcFile.c | 3 |
6 files changed, 35 insertions, 61 deletions
diff --git a/nx-X11/lib/X11/Host.c b/nx-X11/lib/X11/Host.c index 58e9e4a1c..5fcb687cc 100644 --- a/nx-X11/lib/X11/Host.c +++ b/nx-X11/lib/X11/Host.c @@ -44,31 +44,31 @@ X Window System is a trademark of The Open Group. #endif #include "Xlibint.h" -int -XAddHost ( - register Display *dpy, - XHostAddress *host) +static inline int +changehost (Display *dpy, XHostAddress *host, BYTE mode) { - register xChangeHostsReq *req; - register int length; + xChangeHostsReq *req; + int length; XServerInterpretedAddress *siAddr; int addrlen; - - if (host->family == FamilyServerInterpreted) { - siAddr = (XServerInterpretedAddress *) host->address; - addrlen = siAddr->typelength + siAddr->valuelength + 1; - } else { - addrlen = host->length; - } - length = (addrlen + 3) & ~0x3; /* round up */ - + siAddr = host->family == FamilyServerInterpreted ? + (XServerInterpretedAddress *)host->address : NULL; + addrlen = siAddr ? + siAddr->typelength + siAddr->valuelength + 1 : host->length; + + length = (addrlen + 3) & ~0x3; /* round up */ + LockDisplay(dpy); GetReqExtra (ChangeHosts, length, req); - req->mode = HostInsert; + if (!req) { + UnlockDisplay(dpy); + return 0; + } + req->mode = mode; req->hostFamily = host->family; req->hostLength = addrlen; - if (host->family == FamilyServerInterpreted) { + if (siAddr) { char *dest = (char *) NEXTPTR(req,xChangeHostsReq); memcpy(dest, siAddr->type, siAddr->typelength); dest[siAddr->typelength] = '\0'; @@ -82,40 +82,19 @@ XAddHost ( } int -XRemoveHost ( +XAddHost ( register Display *dpy, XHostAddress *host) { - register xChangeHostsReq *req; - register int length; - XServerInterpretedAddress *siAddr; - int addrlen; - - if (host->family == FamilyServerInterpreted) { - siAddr = (XServerInterpretedAddress *) host->address; - addrlen = siAddr->typelength + siAddr->valuelength + 1; - } else { - addrlen = host->length; - } - - length = (addrlen + 3) & ~0x3; /* round up */ + return changehost(dpy, host, HostInsert); +} - LockDisplay(dpy); - GetReqExtra (ChangeHosts, length, req); - req->mode = HostDelete; - req->hostFamily = host->family; - req->hostLength = addrlen; - if (host->family == FamilyServerInterpreted) { - char *dest = (char *) NEXTPTR(req,xChangeHostsReq); - memcpy(dest, siAddr->type, siAddr->typelength); - dest[siAddr->typelength] = '\0'; - memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength); - } else { - memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen); - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; +int +XRemoveHost ( + register Display *dpy, + XHostAddress *host) +{ + return changehost(dpy, host, HostDelete); } int diff --git a/nx-X11/lib/X11/LiHosts.c b/nx-X11/lib/X11/LiHosts.c index bd0864448..59e2ae318 100644 --- a/nx-X11/lib/X11/LiHosts.c +++ b/nx-X11/lib/X11/LiHosts.c @@ -71,11 +71,7 @@ XHostAddress *XListHosts ( } if (reply.nHosts) { - unsigned int l; nbytes = reply.length << 2; /* compute number of bytes in reply */ - l = (unsigned) (nbytes + - (reply.nHosts * sizeof(XHostAddress)) + - (reply.nHosts * sizeof(XServerInterpretedAddress))); op = outbuf = (XHostAddress *) Xmalloc((unsigned) (nbytes + (reply.nHosts * sizeof(XHostAddress)) + diff --git a/nx-X11/lib/X11/XKBMisc.c b/nx-X11/lib/X11/XKBMisc.c index 04ac0c7ea..7f0e59e7a 100644 --- a/nx-X11/lib/X11/XKBMisc.c +++ b/nx-X11/lib/X11/XKBMisc.c @@ -666,7 +666,7 @@ register int i; int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups]; if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) || - (!xkb->map->types)||(!newTypes)||((groups&XkbAllGroupsMask)==0)|| + (!xkb->map->types)||((groups&XkbAllGroupsMask)==0)|| (nGroups>XkbNumKbdGroups)) { return BadMatch; } @@ -834,7 +834,7 @@ XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb, XkbChangesPtr changes) { register unsigned int i; -unsigned int mask; +unsigned int mask = 0; XkbVirtualModsToReal(xkb,type->mods.vmods,&mask); type->mods.mask= type->mods.real_mods|mask; @@ -888,7 +888,7 @@ unsigned int checkState = 0; XkbUpdateKeyTypeVirtualMods(xkb,&xkb->map->types[i],changed,changes); } if (changed&xkb->ctrls->internal.vmods) { - unsigned int newMask; + unsigned int newMask = 0; XkbVirtualModsToReal(xkb,xkb->ctrls->internal.vmods,&newMask); newMask|= xkb->ctrls->internal.real_mods; if (xkb->ctrls->internal.mask!=newMask) { @@ -900,7 +900,7 @@ unsigned int checkState = 0; } } if (changed&xkb->ctrls->ignore_lock.vmods) { - unsigned int newMask; + unsigned int newMask = 0; XkbVirtualModsToReal(xkb,xkb->ctrls->ignore_lock.vmods,&newMask); newMask|= xkb->ctrls->ignore_lock.real_mods; if (xkb->ctrls->ignore_lock.mask!=newMask) { @@ -916,7 +916,7 @@ unsigned int checkState = 0; map= &xkb->indicators->maps[0]; for (i=0;i<XkbNumIndicators;i++,map++) { if (map->mods.vmods&changed) { - unsigned int newMask; + unsigned int newMask = 0; XkbVirtualModsToReal(xkb,map->mods.vmods,&newMask); newMask|= map->mods.real_mods; if (newMask!=map->mods.mask) { @@ -933,7 +933,7 @@ unsigned int checkState = 0; XkbCompatMapPtr compat; compat= xkb->compat; for (i=0;i<XkbNumKbdGroups;i++) { - unsigned int newMask; + unsigned int newMask = 0; XkbVirtualModsToReal(xkb,compat->groups[i].vmods,&newMask); newMask|= compat->groups[i].real_mods; if (compat->groups[i].mask!=newMask) { diff --git a/nx-X11/lib/X11/imInsClbk.c b/nx-X11/lib/X11/imInsClbk.c index acf9f7b63..744ee824c 100644 --- a/nx-X11/lib/X11/imInsClbk.c +++ b/nx-X11/lib/X11/imInsClbk.c @@ -111,7 +111,7 @@ _XimFilterPropertyNotify( } lock = True; - for( ii = 0; ii < nitems; ii++, atoms ) { + for( ii = 0; ii < nitems; ii++ ) { if(XGetSelectionOwner (display, atoms[ii])) { for( icb = callback_list; icb; icb = icb->next ) { if( !icb->call && !icb->destroy ) { diff --git a/nx-X11/lib/X11/imTrX.c b/nx-X11/lib/X11/imTrX.c index 7d00bb3f7..4aa587662 100644 --- a/nx-X11/lib/X11/imTrX.c +++ b/nx-X11/lib/X11/imTrX.c @@ -436,7 +436,7 @@ _XimXRead(Xim im, XPointer recv_buf, int buf_len, int *ret_len) { XEvent *ev; XEvent event; - int len; + int len = 0; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; XPointer arg = spec->ev; diff --git a/nx-X11/lib/X11/lcFile.c b/nx-X11/lib/X11/lcFile.c index 2e0a49db4..e1812ad91 100644 --- a/nx-X11/lib/X11/lcFile.c +++ b/nx-X11/lib/X11/lcFile.c @@ -437,8 +437,7 @@ _XlcFileName( char buf[PATH_MAX], *name; name = NULL; - if ((5 + (args[i] ? strlen (args[i]) : 0) + - (cat ? strlen (cat) : 0)) < PATH_MAX) { + if ((5 + (args[i] ? strlen (args[i]) : 0) + strlen(cat)) < PATH_MAX) { sprintf(buf, "%s/%s.dir", args[i], cat); name = resolve_name(siname, buf, RtoL); } |