summaryrefslogtreecommitdiff
path: root/lib/libXvMC/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2020-01-04 17:57:41 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2020-01-04 17:57:41 +0000
commit82f504c5d200839ea81f6f47b4978fa1e9476d5a (patch)
tree3675d7b65438dc6ee9329b72bcc77c6d5028ecc8 /lib/libXvMC/src
parent4002ec1461f03ce091011924a43249e2ade6034a (diff)
Update to libXvMC 1.0.12. Tested by krw@ and naddy@
Diffstat (limited to 'lib/libXvMC/src')
-rw-r--r--lib/libXvMC/src/XvMC.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/libXvMC/src/XvMC.c b/lib/libXvMC/src/XvMC.c
index 3ee4212cf..76a855226 100644
--- a/lib/libXvMC/src/XvMC.c
+++ b/lib/libXvMC/src/XvMC.c
@@ -117,7 +117,7 @@ XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num)
if(surface_info) {
xvmcSurfaceInfo sinfo;
- int i;
+ CARD32 i;
*num = rep.num;
@@ -178,7 +178,7 @@ XvImageFormatValues * XvMCListSubpictureTypes (
if(ret) {
xvImageFormatInfo Info;
- int i;
+ CARD32 i;
*count_return = rep.num;
@@ -491,6 +491,7 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port,
CARD32 magic;
#ifdef HAVE_SHMAT
+ int shmKey;
volatile CARD32 *shMem;
struct timezone here;
struct timeval now;
@@ -510,7 +511,8 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port,
magic = 0;
req->magic = 0;
#ifdef HAVE_SHMAT
- req->shmKey = shmget(IPC_PRIVATE, 1024, IPC_CREAT | 0600);
+ shmKey = shmget(IPC_PRIVATE, 1024, IPC_CREAT | 0600);
+ req->shmKey = (CARD32) shmKey;
/*
* We fill a shared memory page with a repetitive pattern. If the
@@ -521,10 +523,10 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port,
* otherwise stupid-looking pattern algorithm.
*/
- if (req->shmKey >= 0) {
- shMem = (CARD32 *) shmat(req->shmKey, NULL, 0);
- shmctl( req->shmKey, IPC_RMID, NULL);
- if ( shMem ) {
+ if (shmKey >= 0) {
+ shMem = (CARD32 *) shmat(shmKey, NULL, 0);
+ shmctl(shmKey, IPC_RMID, NULL);
+ if (shMem != (void *) -1) {
register volatile CARD32 *shMemC = shMem;
register int i;
@@ -539,6 +541,7 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port,
}
} else {
req->shmKey = -1;
+ shmKey = -1;
}
}
#else
@@ -548,14 +551,16 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port,
UnlockDisplay (dpy);
SyncHandle ();
#ifdef HAVE_SHMAT
- if ( req->shmKey >= 0) {
+ if (shmKey >= 0) {
shmdt( (const void *) shMem );
}
#endif
return -1;
}
#ifdef HAVE_SHMAT
- shmdt( (const void *) shMem );
+ if (shmKey >= 0) {
+ shmdt( (const void *) shMem );
+ }
#endif
if (rep.length > 0) {
@@ -600,7 +605,12 @@ Status XvMCGetDRInfo(Display *dpy, XvPortID port,
*major = rep.major;
*minor = rep.minor;
*patchLevel = rep.patchLevel;
- *isLocal = (req->shmKey > 0) ? rep.isLocal : 1;
+#ifdef HAVE_SHMAT
+ if (shmKey >= 0)
+ *isLocal = rep.isLocal;
+ else
+#endif
+ *isLocal = 1;
return (rep.length > 0) ? Success : BadImplementation;
}