[SDL] Replace my patch with upstream one (bug #782251)

Petr Pisar ppisar at fedoraproject.org
Thu Jan 19 11:00:33 UTC 2012


commit 600a62015f44deed7a5e1340a7097157cbf210fe
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Jan 19 11:31:32 2012 +0100

    Replace my patch with upstream one (bug #782251)

 SDL-1.2.14-Define__XGetRequest.patch |   95 +++++++++++++++++++++++++++++-----
 SDL.spec                             |    7 ++-
 2 files changed, 86 insertions(+), 16 deletions(-)
---
diff --git a/SDL-1.2.14-Define__XGetRequest.patch b/SDL-1.2.14-Define__XGetRequest.patch
index aa126e2..a45cf8c 100644
--- a/SDL-1.2.14-Define__XGetRequest.patch
+++ b/SDL-1.2.14-Define__XGetRequest.patch
@@ -1,14 +1,81 @@
-libX11 declares extern _XGetRequest() since 1.4.99.1. SDL needs to define it
-to hide it from run-time linker.
-
-diff -r 6f013dd0add1 src/video/x11/SDL_x11sym.h
---- a/src/video/x11/SDL_x11sym.h	Mon Jan 16 14:27:47 2012 -0500
-+++ b/src/video/x11/SDL_x11sym.h	Tue Jan 17 14:40:44 2012 +0100
-@@ -118,6 +118,7 @@
- SDL_X11_SYM(void,_XEatData,(Display* a,unsigned long b),(a,b),)
- SDL_X11_SYM(void,_XFlush,(Display* a),(a),)
- SDL_X11_SYM(void,_XFlushGCCache,(Display* a,GC b),(a,b),)
-+SDL_X11_SYM(void *,_XGetRequest,(Display* a,CARD8 b,size_t c),(a,b,c),)
- SDL_X11_SYM(int,_XRead,(Display* a,char* b,long c),(a,b,c),return)
- SDL_X11_SYM(void,_XReadPad,(Display* a,char* b,long c),(a,b,c),)
- SDL_X11_SYM(void,_XSend,(Display* a,_Xconst char* b,long c),(a,b,c),)
+From f315bacd5d71f51b73561877c874327752cebe05 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 19 Jan 2012 11:16:58 +0100
+Subject: [PATCH] Add dynamic symbol for _XGetRequest, which libX11 1.4.99.1
+ added.
+
+Rebase for 1.2.14. Fixes SDL bug #1376, RH bug #782251.
+
+From:
+User Ryan C. Gordon <icculus at icculus.org>
+Date 1326873803 18000
+Branch SDL-1.2
+Node ID e1264a758d5030fa9ffe9904e6eefd2c38098f5b
+Parent  6f013dd0add1c6809aeab04e306892198a207616
+---
+ src/video/x11/SDL_x11dyn.c |   24 ++++++++++++++++++++++++
+ src/video/x11/SDL_x11sym.h |    6 ++++++
+ 2 files changed, 30 insertions(+), 0 deletions(-)
+
+diff --git a/src/video/x11/SDL_x11dyn.c b/src/video/x11/SDL_x11dyn.c
+index 4e549b3..a7e800e 100644
+--- a/src/video/x11/SDL_x11dyn.c
++++ b/src/video/x11/SDL_x11dyn.c
+@@ -109,6 +109,21 @@ char *(*pXGetICValues)(XIC, ...) = NULL;
+ #undef SDL_X11_SYM
+ 
+ 
++static void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len)
++{
++	xReq *req;
++	WORD64ALIGN
++	if (dpy->bufptr + len > dpy->bufmax)
++		_XFlush(dpy);
++	dpy->last_req = dpy->bufptr;
++	req = (xReq*)dpy->bufptr;
++	req->reqType = type;
++	req->length = len / 4;
++	dpy->bufptr += len;
++	dpy->request++;
++	return req;
++}
++
+ static int x11_load_refcount = 0;
+ 
+ void SDL_X11_UnloadSymbols(void)
+@@ -168,6 +183,15 @@ int SDL_X11_LoadSymbols(void)
+ 		X11_GetSym("XGetICValues",&SDL_X11_HAVE_UTF8,(void **)&pXGetICValues);
+ 		#endif
+ 
++		/*
++		 * In case we're built with newer Xlib headers, we need to make sure
++		 *  that _XGetRequest() is available, even on older systems.
++		 *  Otherwise, various Xlib macros we use will call a NULL pointer.
++		 */
++		if (!SDL_X11_HAVE_XGETREQUEST) {
++			p_XGetRequest = SDL_XGetRequest_workaround;
++		}
++
+ 		if (SDL_X11_HAVE_BASEXLIB) {  /* all required symbols loaded. */
+ 			SDL_ClearError();
+ 		} else {
+diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h
+index 3dfa146..f1e7841 100644
+--- a/src/video/x11/SDL_x11sym.h
++++ b/src/video/x11/SDL_x11sym.h
+@@ -170,6 +170,12 @@ SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,
+ #endif
+ 
+ /*
++ * libX11 1.4.99.1 added _XGetRequest, and macros use it behind the scenes.
++ */
++SDL_X11_MODULE(XGETREQUEST)
++SDL_X11_SYM(void *,_XGetRequest,(Display* a,CARD8 b,size_t c),(a,b,c),return)
++
++/*
+  * These only show up on some variants of Unix.
+  */
+ #if defined(__osf__)
+-- 
+1.7.7.5
+
diff --git a/SDL.spec b/SDL.spec
index 93fb05f..d74b0de 100644
--- a/SDL.spec
+++ b/SDL.spec
@@ -1,7 +1,7 @@
 Summary: A cross-platform multimedia library
 Name: SDL
 Version: 1.2.14
-Release: 15%{?dist}
+Release: 16%{?dist}
 # Source: http://www.libsdl.org/release/%%{name}-%%{version}.tar.gz
 # To create the repackaged archive use ./repackage.sh %%{version}
 Source0: %{name}-%{version}_repackaged.tar.gz
@@ -26,7 +26,7 @@ Patch7: SDL-1.2.14-SDL_BlitCopyOverlap_memcpy.patch
 Patch8: SDL-1.2.14-nasm-2.09-compat.patch
 # Rejected by upstream as sdl1155, rh480065
 Patch9: SDL-1.2.10-GrabNotViewable.patch
-# Restore compatibility with libX11-1.4.99.1, submitted as sdl1376, rh782251
+# Restore compatibility with libX11-1.4.99.1, in upstream, sdl1376, rh782251
 Patch10: SDL-1.2.14-Define__XGetRequest.patch
 
 URL: http://www.libsdl.org/
@@ -154,6 +154,9 @@ rm -rf %{buildroot}
 %{_libdir}/lib*.a
 
 %changelog
+* Thu Jan 19 2012 Petr Pisar <ppisar at redhat.com> - 1.2.14-16
+- Replace my patch with upstream one (bug #782251)
+
 * Tue Jan 17 2012 Petr Pisar <ppisar at redhat.com> - 1.2.14-15
 - Restore compatibility with libX11-1.4.99.1 (bug #782251)
 


More information about the scm-commits mailing list