diff options
-rw-r--r-- | src/XpExtUtil.c | 25 | ||||
-rw-r--r-- | src/XpExtUtil.h | 4 | ||||
-rw-r--r-- | src/XpExtVer.c | 12 | ||||
-rw-r--r-- | src/XpNotifyPdm.c | 10 |
4 files changed, 34 insertions, 17 deletions
diff --git a/src/XpExtUtil.c b/src/XpExtUtil.c index b45e30a..e69dc1e 100644 --- a/src/XpExtUtil.c +++ b/src/XpExtUtil.c @@ -34,7 +34,7 @@ ** ****************************************************************************** *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpExtUtil.c,v 1.7 2002/10/16 00:37:31 dawes Exp $ */ +/* $XFree86: xc/lib/Xp/XpExtUtil.c,v 1.8 2003/11/21 05:13:21 dawes Exp $ */ #define NEED_EVENTS #define NEED_REPLIES @@ -114,7 +114,7 @@ static XPrintLocalExtensionVersion xpprintversions[] = {{XP_ABSENT,0,0}, * xpprintversions[version_index] shows which version *this* library is. */ -int XpCheckExtInit(dpy, version_index) +int XpCheckExtInitUnlocked(dpy, version_index) register Display *dpy; register int version_index; { @@ -132,7 +132,6 @@ int XpCheckExtInit(dpy, version_index) } } - _XLockMutex(_Xglobal_lock); if (info->data == NULL) { /* * Hang a Xp private data struct. Use it for version @@ -140,14 +139,12 @@ int XpCheckExtInit(dpy, version_index) */ info->data = (caddr_t) Xmalloc (sizeof (xpPrintData)); if (!info->data) { - _XUnlockMutex(_Xglobal_lock); return (-1); } ((xpPrintData *) info->data)->vers = (XPrintLocalExtensionVersion *) Xmalloc(sizeof(XPrintLocalExtensionVersion)); if (!(((xpPrintData *) info->data)->vers)) { - _XUnlockMutex(_Xglobal_lock); return (-1); } @@ -168,14 +165,28 @@ int XpCheckExtInit(dpy, version_index) == xpprintversions[version_index].major_version) && (((xpPrintData *) info->data)->vers->minor_version < xpprintversions[version_index].minor_version))) { - _XUnlockMutex(_Xglobal_lock); return (-1); } } - _XUnlockMutex(_Xglobal_lock); + return (0); } +int XpCheckExtInit(dpy, version_index) + register Display *dpy; + register int version_index; +{ + int retval; + + _XLockMutex(_Xglobal_lock); + + retval = XpCheckExtInitUnlocked(dpy, version_index); + + _XUnlockMutex(_Xglobal_lock); + + return retval; +} + /*********************************************************************** * * Close display routine. diff --git a/src/XpExtUtil.h b/src/XpExtUtil.h index 9f2eb64..a785a7e 100644 --- a/src/XpExtUtil.h +++ b/src/XpExtUtil.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/Xp/XpExtUtil.h,v 1.3 2002/10/16 00:37:31 dawes Exp $ */ +/* $XFree86: xc/lib/Xp/XpExtUtil.h,v 1.4 2003/11/17 22:20:22 dawes Exp $ */ /* * Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. * @@ -34,10 +34,8 @@ extern XEXT_FIND_DISPLAY_PROTO(xp_find_display); extern int XpCheckExtInit( -#if NeedFunctionPrototypes Display * /* dpy */, int /* version_index */ -#endif ); #endif /* _XPEXTUTIL_H */ diff --git a/src/XpExtVer.c b/src/XpExtVer.c index 4ce49f5..2e0e5c5 100644 --- a/src/XpExtVer.c +++ b/src/XpExtVer.c @@ -34,7 +34,7 @@ ** ****************************************************************************** *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpExtVer.c,v 1.5 2002/10/16 00:37:31 dawes Exp $ */ +/* $XFree86: xc/lib/Xp/XpExtVer.c,v 1.6 2003/11/21 05:13:21 dawes Exp $ */ #define NEED_REPLIES @@ -61,7 +61,13 @@ XpQueryExtension ( } } - +/* Prototype for |XpCheckExtInitUnlocked()| + * See XpExtUtil.c - same as |XpCheckExtInit()| but does not obtain the Xlib global lock */ +extern int XpCheckExtInitUnlocked( + register Display *dpy, + register int version_index +); + Status XpQueryVersion ( Display *dpy, @@ -91,7 +97,7 @@ XpQueryVersion ( } #endif /* Would_Need_xpPrintData_Struct_Def */ - if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1) + if (XpCheckExtInitUnlocked(dpy, XP_DONT_CHECK) == -1) return (/* No such extension */ False); LockDisplay (dpy); diff --git a/src/XpNotifyPdm.c b/src/XpNotifyPdm.c index a785c20..48ab2bb 100644 --- a/src/XpNotifyPdm.c +++ b/src/XpNotifyPdm.c @@ -41,7 +41,7 @@ ** ****************************************************************************** *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpNotifyPdm.c,v 1.6 2002/10/16 00:37:32 dawes Exp $ */ +/* $XFree86: xc/lib/Xp/XpNotifyPdm.c,v 1.7 2003/07/20 16:12:14 tsi Exp $ */ #include <X11/extensions/Print.h> #include <X11/Xlibint.h> @@ -131,16 +131,18 @@ _XpGetSelectionServer ( /* * remove ".scr" portion from "host:disp.scr" strings. + * Use strrchr to find : separating host from display + * to allow IPv6 numeric addresses with embedded colons. */ - if (( tstrptr = strchr( tstr1, ':' ) )) + if (( tstrptr = strrchr( tstr1, ':' ) )) if (( tstrptr = strchr( tstrptr, '.' ) )) *tstrptr = '\0'; - if (( tstrptr = strchr( tstr2, ':' ) )) + if (( tstrptr = strrchr( tstr2, ':' ) )) if (( tstrptr = strchr( tstrptr, '.' ) )) *tstrptr = '\0'; - if (( tstrptr = strchr( tstr3, ':' ) )) + if (( tstrptr = strrchr( tstr3, ':' ) )) if (( tstrptr = strchr( tstrptr, '.' ) )) *tstrptr = '\0'; |