From 687d44b6eaa3c64a12af9bbd557b401419b208eb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 29 Jul 2016 00:44:38 +0200 Subject: update src files *[ch] to libX11 1.3.4 --- nx-X11/lib/X11/ErrDes.c | 73 ++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 34 deletions(-) (limited to 'nx-X11/lib/X11/ErrDes.c') 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); -- cgit v1.2.3