[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    Bug#24994: [PATCH] No _SEM_SEMUN_UNDEFINED on Solaris
From:       Rob Napier <rnapier () employees ! org>
Date:       2001-04-30 14:08:12
[Download RAW message or body]

Package: kdemultimedia
Version: CVS

Parts of kdemultimedia rely on _SEM_SEMUN_UNDEFINED from sys/sem.h.
Solaris doesn't define this macro (seems an odd way to do it to me,
actually; setting a macro to say you *don't* define something....)

Anyway, here's a tentative patch to fix it. It tries to go to the
heart of the problem and actually check whether semun is defined or
not.

Rob

? config.site
? mpg123_artsplugin/mpg123PlayObject_impl.loT
Index: kmidi/ctl.cpp
===================================================================
RCS file: /home/projects/kdecvs/cvsroot/kdemultimedia/kmidi/ctl.cpp,v
retrieving revision 1.19
diff -u -3 -p -r1.19 ctl.cpp
--- kmidi/ctl.cpp	2001/01/19 09:17:50	1.19
+++ kmidi/ctl.cpp	2001/04/25 15:16:20
@@ -61,7 +61,7 @@
 #include "ctl.h"
 
 #ifdef NOW_USING_SEMAPHORES
-#ifdef _SEM_SEMUN_UNDEFINED
+#ifndef HAVE_SEMUN
    union semun
    {
      int val;
Index: mpg123_artsplugin/configure.in.in
===================================================================
RCS file: /home/projects/kdecvs/cvsroot/kdemultimedia/mpg123_artsplugin/configure.in.in,v
retrieving revision 1.8
diff -u -3 -p -r1.8 configure.in.in
--- mpg123_artsplugin/configure.in.in	2001/04/04 10:58:52	1.8
+++ mpg123_artsplugin/configure.in.in	2001/04/25 15:16:21
@@ -44,3 +44,18 @@ if test "$kde_mpeglib_compiles" = "yes"
 then
 DO_NOT_COMPILE="$DO_NOT_COMPILE mpg123_artsplugin"
 fi
+
+AC_CACHE_CHECK([for union semun],ac_cv_struct_semun,[
+   AC_TRY_COMPILE([
+   #include <sys/sem.h>
+   ],
+   [
+   union semun semdat;
+   ],
+   ac_cv_struct_semun="yes",
+   ac_cv_struct_semun="no")
+])
+
+if test $ac_cv_struct_semun = "yes"; then
+   AC_DEFINE(HAVE_SEMUN,1,[Define if sys/sem.h defines union semun])
+fi;
Index: mpg123_artsplugin/dxhead.c
===================================================================
RCS file: /home/projects/kdecvs/cvsroot/kdemultimedia/mpg123_artsplugin/dxhead.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 dxhead.c
--- mpg123_artsplugin/dxhead.c	2001/04/20 07:39:59	1.1
+++ mpg123_artsplugin/dxhead.c	2001/04/25 15:16:21
@@ -242,7 +242,7 @@ int mpg123_stream_check_for_xing_header(
 
 	lseek(rd->filept, -(fr->framesize + 4), SEEK_CUR);
 	head_data = malloc(fr->framesize + 4);
-	read(rd->filept,head_data, fr->framesize +4); // now read the rest
+	read(rd->filept,head_data, fr->framesize +4); /* now read the rest */
 	ret = mpg123_get_xing_header(xhead, head_data);
 	free(head_data);
 	return ret;
Index: mpg123_artsplugin/mpg123PlayObject_impl.cpp
===================================================================
RCS file: /home/projects/kdecvs/cvsroot/kdemultimedia/mpg123_artsplugin/mpg123PlayObject_impl.cpp,v
retrieving revision 1.21
diff -u -3 -p -r1.21 mpg123PlayObject_impl.cpp
--- mpg123_artsplugin/mpg123PlayObject_impl.cpp	2001/04/20 21:49:39	1.21
+++ mpg123_artsplugin/mpg123PlayObject_impl.cpp	2001/04/25 15:16:22
@@ -289,6 +289,7 @@ mpg123PlayObject_impl::mpg123PlayObject_
 	prgName = strdup("arts/mpg123");
 	prgVersion = strdup("$Revision: 1.21 $");
 	pcm_point = 0;
+	pcm_buf=new unsigned char[16384*2+1024*2];
 	pcm_sample=pcm_buf; // just point this to our internal buffer
 	memset(&param, 0, sizeof(struct parameter));
 	param.halfspeed = 0;
@@ -321,6 +322,7 @@ mpg123PlayObject_impl::~mpg123PlayObject
 	arts_debug("removing IPC resources");
 	semctl(buflen_sem,0,IPC_RMID,semdat);
 	shmdt(shm_buf);
+	delete[] pcm_buf;
 }
 
 bool mpg123PlayObject_impl::loadMedia(const string &filename)
Index: mpg123_artsplugin/mpg123PlayObject_impl.h
===================================================================
RCS file: /home/projects/kdecvs/cvsroot/kdemultimedia/mpg123_artsplugin/mpg123PlayObject_impl.h,v
retrieving revision 1.7
diff -u -3 -p -r1.7 mpg123PlayObject_impl.h
--- mpg123_artsplugin/mpg123PlayObject_impl.h	2001/04/20 21:49:39	1.7
+++ mpg123_artsplugin/mpg123PlayObject_impl.h	2001/04/25 15:16:22
@@ -1,7 +1,9 @@
 #ifndef MPG123PLAYER_IMPL_H
 #define MPG123PLAYER_IMPL_H "$Id: mpg123PlayObject_impl.h,v 1.7 2001/04/20 21:49:39 puetzk Exp $"
 
-#if (defined(__GNU_LIBRARY__) && defined(_SEM_SEMUN_UNDEFINED)) || defined(__osf__)
+#include <config.h>
+
+#ifndef HAVE_SEMUN
 /* union semun is defined by including <sys/sem.h> */
 /* according to X/OPEN we have to define it ourselves */
 union semun {
@@ -101,7 +103,7 @@ class mpg123PlayObject_impl
 	} *shm_buf;
 	int shm_id, child_pid;
 	int buflen_sem;
-	unsigned char pcm_buf[16384*2+1024*2];
+	unsigned char *pcm_buf;
 };
 
 };
Index: oggvorbis_artsplugin/oggPlayObject_impl.h
===================================================================
RCS file: /home/projects/kdecvs/cvsroot/kdemultimedia/oggvorbis_artsplugin/oggPlayObject_impl.h,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 oggPlayObject_impl.h
--- oggvorbis_artsplugin/oggPlayObject_impl.h	2001/04/05 09:19:02	1.1.1.1
+++ oggvorbis_artsplugin/oggPlayObject_impl.h	2001/04/25 15:16:23
@@ -1,7 +1,9 @@
 #ifndef OGGPLAYER_IMPL_H
 #define OGGPLAYER_IMPL_H "$Id: oggPlayObject_impl.h,v 1.1.1.1 2001/04/05 09:19:02 garbanzo Exp $"
 
-#if defined(__GNU_LIBRARY__) && defined(_SEM_SEMUN_UNDEFINED)
+#include <config.h>
+
+#ifndef HAVE_SEMUN
 /* union semun is defined by including <sys/sem.h> */
 /* according to X/OPEN we have to define it ourselves */
 union semun {


----- End forwarded message -----

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic