[PATCH libXext] Correct XShm return values.
Jeremy Huddleston
jeremyhu at apple.com
Mon Apr 11 21:58:40 PDT 2011
Yeah, ugly, but looks reasonable given the unfortunateness of the situation.
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
Should be no effective difference once past cpp since they're both ints:
#define Bool int
#define Status int
#define True 1
#define False 0
On Apr 10, 2011, at 18:11, Peter Hutterer wrote:
> XShmAttach, XShmDetach, XShmPutImage do not return a Status but 0 or 1.
> Though the man section for XShmAttach says "if all goes well, you will get a
> non-zero status, back" this is counter to the usage of Status in Xlib
> itself where 0 means Success and no-zero specifies the specific error.
>
> XShmPixmapFormat does not return a Status but the pixmap format or 0 on
> failure.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> I know we're reluctant to change library header files but in this particular
> case it should be safe. Status and Bool are both typedef'd to int in Xlib.h.
> Likewise with the XShmPixmapFormat return code.
>
> Alternatively, if this patch is considered too risky, I can just change the
> man page to state that the Status return type is bogus and should
> be interpreted as boolean instead.
>
> include/X11/extensions/XShm.h | 8 ++++----
> man/XShm.man | 10 +++++-----
> src/XShm.c | 8 ++++----
> 3 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/include/X11/extensions/XShm.h b/include/X11/extensions/XShm.h
> index 44eaf0b..8e534f9 100644
> --- a/include/X11/extensions/XShm.h
> +++ b/include/X11/extensions/XShm.h
> @@ -78,17 +78,17 @@ int XShmPixmapFormat(
> Display* /* dpy */
> );
>
> -Status XShmAttach(
> +Bool XShmAttach(
> Display* /* dpy */,
> XShmSegmentInfo* /* shminfo */
> );
>
> -Status XShmDetach(
> +Bool XShmDetach(
> Display* /* dpy */,
> XShmSegmentInfo* /* shminfo */
> );
>
> -Status XShmPutImage(
> +Bool XShmPutImage(
> Display* /* dpy */,
> Drawable /* d */,
> GC /* gc */,
> @@ -102,7 +102,7 @@ Status XShmPutImage(
> Bool /* send_event */
> );
>
> -Status XShmGetImage(
> +Bool XShmGetImage(
> Display* /* dpy */,
> Drawable /* d */,
> XImage* /* image */,
> diff --git a/man/XShm.man b/man/XShm.man
> index 4309461..f459ce1 100644
> --- a/man/XShm.man
> +++ b/man/XShm.man
> @@ -70,14 +70,14 @@ Bool XShmQueryVersion(
> int *major, *minor;
> Bool *pixmaps);
> .LP
> -Status XShmPixmapFormat(
> +int XShmPixmapFormat(
> Display *display);
> .LP
> -Status XShmAttach(
> +Bool XShmAttach(
> Display *display;
> XShmSegmentInfo *shminfo);
> .LP
> -Status XShmDetach(
> +Bool XShmDetach(
> Display *display;
> XShmSegmentInfo *shminfo);
>
> @@ -91,7 +91,7 @@ XImage *XShmCreateImage (
> XShmSegmentInfo *shminfo;
> unsigned int width, height);
> .LP
> -Status XShmPutImage(
> +Bool XShmPutImage(
> Display *display;
> Drawable d;
> GC gc;
> @@ -100,7 +100,7 @@ Status XShmPutImage(
> unsigned int width, height;
> bool send_event);
> .LP
> -Status XShmGetImage (
> +Bool XShmGetImage (
> Display *display;
> Drawable d;
> XImage *image;
> diff --git a/src/XShm.c b/src/XShm.c
> index fc18860..af3e71b 100644
> --- a/src/XShm.c
> +++ b/src/XShm.c
> @@ -226,7 +226,7 @@ int XShmPixmapFormat(Display *dpy)
> }
>
>
> -Status XShmAttach(Display *dpy, XShmSegmentInfo *shminfo)
> +Bool XShmAttach(Display *dpy, XShmSegmentInfo *shminfo)
> {
> XExtDisplayInfo *info = find_display (dpy);
> register xShmAttachReq *req;
> @@ -246,7 +246,7 @@ Status XShmAttach(Display *dpy, XShmSegmentInfo *shminfo)
> }
>
>
> -Status XShmDetach(Display *dpy, XShmSegmentInfo *shminfo)
> +Bool XShmDetach(Display *dpy, XShmSegmentInfo *shminfo)
> {
> XExtDisplayInfo *info = find_display (dpy);
> register xShmDetachReq *req;
> @@ -315,7 +315,7 @@ XImage *XShmCreateImage (
> return image;
> }
>
> -Status XShmPutImage (
> +Bool XShmPutImage (
> register Display *dpy,
> Drawable d,
> GC gc,
> @@ -357,7 +357,7 @@ Status XShmPutImage (
> }
>
>
> -Status XShmGetImage(
> +Bool XShmGetImage(
> register Display *dpy,
> Drawable d,
> XImage *image,
> --
> 1.7.4.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list