diff options
Diffstat (limited to 'libXext/src')
-rw-r--r-- | libXext/src/DPMS.c | 2 | ||||
-rw-r--r-- | libXext/src/MITMisc.c | 2 | ||||
-rw-r--r-- | libXext/src/XAppgroup.c | 2 | ||||
-rw-r--r-- | libXext/src/XEVI.c | 426 | ||||
-rw-r--r-- | libXext/src/XLbx.c | 4 | ||||
-rw-r--r-- | libXext/src/XMultibuf.c | 4 | ||||
-rw-r--r-- | libXext/src/XSecurity.c | 618 | ||||
-rw-r--r-- | libXext/src/XShape.c | 2 | ||||
-rw-r--r-- | libXext/src/XShm.c | 4 | ||||
-rw-r--r-- | libXext/src/XSync.c | 4 | ||||
-rw-r--r-- | libXext/src/Xcup.c | 2 | ||||
-rw-r--r-- | libXext/src/Xdbe.c | 4 | ||||
-rw-r--r-- | libXext/src/Xge.c | 2 | ||||
-rw-r--r-- | libXext/src/extutil.c | 2 |
14 files changed, 539 insertions, 539 deletions
diff --git a/libXext/src/DPMS.c b/libXext/src/DPMS.c index 07818a07e..a4f0595a8 100644 --- a/libXext/src/DPMS.c +++ b/libXext/src/DPMS.c @@ -42,7 +42,7 @@ Equipment Corporation. static XExtensionInfo _dpms_info_data; static XExtensionInfo *dpms_info = &_dpms_info_data; -static char *dpms_extension_name = DPMSExtensionName; +static const char *dpms_extension_name = DPMSExtensionName; #define DPMSCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, dpms_extension_name, val) diff --git a/libXext/src/MITMisc.c b/libXext/src/MITMisc.c index bc452dba7..b8c21b6f6 100644 --- a/libXext/src/MITMisc.c +++ b/libXext/src/MITMisc.c @@ -37,7 +37,7 @@ in this Software without prior written authorization from The Open Group. static XExtensionInfo _mit_info_data; static XExtensionInfo *mit_info = &_mit_info_data; -static /* const */ char *mit_extension_name = MITMISCNAME; +static const char *mit_extension_name = MITMISCNAME; #define MITCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, mit_extension_name, val) diff --git a/libXext/src/XAppgroup.c b/libXext/src/XAppgroup.c index 16650b6a9..b5642f3ba 100644 --- a/libXext/src/XAppgroup.c +++ b/libXext/src/XAppgroup.c @@ -52,7 +52,7 @@ struct xagstuff { static XExtensionInfo _xag_info_data; static XExtensionInfo *xag_info = &_xag_info_data; -static char *xag_extension_name = XAGNAME; +static const char *xag_extension_name = XAGNAME; #define XagCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, xag_extension_name, val) diff --git a/libXext/src/XEVI.c b/libXext/src/XEVI.c index caf988977..eb09daa9a 100644 --- a/libXext/src/XEVI.c +++ b/libXext/src/XEVI.c @@ -1,213 +1,213 @@ -/************************************************************
-Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
-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 supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-********************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xlibint.h>
-#include <X11/extensions/XEVI.h>
-#include <X11/extensions/EVIproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/Xutil.h>
-static XExtensionInfo *xevi_info;/* needs to move to globals.c */
-static /* const */ char *xevi_extension_name = EVINAME;
-#define XeviCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xevi_extension_name, val)
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-static /* const */ XExtensionHooks xevi_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- NULL, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xevi_info,
- xevi_extension_name,
- &xevi_extension_hooks, 0, NULL)
-Bool XeviQueryExtension (Display *dpy)
-{
- XExtDisplayInfo *info = find_display (dpy);
- if (XextHasExtension(info)) {
- return True;
- } else {
- return False;
- }
-}
-Bool XeviQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xEVIQueryVersionReply rep;
- register xEVIQueryVersionReq *req;
- XeviCheckExtension (dpy, info, False);
- LockDisplay(dpy);
- GetReq(EVIQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xeviReqType = X_EVIQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-static Bool notInList(VisualID32 *visual, int sz_visual, VisualID newVisualid)
-{
- while (sz_visual-- > 0) {
- if (*visual == newVisualid)
- return False;
- visual++;
- }
- return True;
-}
-Status XeviGetVisualInfo(
- register Display *dpy,
- VisualID *visual,
- int n_visual,
- ExtendedVisualInfo **evi_return,
- int *n_info_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xEVIGetVisualInfoReq *req;
- xEVIGetVisualInfoReply rep;
- int sz_info, sz_xInfo, sz_conflict, sz_xConflict;
- VisualID32 *temp_conflict, *temp_visual, *xConflictPtr;
- VisualID *conflict;
- xExtendedVisualInfo *temp_xInfo;
- XVisualInfo *vinfo;
- register ExtendedVisualInfo *infoPtr;
- register xExtendedVisualInfo *xInfoPtr;
- register int n_data, visualIndex, vinfoIndex;
- Bool isValid;
- XeviCheckExtension (dpy, info, 0);
- if (!n_info_return || !evi_return) {
- return BadValue;
- }
- *n_info_return = 0;
- *evi_return = NULL;
- vinfo = XGetVisualInfo(dpy, 0, NULL, &sz_info);
- if (!vinfo) {
- return BadValue;
- }
- if (!n_visual || !visual) { /* copy the all visual */
- temp_visual = (VisualID32 *)Xmalloc(sz_VisualID32 * sz_info);
- n_visual = 0;
- for (vinfoIndex = 0; vinfoIndex < sz_info; vinfoIndex++)
- if (notInList(temp_visual, n_visual, vinfo[vinfoIndex].visualid))
- temp_visual[n_visual++] = vinfo[vinfoIndex].visualid;
- }
- else { /* check if the visual is valid */
- for (visualIndex = 0; visualIndex < n_visual; visualIndex++) {
- isValid = False;
- for (vinfoIndex = 0; vinfoIndex < sz_info; vinfoIndex++) {
- if (visual[visualIndex] == vinfo[vinfoIndex].visualid) {
- isValid = True;
- break;
- }
- }
- if (!isValid) {
- XFree(vinfo);
- return BadValue;
- }
- }
- temp_visual = (VisualID32 *)Xmalloc(sz_VisualID32 * n_visual);
- for (visualIndex = 0; visualIndex < n_visual; visualIndex++)
- temp_visual[visualIndex] = visual[visualIndex];
- }
- XFree(vinfo);
- LockDisplay(dpy);
- GetReq(EVIGetVisualInfo, req);
- req->reqType = info->codes->major_opcode;
- req->xeviReqType = X_EVIGetVisualInfo;
- req->n_visual = n_visual;
- SetReqLen(req, n_visual, 1);
- Data(dpy, (char *)temp_visual, n_visual * sz_VisualID32);
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- Xfree(temp_visual);
- return BadAccess;
- }
- Xfree(temp_visual);
- sz_info = rep.n_info * sizeof(ExtendedVisualInfo);
- sz_xInfo = rep.n_info * sz_xExtendedVisualInfo;
- sz_conflict = rep.n_conflicts * sizeof(VisualID);
- sz_xConflict = rep.n_conflicts * sz_VisualID32;
- infoPtr = *evi_return = (ExtendedVisualInfo *)Xmalloc(sz_info + sz_conflict);
- xInfoPtr = temp_xInfo = (xExtendedVisualInfo *)Xmalloc(sz_xInfo);
- xConflictPtr = temp_conflict = (VisualID32 *)Xmalloc(sz_xConflict);
- if (!*evi_return || !temp_xInfo || !temp_conflict) {
- _XEatData(dpy, (sz_xInfo + sz_xConflict + 3) & ~3);
- UnlockDisplay(dpy);
- SyncHandle();
- if (evi_return)
- Xfree(evi_return);
- if (temp_xInfo)
- Xfree(temp_xInfo);
- if (temp_conflict)
- Xfree(temp_conflict);
- return BadAlloc;
- }
- _XRead(dpy, (char *)temp_xInfo, sz_xInfo);
- _XRead(dpy, (char *)temp_conflict, sz_xConflict);
- UnlockDisplay(dpy);
- SyncHandle();
- n_data = rep.n_info;
- conflict = (VisualID *)(infoPtr + n_data);
- while (n_data-- > 0) {
- infoPtr->core_visual_id = xInfoPtr->core_visual_id;
- infoPtr->screen = xInfoPtr->screen;
- infoPtr->level = xInfoPtr->level;
- infoPtr->transparency_type = xInfoPtr->transparency_type;
- infoPtr->transparency_value = xInfoPtr->transparency_value;
- infoPtr->min_hw_colormaps = xInfoPtr->min_hw_colormaps;
- infoPtr->max_hw_colormaps = xInfoPtr->max_hw_colormaps;
- infoPtr->num_colormap_conflicts = xInfoPtr->num_colormap_conflicts;
- infoPtr->colormap_conflicts = conflict;
- conflict += infoPtr->num_colormap_conflicts;
- infoPtr++;
- xInfoPtr++;
- }
- n_data = rep.n_conflicts;
- conflict = (VisualID *)(infoPtr);
- while (n_data-- > 0)
- *conflict++ = *xConflictPtr++;
- Xfree(temp_xInfo);
- Xfree(temp_conflict);
- *n_info_return = rep.n_info;
- return Success;
-}
+/************************************************************ +Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <X11/Xlibint.h> +#include <X11/extensions/XEVI.h> +#include <X11/extensions/EVIproto.h> +#include <X11/extensions/Xext.h> +#include <X11/extensions/extutil.h> +#include <X11/Xutil.h> +static XExtensionInfo *xevi_info;/* needs to move to globals.c */ +static const char *xevi_extension_name = EVINAME; +#define XeviCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, xevi_extension_name, val) +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ +static /* const */ XExtensionHooks xevi_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + NULL, /* close_display */ + NULL, /* wire_to_event */ + NULL, /* event_to_wire */ + NULL, /* error */ + NULL, /* error_string */ +}; +static XEXT_GENERATE_FIND_DISPLAY (find_display, xevi_info, + xevi_extension_name, + &xevi_extension_hooks, 0, NULL) +Bool XeviQueryExtension (Display *dpy) +{ + XExtDisplayInfo *info = find_display (dpy); + if (XextHasExtension(info)) { + return True; + } else { + return False; + } +} +Bool XeviQueryVersion(Display *dpy, int *majorVersion, int *minorVersion) +{ + XExtDisplayInfo *info = find_display (dpy); + xEVIQueryVersionReply rep; + register xEVIQueryVersionReq *req; + XeviCheckExtension (dpy, info, False); + LockDisplay(dpy); + GetReq(EVIQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->xeviReqType = X_EVIQueryVersion; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + *majorVersion = rep.majorVersion; + *minorVersion = rep.minorVersion; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} +static Bool notInList(VisualID32 *visual, int sz_visual, VisualID newVisualid) +{ + while (sz_visual-- > 0) { + if (*visual == newVisualid) + return False; + visual++; + } + return True; +} +Status XeviGetVisualInfo( + register Display *dpy, + VisualID *visual, + int n_visual, + ExtendedVisualInfo **evi_return, + int *n_info_return) +{ + XExtDisplayInfo *info = find_display (dpy); + register xEVIGetVisualInfoReq *req; + xEVIGetVisualInfoReply rep; + int sz_info, sz_xInfo, sz_conflict, sz_xConflict; + VisualID32 *temp_conflict, *temp_visual, *xConflictPtr; + VisualID *conflict; + xExtendedVisualInfo *temp_xInfo; + XVisualInfo *vinfo; + register ExtendedVisualInfo *infoPtr; + register xExtendedVisualInfo *xInfoPtr; + register int n_data, visualIndex, vinfoIndex; + Bool isValid; + XeviCheckExtension (dpy, info, 0); + if (!n_info_return || !evi_return) { + return BadValue; + } + *n_info_return = 0; + *evi_return = NULL; + vinfo = XGetVisualInfo(dpy, 0, NULL, &sz_info); + if (!vinfo) { + return BadValue; + } + if (!n_visual || !visual) { /* copy the all visual */ + temp_visual = (VisualID32 *)Xmalloc(sz_VisualID32 * sz_info); + n_visual = 0; + for (vinfoIndex = 0; vinfoIndex < sz_info; vinfoIndex++) + if (notInList(temp_visual, n_visual, vinfo[vinfoIndex].visualid)) + temp_visual[n_visual++] = vinfo[vinfoIndex].visualid; + } + else { /* check if the visual is valid */ + for (visualIndex = 0; visualIndex < n_visual; visualIndex++) { + isValid = False; + for (vinfoIndex = 0; vinfoIndex < sz_info; vinfoIndex++) { + if (visual[visualIndex] == vinfo[vinfoIndex].visualid) { + isValid = True; + break; + } + } + if (!isValid) { + XFree(vinfo); + return BadValue; + } + } + temp_visual = (VisualID32 *)Xmalloc(sz_VisualID32 * n_visual); + for (visualIndex = 0; visualIndex < n_visual; visualIndex++) + temp_visual[visualIndex] = visual[visualIndex]; + } + XFree(vinfo); + LockDisplay(dpy); + GetReq(EVIGetVisualInfo, req); + req->reqType = info->codes->major_opcode; + req->xeviReqType = X_EVIGetVisualInfo; + req->n_visual = n_visual; + SetReqLen(req, n_visual, 1); + Data(dpy, (char *)temp_visual, n_visual * sz_VisualID32); + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + Xfree(temp_visual); + return BadAccess; + } + Xfree(temp_visual); + sz_info = rep.n_info * sizeof(ExtendedVisualInfo); + sz_xInfo = rep.n_info * sz_xExtendedVisualInfo; + sz_conflict = rep.n_conflicts * sizeof(VisualID); + sz_xConflict = rep.n_conflicts * sz_VisualID32; + infoPtr = *evi_return = (ExtendedVisualInfo *)Xmalloc(sz_info + sz_conflict); + xInfoPtr = temp_xInfo = (xExtendedVisualInfo *)Xmalloc(sz_xInfo); + xConflictPtr = temp_conflict = (VisualID32 *)Xmalloc(sz_xConflict); + if (!*evi_return || !temp_xInfo || !temp_conflict) { + _XEatData(dpy, (sz_xInfo + sz_xConflict + 3) & ~3); + UnlockDisplay(dpy); + SyncHandle(); + if (evi_return) + Xfree(evi_return); + if (temp_xInfo) + Xfree(temp_xInfo); + if (temp_conflict) + Xfree(temp_conflict); + return BadAlloc; + } + _XRead(dpy, (char *)temp_xInfo, sz_xInfo); + _XRead(dpy, (char *)temp_conflict, sz_xConflict); + UnlockDisplay(dpy); + SyncHandle(); + n_data = rep.n_info; + conflict = (VisualID *)(infoPtr + n_data); + while (n_data-- > 0) { + infoPtr->core_visual_id = xInfoPtr->core_visual_id; + infoPtr->screen = xInfoPtr->screen; + infoPtr->level = xInfoPtr->level; + infoPtr->transparency_type = xInfoPtr->transparency_type; + infoPtr->transparency_value = xInfoPtr->transparency_value; + infoPtr->min_hw_colormaps = xInfoPtr->min_hw_colormaps; + infoPtr->max_hw_colormaps = xInfoPtr->max_hw_colormaps; + infoPtr->num_colormap_conflicts = xInfoPtr->num_colormap_conflicts; + infoPtr->colormap_conflicts = conflict; + conflict += infoPtr->num_colormap_conflicts; + infoPtr++; + xInfoPtr++; + } + n_data = rep.n_conflicts; + conflict = (VisualID *)(infoPtr); + while (n_data-- > 0) + *conflict++ = *xConflictPtr++; + Xfree(temp_xInfo); + Xfree(temp_conflict); + *n_info_return = rep.n_info; + return Success; +} diff --git a/libXext/src/XLbx.c b/libXext/src/XLbx.c index b3ba1b2ea..fda00ea63 100644 --- a/libXext/src/XLbx.c +++ b/libXext/src/XLbx.c @@ -33,7 +33,7 @@ static XExtensionInfo _lbx_info_data; static XExtensionInfo *lbx_info = &_lbx_info_data; -static /* const */ char *lbx_extension_name = LBXNAME; +static const char *lbx_extension_name = LBXNAME; #define LbxCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, lbx_extension_name, val) @@ -55,7 +55,7 @@ static /* const */ XExtensionHooks lbx_extension_hooks = { error_string, /* error_string */ }; -static /* const */ char *lbx_error_list[] = { +static const char *lbx_error_list[] = { "BadLbxClient", /* BadLbxClient */ }; diff --git a/libXext/src/XMultibuf.c b/libXext/src/XMultibuf.c index fb995f840..7a746bac5 100644 --- a/libXext/src/XMultibuf.c +++ b/libXext/src/XMultibuf.c @@ -37,7 +37,7 @@ in this Software without prior written authorization from The Open Group. static XExtensionInfo _multibuf_info_data; static XExtensionInfo *multibuf_info = &_multibuf_info_data; -static /* const */ char *multibuf_extension_name = MULTIBUFFER_PROTOCOL_NAME; +static const char *multibuf_extension_name = MULTIBUFFER_PROTOCOL_NAME; #define MbufCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, multibuf_extension_name, val) @@ -72,7 +72,7 @@ static /* const */ XExtensionHooks multibuf_extension_hooks = { error_string, /* error_string */ }; -static /* const */ char *multibuf_error_list[] = { +static const char *multibuf_error_list[] = { "BadBuffer", /* MultibufferBadBuffer */ }; diff --git a/libXext/src/XSecurity.c b/libXext/src/XSecurity.c index 4ce7c4d01..f8c7da13b 100644 --- a/libXext/src/XSecurity.c +++ b/libXext/src/XSecurity.c @@ -1,309 +1,309 @@ -/*
-
-Copyright 1996, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xlibint.h>
-#include <stdio.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/securproto.h>
-#include <X11/extensions/security.h>
-
-static XExtensionInfo _Security_info_data;
-static XExtensionInfo *Security_info = &_Security_info_data;
-static char *Security_extension_name = SECURITY_EXTENSION_NAME;
-
-#define SecurityCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, Security_extension_name, val)
-#define SecuritySimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, Security_extension_name)
-
-#define SecurityGetReq(name,req,info) GetReq (name, req); \
- req->reqType = info->codes->major_opcode; \
- req->securityReqType = X_##name;
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-/*
- * find_display - locate the display info block
- */
-static int close_display(Display *dpy, XExtCodes *codes);
-static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire);
-static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire);
-static char *error_string(Display *dpy, int code, XExtCodes *codes,
- char *buf, int n);
-
-static XExtensionHooks Security_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- wire_to_event, /* wire_to_event */
- event_to_wire, /* event_to_wire */
- NULL, /* error */
- error_string /* error_string */
-};
-
-static char *security_error_list[] = {
- "BadAuthorization",
- "BadAuthorizationProtocol"
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, Security_info,
- Security_extension_name,
- &Security_extension_hooks,
- XSecurityNumberEvents, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, Security_info)
-
-static
-XEXT_GENERATE_ERROR_STRING(error_string, Security_extension_name,
- XSecurityNumberErrors, security_error_list)
-
-static Bool
-wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- SecurityCheckExtension (dpy, info, False);
-
- switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
- {
- case XSecurityAuthorizationRevoked:
- {
- xSecurityAuthorizationRevokedEvent *rwire =
- (xSecurityAuthorizationRevokedEvent *)wire;
- XSecurityAuthorizationRevokedEvent *revent =
- (XSecurityAuthorizationRevokedEvent *)event;
-
- revent->type = rwire->type & 0x7F;
- revent->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *) wire);
- revent->send_event = (rwire->type & 0x80) != 0;
- revent->display = dpy;
- revent->auth_id = rwire->authId;
- return True;
- }
- }
- return False;
-}
-
-static Status
-event_to_wire(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- SecurityCheckExtension(dpy, info, False);
-
- switch ((event->type & 0x7F) - info->codes->first_event)
- {
- case XSecurityAuthorizationRevoked:
- {
- xSecurityAuthorizationRevokedEvent *rwire =
- (xSecurityAuthorizationRevokedEvent *)wire;
- XSecurityAuthorizationRevokedEvent *revent =
- (XSecurityAuthorizationRevokedEvent *)event;
- rwire->type = revent->type | (revent->send_event ? 0x80 : 0);
- rwire->sequenceNumber = revent->serial & 0xFFFF;
- return True;
- }
- }
- return False;
-}
-
-/*****************************************************************************
- * *
- * Security public interfaces *
- * *
- *****************************************************************************/
-
-Status XSecurityQueryExtension (
- Display *dpy,
- int *major_version_return,
- int *minor_version_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xSecurityQueryVersionReply rep;
- register xSecurityQueryVersionReq *req;
-
- if (!XextHasExtension (info))
- return (Status)0; /* failure */
-
- LockDisplay (dpy);
- SecurityGetReq (SecurityQueryVersion, req, info);
- req->majorVersion = SECURITY_MAJOR_VERSION;
- req->minorVersion = SECURITY_MINOR_VERSION;
-
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return (Status)0; /* failure */
- }
- *major_version_return = rep.majorVersion;
- *minor_version_return = rep.minorVersion;
- UnlockDisplay (dpy);
-
- SyncHandle ();
-
- if (*major_version_return != SECURITY_MAJOR_VERSION)
- return (Status)0; /* failure */
- else
- return (Status)1; /* success */
-}
-
-Xauth *
-XSecurityAllocXauth(void)
-{
- return Xcalloc(1, sizeof(Xauth));
-}
-
-void
-XSecurityFreeXauth(Xauth *auth)
-{
- XFree(auth);
-}
-
-static int
-Ones(Mask mask)
-{
- register Mask y;
-
- y = (mask >> 1) &033333333333;
- y = mask - y - ((y >>1) & 033333333333);
- return (((y + (y >> 3)) & 030707070707) % 077);
-}
-
-Xauth *
-XSecurityGenerateAuthorization(
- Display *dpy,
- Xauth *auth_in,
- unsigned long valuemask,
- XSecurityAuthorizationAttributes *attributes,
- XSecurityAuthorization *auth_id_return)
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xSecurityGenerateAuthorizationReq *req;
- xSecurityGenerateAuthorizationReply rep;
- Xauth *auth_return;
- unsigned long values[3];
- unsigned long *value = values;
- unsigned int nvalues;
-
- *auth_id_return = 0; /* in case we fail */
-
- /* make sure extension is available */
-
- SecurityCheckExtension (dpy, info, (Xauth *)NULL);
-
- LockDisplay(dpy);
- SecurityGetReq(SecurityGenerateAuthorization, req, info);
-
- req->nbytesAuthProto = auth_in->name_length;
- req->nbytesAuthData = auth_in->data_length;
-
- /* adjust length to account for auth name and data */
- req->length += (auth_in->name_length + (unsigned)3) >> 2;
- req->length += (auth_in->data_length + (unsigned)3) >> 2;
-
- /* adjust length to account for list of values */
- req->valueMask = valuemask & XSecurityAllAuthorizationAttributes;
- nvalues = Ones(req->valueMask);
- req->length += nvalues;
-
- /* send auth name and data */
- Data(dpy, auth_in->name, auth_in->name_length);
- Data(dpy, auth_in->data, auth_in->data_length);
-
- /* send values */
- if (valuemask & XSecurityTimeout) *value++ = attributes->timeout;
- if (valuemask & XSecurityTrustLevel) *value++ = attributes->trust_level;
- if (valuemask & XSecurityGroup) *value++ = attributes->group;
- if (valuemask & XSecurityEventMask) *value++ = attributes->event_mask;
-
- nvalues <<= 2;
- Data32(dpy, (long *)values, (long)nvalues);
-
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return (Xauth *)NULL;
- }
-
- *auth_id_return = rep.authId;
-
- /* Allocate space for the Xauth struct and the auth name and data all
- * in one hunk. This lets XSecurityFreeXauth not have to care
- * about whether the auth was allocated here or in
- * XSecurityAllocXauth; in both cases, you just free one pointer.
- */
-
- if ((auth_return = (Xauth *)Xcalloc(1,
- (sizeof(Xauth) + auth_in->name_length + rep.dataLength))))
- {
- auth_return->data_length = rep.dataLength;
- auth_return->data = (char *)&auth_return[1];
- _XReadPad(dpy, auth_return->data, (long)rep.dataLength);
-
- auth_return->name_length = auth_in->name_length;
- auth_return->name = auth_return->data + auth_return->data_length;
- memcpy(auth_return->name, auth_in->name, auth_return->name_length);
- }
- else
- {
- _XEatData(dpy, (unsigned long) (rep.dataLength + 3) & ~3);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return auth_return;
-
-} /* XSecurityGenerateAuthorization */
-
-Status
-XSecurityRevokeAuthorization(
- Display *dpy,
- XSecurityAuthorization auth_id)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xSecurityRevokeAuthorizationReq *req;
-
- SecurityCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- SecurityGetReq(SecurityRevokeAuthorization, req, info);
- req->authId = auth_id;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-} /* XSecurityRevokeAuthorization */
+/* + +Copyright 1996, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <X11/Xlibint.h> +#include <stdio.h> +#include <X11/extensions/Xext.h> +#include <X11/extensions/extutil.h> +#include <X11/extensions/securproto.h> +#include <X11/extensions/security.h> + +static XExtensionInfo _Security_info_data; +static XExtensionInfo *Security_info = &_Security_info_data; +static const char *Security_extension_name = SECURITY_EXTENSION_NAME; + +#define SecurityCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, Security_extension_name, val) +#define SecuritySimpleCheckExtension(dpy,i) \ + XextSimpleCheckExtension (dpy, i, Security_extension_name) + +#define SecurityGetReq(name,req,info) GetReq (name, req); \ + req->reqType = info->codes->major_opcode; \ + req->securityReqType = X_##name; + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +/* + * find_display - locate the display info block + */ +static int close_display(Display *dpy, XExtCodes *codes); +static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire); +static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire); +static char *error_string(Display *dpy, int code, XExtCodes *codes, + char *buf, int n); + +static XExtensionHooks Security_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + close_display, /* close_display */ + wire_to_event, /* wire_to_event */ + event_to_wire, /* event_to_wire */ + NULL, /* error */ + error_string /* error_string */ +}; + +static const char *security_error_list[] = { + "BadAuthorization", + "BadAuthorizationProtocol" +}; + +static XEXT_GENERATE_FIND_DISPLAY (find_display, Security_info, + Security_extension_name, + &Security_extension_hooks, + XSecurityNumberEvents, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, Security_info) + +static +XEXT_GENERATE_ERROR_STRING(error_string, Security_extension_name, + XSecurityNumberErrors, security_error_list) + +static Bool +wire_to_event(Display *dpy, XEvent *event, xEvent *wire) +{ + XExtDisplayInfo *info = find_display(dpy); + + SecurityCheckExtension (dpy, info, False); + + switch ((wire->u.u.type & 0x7F) - info->codes->first_event) + { + case XSecurityAuthorizationRevoked: + { + xSecurityAuthorizationRevokedEvent *rwire = + (xSecurityAuthorizationRevokedEvent *)wire; + XSecurityAuthorizationRevokedEvent *revent = + (XSecurityAuthorizationRevokedEvent *)event; + + revent->type = rwire->type & 0x7F; + revent->serial = _XSetLastRequestRead(dpy, + (xGenericReply *) wire); + revent->send_event = (rwire->type & 0x80) != 0; + revent->display = dpy; + revent->auth_id = rwire->authId; + return True; + } + } + return False; +} + +static Status +event_to_wire(Display *dpy, XEvent *event, xEvent *wire) +{ + XExtDisplayInfo *info = find_display(dpy); + + SecurityCheckExtension(dpy, info, False); + + switch ((event->type & 0x7F) - info->codes->first_event) + { + case XSecurityAuthorizationRevoked: + { + xSecurityAuthorizationRevokedEvent *rwire = + (xSecurityAuthorizationRevokedEvent *)wire; + XSecurityAuthorizationRevokedEvent *revent = + (XSecurityAuthorizationRevokedEvent *)event; + rwire->type = revent->type | (revent->send_event ? 0x80 : 0); + rwire->sequenceNumber = revent->serial & 0xFFFF; + return True; + } + } + return False; +} + +/***************************************************************************** + * * + * Security public interfaces * + * * + *****************************************************************************/ + +Status XSecurityQueryExtension ( + Display *dpy, + int *major_version_return, + int *minor_version_return) +{ + XExtDisplayInfo *info = find_display (dpy); + xSecurityQueryVersionReply rep; + register xSecurityQueryVersionReq *req; + + if (!XextHasExtension (info)) + return (Status)0; /* failure */ + + LockDisplay (dpy); + SecurityGetReq (SecurityQueryVersion, req, info); + req->majorVersion = SECURITY_MAJOR_VERSION; + req->minorVersion = SECURITY_MINOR_VERSION; + + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return (Status)0; /* failure */ + } + *major_version_return = rep.majorVersion; + *minor_version_return = rep.minorVersion; + UnlockDisplay (dpy); + + SyncHandle (); + + if (*major_version_return != SECURITY_MAJOR_VERSION) + return (Status)0; /* failure */ + else + return (Status)1; /* success */ +} + +Xauth * +XSecurityAllocXauth(void) +{ + return Xcalloc(1, sizeof(Xauth)); +} + +void +XSecurityFreeXauth(Xauth *auth) +{ + XFree(auth); +} + +static int +Ones(Mask mask) +{ + register Mask y; + + y = (mask >> 1) &033333333333; + y = mask - y - ((y >>1) & 033333333333); + return (((y + (y >> 3)) & 030707070707) % 077); +} + +Xauth * +XSecurityGenerateAuthorization( + Display *dpy, + Xauth *auth_in, + unsigned long valuemask, + XSecurityAuthorizationAttributes *attributes, + XSecurityAuthorization *auth_id_return) +{ + XExtDisplayInfo *info = find_display (dpy); + register xSecurityGenerateAuthorizationReq *req; + xSecurityGenerateAuthorizationReply rep; + Xauth *auth_return; + unsigned long values[3]; + unsigned long *value = values; + unsigned int nvalues; + + *auth_id_return = 0; /* in case we fail */ + + /* make sure extension is available */ + + SecurityCheckExtension (dpy, info, (Xauth *)NULL); + + LockDisplay(dpy); + SecurityGetReq(SecurityGenerateAuthorization, req, info); + + req->nbytesAuthProto = auth_in->name_length; + req->nbytesAuthData = auth_in->data_length; + + /* adjust length to account for auth name and data */ + req->length += (auth_in->name_length + (unsigned)3) >> 2; + req->length += (auth_in->data_length + (unsigned)3) >> 2; + + /* adjust length to account for list of values */ + req->valueMask = valuemask & XSecurityAllAuthorizationAttributes; + nvalues = Ones(req->valueMask); + req->length += nvalues; + + /* send auth name and data */ + Data(dpy, auth_in->name, auth_in->name_length); + Data(dpy, auth_in->data, auth_in->data_length); + + /* send values */ + if (valuemask & XSecurityTimeout) *value++ = attributes->timeout; + if (valuemask & XSecurityTrustLevel) *value++ = attributes->trust_level; + if (valuemask & XSecurityGroup) *value++ = attributes->group; + if (valuemask & XSecurityEventMask) *value++ = attributes->event_mask; + + nvalues <<= 2; + Data32(dpy, (long *)values, (long)nvalues); + + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return (Xauth *)NULL; + } + + *auth_id_return = rep.authId; + + /* Allocate space for the Xauth struct and the auth name and data all + * in one hunk. This lets XSecurityFreeXauth not have to care + * about whether the auth was allocated here or in + * XSecurityAllocXauth; in both cases, you just free one pointer. + */ + + if ((auth_return = (Xauth *)Xcalloc(1, + (sizeof(Xauth) + auth_in->name_length + rep.dataLength)))) + { + auth_return->data_length = rep.dataLength; + auth_return->data = (char *)&auth_return[1]; + _XReadPad(dpy, auth_return->data, (long)rep.dataLength); + + auth_return->name_length = auth_in->name_length; + auth_return->name = auth_return->data + auth_return->data_length; + memcpy(auth_return->name, auth_in->name, auth_return->name_length); + } + else + { + _XEatData(dpy, (unsigned long) (rep.dataLength + 3) & ~3); + } + + UnlockDisplay (dpy); + SyncHandle (); + return auth_return; + +} /* XSecurityGenerateAuthorization */ + +Status +XSecurityRevokeAuthorization( + Display *dpy, + XSecurityAuthorization auth_id) +{ + XExtDisplayInfo *info = find_display (dpy); + xSecurityRevokeAuthorizationReq *req; + + SecurityCheckExtension (dpy, info, 0); + LockDisplay(dpy); + SecurityGetReq(SecurityRevokeAuthorization, req, info); + req->authId = auth_id; + UnlockDisplay (dpy); + SyncHandle (); + return 1; +} /* XSecurityRevokeAuthorization */ diff --git a/libXext/src/XShape.c b/libXext/src/XShape.c index 1e3a77f23..6e8fbae9f 100644 --- a/libXext/src/XShape.c +++ b/libXext/src/XShape.c @@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group. static XExtensionInfo _shape_info_data; static XExtensionInfo *shape_info = &_shape_info_data; -static /* const */ char *shape_extension_name = SHAPENAME; +static const char *shape_extension_name = SHAPENAME; #define ShapeCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, shape_extension_name, val) diff --git a/libXext/src/XShm.c b/libXext/src/XShm.c index e3f8fa09b..f82455c6e 100644 --- a/libXext/src/XShm.c +++ b/libXext/src/XShm.c @@ -40,7 +40,7 @@ in this Software without prior written authorization from The Open Group. static XExtensionInfo _shm_info_data; static XExtensionInfo *shm_info = &_shm_info_data; -static /* const */ char *shm_extension_name = SHMNAME; +static const char *shm_extension_name = SHMNAME; #define ShmCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, shm_extension_name, val) @@ -70,7 +70,7 @@ static /* const */ XExtensionHooks shm_extension_hooks = { error_string, /* error_string */ }; -static /* const */ char *shm_error_list[] = { +static const char *shm_error_list[] = { "BadShmSeg", /* BadShmSeg */ }; diff --git a/libXext/src/XSync.c b/libXext/src/XSync.c index 0e19922dd..df7c43542 100644 --- a/libXext/src/XSync.c +++ b/libXext/src/XSync.c @@ -62,7 +62,7 @@ PERFORMANCE OF THIS SOFTWARE. static XExtensionInfo _sync_info_data; static XExtensionInfo *sync_info = &_sync_info_data; -static char *sync_extension_name = SYNC_NAME; +static const char *sync_extension_name = SYNC_NAME; #define SyncCheckExtension(dpy,i,val) \ XextCheckExtension(dpy, i, sync_extension_name, val) @@ -89,7 +89,7 @@ static XExtensionHooks sync_extension_hooks = { error_string, /* error_string */ }; -static char *sync_error_list[] = { +static const char *sync_error_list[] = { "BadCounter", "BadAlarm", "BadFence", diff --git a/libXext/src/Xcup.c b/libXext/src/Xcup.c index ad78699be..bb9e90f7e 100644 --- a/libXext/src/Xcup.c +++ b/libXext/src/Xcup.c @@ -39,7 +39,7 @@ in this Software without prior written authorization from The Open Group. static XExtensionInfo _xcup_info_data; static XExtensionInfo *xcup_info = &_xcup_info_data; -static char *xcup_extension_name = XCUPNAME; +static const char *xcup_extension_name = XCUPNAME; /***************************************************************************** * * diff --git a/libXext/src/Xdbe.c b/libXext/src/Xdbe.c index 1b9e2da52..4b5fa186c 100644 --- a/libXext/src/Xdbe.c +++ b/libXext/src/Xdbe.c @@ -42,7 +42,7 @@ static XExtensionInfo _dbe_info_data; static XExtensionInfo *dbe_info = &_dbe_info_data; -static char *dbe_extension_name = DBE_PROTOCOL_NAME; +static const char *dbe_extension_name = DBE_PROTOCOL_NAME; #define DbeCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, dbe_extension_name, val) @@ -86,7 +86,7 @@ static XExtensionHooks dbe_extension_hooks = { error_string, /* error_string */ }; -static char *dbe_error_list[] = { +static const char *dbe_error_list[] = { "BadBuffer", /* DbeBadBuffer */ }; diff --git a/libXext/src/Xge.c b/libXext/src/Xge.c index d28a4f052..74e48020a 100644 --- a/libXext/src/Xge.c +++ b/libXext/src/Xge.c @@ -76,7 +76,7 @@ static Bool _xgeCheckExtension(Display* dpy, XExtDisplayInfo* info); /* main extension information data */ static XExtensionInfo *xge_info; -static char xge_extension_name[] = GE_NAME; +static const char xge_extension_name[] = GE_NAME; static XExtensionHooks xge_extension_hooks = { NULL, /* create_gc */ NULL, /* copy_gc */ diff --git a/libXext/src/extutil.c b/libXext/src/extutil.c index 361a3274d..93cab7397 100644 --- a/libXext/src/extutil.c +++ b/libXext/src/extutil.c @@ -96,7 +96,7 @@ void XextDestroyExtension (XExtensionInfo *info) XExtDisplayInfo *XextAddDisplay ( XExtensionInfo *extinfo, Display *dpy, - char *ext_name, + _Xconst char *ext_name, XExtensionHooks *hooks, int nevents, XPointer data) |