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

List:       kde
Subject:    kmidi patches for FreeBSD 3.0 (and probably 2.x)
From:       Kevin Street <street () iname ! com>
Date:       1998-05-28 3:26:21
[Download RAW message or body]

I sent these patches to Bernd Wuebben a couple of weeks ago, but I have
not heard back from him yet - perhaps he's busy or travelling.  So for any
FreeBSD users who are keeping up with the KDE cvs sources and want to use
kmidi, here are some patches to make it work.  The version in cvs will
compile and start, but crashes immediately when it tries to load a file.

The main problem is that LITTLE_ENDIAN doesn't get defined in
kde/kdemultimedia/kmidi/config.h so kmidi exits immediately when it
misunderstands the midi or patch file and tries to allocate a large
negative amount of memory.

The changes to the LE_SHORT and LE_LONG macros appear to be just
optimizations for FreeBSD.

I stole these patches from the timidity port on FreeBSD.

Index: config.h
===================================================================
RCS file: /usr/home/cvs/cvsroot/kde/kdemultimedia/kmidi/config.h,v
retrieving revision 1.4
diff -u -u -r1.4 config.h
--- config.h	1998/01/11 00:05:35	1.4
+++ config.h	1998/05/14 21:35:22
@@ -228,6 +228,22 @@
 # endif        
 #endif /* linux */
 
+#ifdef __FreeBSD__
+#include <errno.h>
+#include <machine/endian.h>
+#if BYTE_ORDER == LITTLE_ENDIAN
+#undef BIG_ENDIAN
+#undef PDP_ENDIAN
+#elif BYTE_ORDER == BIG_ENDIAN
+#undef LITTLE_ENDIAN
+#undef PDP_ENDIAN
+#else
+# error No valid byte sex defined
+#endif
+#define USE_LDEXP
+#define PI M_PI
+#endif /* __FreeBSD__ */
+
 /* Win32 on Intel machines */
 #ifdef __WIN32__
 #  define LITTLE_ENDIAN
@@ -265,13 +281,23 @@
 #ifdef LITTLE_ENDIAN
 #define LE_SHORT(x) x
 #define LE_LONG(x) x
+#ifdef __FreeBSD__
+#define BE_SHORT(x) __byte_swap_word(x)
+#define BE_LONG(x) __byte_swap_long(x)
+#else
 #define BE_SHORT(x) XCHG_SHORT(x)
 #define BE_LONG(x) XCHG_LONG(x)
+#endif
 #else
 #define BE_SHORT(x) x
 #define BE_LONG(x) x
+#ifdef __FreeBSD__
+#define LE_SHORT(x) __byte_swap_word(x)
+#define LE_LONG(x) __byte_swap_long(x)
+#else
 #define LE_SHORT(x) XCHG_SHORT(x)
 #define LE_LONG(x) XCHG_LONG(x)
+#endif
 #endif
 
 #define MAX_AMPLIFICATION 800

--
Kevin Street
street@iName.com

-- 
Send posts to:  kde@lists.netcentral.net
 Send all commands to:  kde-request@lists.netcentral.net
  Put your command in the SUBJECT of the message:
   "subscribe", "unsubscribe", "set digest on", or "set digest off"
**********************************************************************
This list is from your pals at NetCentral <http://www.netcentral.net/>

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

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