diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
commit | 051d521f6e20761ba6831cecd91883da960fa931 (patch) | |
tree | b28abba7818115d2fed80eb360a79a0f9183948e /nx-X11/lib/X11/ErrDes.c | |
parent | 6dce607bad8711dd06a5a7b69ad1930386b4123b (diff) | |
parent | b8de7bf654929c823080b211aeac56cd213f5a32 (diff) | |
download | nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.gz nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.bz2 nx-libs-051d521f6e20761ba6831cecd91883da960fa931.zip |
Merge branch 'uli42-pr/upgrade_libX11' into 3.6.x
Attributes GH PR #214: https://github.com/ArcticaProject/nx-libs/pull/214
Fixes ArcticaProject/nx-libs#157.
Diffstat (limited to 'nx-X11/lib/X11/ErrDes.c')
-rw-r--r-- | nx-X11/lib/X11/ErrDes.c | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/nx-X11/lib/X11/ErrDes.c b/nx-X11/lib/X11/ErrDes.c index fae9deba2..ac13b480b 100644 --- a/nx-X11/lib/X11/ErrDes.c +++ b/nx-X11/lib/X11/ErrDes.c @@ -1,6 +1,4 @@ /* - * $Xorg: ErrDes.c,v 1.4 2001/02/09 02:03:32 xorgcvs Exp $ - * $XdotOrg: xc/lib/X11/ErrDes.c,v 1.8 2005/08/26 05:16:46 daniels Exp $ */ /*********************************************************** @@ -32,13 +30,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -70,34 +68,40 @@ SOFTWARE. * descriptions of errors in Section 4 of Protocol doc (pp. 350-351); more * verbose descriptions are given in the error database */ -static const char * const _XErrorList[] = { - /* No error */ "no error", - /* BadRequest */ "BadRequest", - /* BadValue */ "BadValue", - /* BadWindow */ "BadWindow", - /* BadPixmap */ "BadPixmap", - /* BadAtom */ "BadAtom", - /* BadCursor */ "BadCursor", - /* BadFont */ "BadFont", - /* BadMatch */ "BadMatch", - /* BadDrawable */ "BadDrawable", - /* BadAccess */ "BadAccess", - /* BadAlloc */ "BadAlloc", - /* BadColor */ "BadColor", - /* BadGC */ "BadGC", - /* BadIDChoice */ "BadIDChoice", - /* BadName */ "BadName", - /* BadLength */ "BadLength", - /* BadImplementation */ "BadImplementation", +static const char _XErrorList[] = + /* No error */ "no error\0" + /* BadRequest */ "BadRequest\0" + /* BadValue */ "BadValue\0" + /* BadWindow */ "BadWindow\0" + /* BadPixmap */ "BadPixmap\0" + /* BadAtom */ "BadAtom\0" + /* BadCursor */ "BadCursor\0" + /* BadFont */ "BadFont\0" + /* BadMatch */ "BadMatch\0" + /* BadDrawable */ "BadDrawable\0" + /* BadAccess */ "BadAccess\0" + /* BadAlloc */ "BadAlloc\0" + /* BadColor */ "BadColor\0" + /* BadGC */ "BadGC\0" + /* BadIDChoice */ "BadIDChoice\0" + /* BadName */ "BadName\0" + /* BadLength */ "BadLength\0" + /* BadImplementation */ "BadImplementation" +; + +/* offsets into _XErrorList */ +static const unsigned char _XErrorOffsets[] = { + 0, 9, 20, 29, 39, 49, 57, 67, 75, 84, 96, + 106, 115, 124, 130, 142, 150, 160 }; int -XGetErrorText(dpy, code, buffer, nbytes) - register int code; - register Display *dpy; - char *buffer; - int nbytes; +XGetErrorText( + register Display *dpy, + register int code, + char *buffer, + int nbytes) { char buf[150]; register _XExtension *ext; @@ -106,7 +110,8 @@ XGetErrorText(dpy, code, buffer, nbytes) if (nbytes == 0) return 0; if (code <= BadImplementation && code > 0) { sprintf(buf, "%d", code); - (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, _XErrorList[code], + (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, + _XErrorList + _XErrorOffsets[code], buffer, nbytes); } else buffer[0] = '\0'; @@ -115,10 +120,10 @@ XGetErrorText(dpy, code, buffer, nbytes) if (ext->error_string) (*ext->error_string)(dpy, code, &ext->codes, buffer, nbytes); if (ext->codes.first_error && - ext->codes.first_error < code && + ext->codes.first_error <= code && (!bext || ext->codes.first_error > bext->codes.first_error)) bext = ext; - } + } if (!buffer[0] && bext) { sprintf(buf, "%s.%d", bext->name, code - bext->codes.first_error); (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, "", buffer, nbytes); @@ -186,7 +191,7 @@ XGetErrorDatabaseText( tptr = Xmalloc (tlen); if (tptr) { sprintf(tptr, "%s.%s", name, type); - XrmGetResource(db, tptr, "ErrorType.ErrorNumber", + XrmGetResource(db, tptr, "ErrorType.ErrorNumber", &type_str, &result); if (tptr != temp) Xfree (tptr); |