Re: libdvdread on FreeBSD

H}kan Hjort <[email protected]>
Newsgroups gmane.comp.video.ogle.devel
Message-ID <[email protected]>
Tue Feb 25 2003, Matthew Reimer wrote:
> libdvdread doesn't compile correctly on FreeBSD, I think because of an 
> #ifdef mistake. The following condition in dvdread/bswap.h occurs twice 
> consecutively:
> 
It doesn't.... where did you get this version?

> #elif defined(__FreeBSD__) && __FreeBSD_version >= 470000
> #include <sys/endian.h>
> #define B2N_16(x) x = be16toh(x)
> #define B2N_32(x) x = be32toh(x)
> #define B2N_64(x) x = be64toh(x)
> 

It seems be64toh is only in FreeBSD 5.  Try the attached  patch or
find and remove the _one_ use of B2N_64 ;)

-- 
Håkan Hjort
bswap.patch (text/plain, 995 B)
Index: dvdread/bswap.h
===================================================================
RCS file: /cvsroot/ogle/libdvdread/dvdread/bswap.h,v
retrieving revision 1.8
diff -p -u -d -r1.8 bswap.h
--- dvdread/bswap.h	2002/12/14 23:47:37	1.8
+++ dvdread/bswap.h	2003/02/25 21:40:05
@@ -57,7 +57,19 @@
 #include <sys/endian.h>
 #define B2N_16(x) x = be16toh(x)
 #define B2N_32(x) x = be32toh(x)
+#if __FreeBSD_version >= 500000
 #define B2N_64(x) x = be64toh(x)
+#else
+#define B2N_64(x) \
+ x = ((((x) & 0xff00000000000000) >> 56) | \
+      (((x) & 0x00ff000000000000) >> 40) | \
+      (((x) & 0x0000ff0000000000) >> 24) | \
+      (((x) & 0x000000ff00000000) >>  8) | \
+      (((x) & 0x00000000ff000000) <<  8) | \
+      (((x) & 0x0000000000ff0000) << 24) | \
+      (((x) & 0x000000000000ff00) << 40) | \
+      (((x) & 0x00000000000000ff) << 56))
+#endif /* _FreeBSD_version >= 500000 */
 
 /* This is a slow but portable implementation, it has multiple evaluation 
  * problems so beware.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.