Make this package build on big-endian systems that don't run Linux. Problem

pointed out by dmcmahill.
This commit is contained in:
ad 2000-08-22 14:07:53 +00:00
parent daa4c98202
commit 4d2efff6df
4 changed files with 238 additions and 1 deletions

View file

@ -1,4 +1,7 @@
$NetBSD: patch-sum,v 1.2 2000/08/22 13:35:05 dmcmahill Exp $
$NetBSD: patch-sum,v 1.3 2000/08/22 14:07:53 ad Exp $
MD5 (patch-aa) = 89c938ce663310de4829d5acefd57dd6
MD5 (patch-ab) = 50237b8bc1e3b651854f6ee20d106665
MD5 (patch-ac) = 73eca84d0c25a1a259efd46fbdafdc5b
MD5 (patch-ad) = ffe36559d56eb9a556b26c0bebd59c57
MD5 (patch-ae) = 07ea4db616a78c4d631a417882815a85

View file

@ -0,0 +1,114 @@
$NetBSD: patch-ac,v 1.1 2000/08/22 14:07:54 ad Exp $
--- lib/librio500.c.orig Tue Aug 22 14:52:30 2000
+++ lib/librio500.c Tue Aug 22 14:55:42 2000
@@ -24,7 +24,7 @@
#include "libfon.h"
#ifdef WORDS_BIGENDIAN
-#include <byteswap.h>
+#include <sys/bswap.h>
#endif
void
@@ -55,9 +55,9 @@
need to byteswap to get to le */
#ifdef WORDS_BIGENDIAN
- location.offset = bswap_16(location.offset);
- location.bytes = bswap_16(location.bytes);
- location.folder_num = bswap_16(location.folder_num);
+ location.offset = bswap16(location.offset);
+ location.bytes = bswap16(location.bytes);
+ location.folder_num = bswap16(location.folder_num);
#endif
rio_ctl_msg (fd, RIO_DIR_OUT, 0x56, 0, 0,
@@ -87,13 +87,13 @@
to read correctly */
#ifdef WORDS_BIGENDIAN
- status.dunno1 = bswap_16(status.dunno1);
- status.block_size = bswap_16(status.block_size);
- status.num_blocks = bswap_16(status.num_blocks);
- status.first_free_block = bswap_16(status.first_free_block);
- status.num_unused_blocks = bswap_16(status.num_unused_blocks);
- status.dunno2 = bswap_32(status.dunno2);
- status.dunno3 = bswap_32(status.dunno3);
+ status.dunno1 = bswap16(status.dunno1);
+ status.block_size = bswap16(status.block_size);
+ status.num_blocks = bswap16(status.num_blocks);
+ status.first_free_block = bswap16(status.first_free_block);
+ status.num_unused_blocks = bswap16(status.num_unused_blocks);
+ status.dunno2 = bswap32(status.dunno2);
+ status.dunno3 = bswap32(status.dunno3);
#endif
return &status;
@@ -476,25 +476,25 @@
void
bswap_folder_entry (folder_entry *fe)
{
- fe->offset = bswap_16(fe->offset);
- fe->dunno1 = bswap_16(fe->dunno1);
- fe->fst_free_entry_off = bswap_16(fe->fst_free_entry_off);
- fe->dunno2 = bswap_16(fe->dunno2);
- fe->dunno3 = bswap_32(fe->dunno3);
- fe->dunno4 = bswap_32(fe->dunno4);
- fe->time = bswap_32(fe->time);
+ fe->offset = bswap16(fe->offset);
+ fe->dunno1 = bswap16(fe->dunno1);
+ fe->fst_free_entry_off = bswap16(fe->fst_free_entry_off);
+ fe->dunno2 = bswap16(fe->dunno2);
+ fe->dunno3 = bswap32(fe->dunno3);
+ fe->dunno4 = bswap32(fe->dunno4);
+ fe->time = bswap32(fe->time);
}
void
bswap_song_entry (song_entry *se)
{
- se->offset = bswap_16(se->offset);
- se->dunno1 = bswap_16(se->dunno1);
- se->length = bswap_32(se->length);
- se->dunno2 = bswap_16(se->dunno2);
- se->dunno3 = bswap_16(se->dunno3);
- se->mp3sig = bswap_32(se->mp3sig);
- se->time = bswap_32(se->time);
+ se->offset = bswap16(se->offset);
+ se->dunno1 = bswap16(se->dunno1);
+ se->length = bswap32(se->length);
+ se->dunno2 = bswap16(se->dunno2);
+ se->dunno3 = bswap16(se->dunno3);
+ se->mp3sig = bswap32(se->mp3sig);
+ se->time = bswap32(se->time);
}
@@ -662,7 +662,7 @@
rio_ctl_msg (fd, RIO_DIR_IN, req, val, idx, 4, (BYTE*)&status);
#ifdef WORDS_BIGENDIAN
- status = bswap_32 (status);
+ status = bswap32 (status);
#endif
return status;
@@ -740,7 +740,7 @@
/* on big_endian platforms, need to byteswap num_blocks to write to le rio */
#ifdef WORDS_BIGENDIAN
- new_smiley->num_blocks = bswap_16(new_smiley->num_blocks);
+ new_smiley->num_blocks = bswap16(new_smiley->num_blocks);
#endif
return new_smiley;
@@ -802,7 +802,7 @@
transfer to rio */
#ifdef WORDS_BIGENDIAN
- new_bitmap->num_blocks = bswap_16(new_bitmap->num_blocks);
+ new_bitmap->num_blocks = bswap16(new_bitmap->num_blocks);
#endif
return new_bitmap;

View file

@ -0,0 +1,85 @@
$NetBSD: patch-ad,v 1.1 2000/08/22 14:07:54 ad Exp $
--- lib/libfon.c.orig Tue Aug 22 14:54:21 2000
+++ lib/libfon.c Tue Aug 22 14:54:35 2000
@@ -23,7 +23,7 @@
#include "libfon.h"
#ifdef WORDS_BIGENDIAN
-#include <byteswap.h>
+#include <sys/bswap.h>
#endif
struct fon_font *
@@ -61,9 +61,9 @@
fread (&MZ_hdr, sizeof (MZ_Header), 1, fp);
#ifdef WORDS_BIGENDIAN
- MZ_hdr.magic = bswap_16(MZ_hdr.magic);
- MZ_hdr.dummy[29] = bswap_16(MZ_hdr.dummy[29]);
- //MZ_hdr.ne_location = bswap_16(MZ_hdr.ne_location);
+ MZ_hdr.magic = bswap16(MZ_hdr.magic);
+ MZ_hdr.dummy[29] = bswap16(MZ_hdr.dummy[29]);
+ //MZ_hdr.ne_location = bswap16(MZ_hdr.ne_location);
#endif
/* ne_location is a 16bit quantity,l_e. It appears fseek below wants
@@ -82,15 +82,15 @@
fread (&NE_hdr, sizeof (NE_Header), 1, fp);
#ifdef WORDS_BIGENDIAN
- NE_hdr.magic = bswap_16(NE_hdr.magic);
- NE_hdr.dummy1[15] = bswap_16(NE_hdr.dummy1[15]);
+ NE_hdr.magic = bswap16(NE_hdr.magic);
+ NE_hdr.dummy1[15] = bswap16(NE_hdr.dummy1[15]);
- //NE_hdr.nonres_name_length = bswap_16(NE_hdr.nonres_name_length);
+ //NE_hdr.nonres_name_length = bswap16(NE_hdr.nonres_name_length);
/* fseek seems to like l_e quantities */
/* Ok . . I'm an idiot, nonres_name_start was 32bit, can use bswap */
- NE_hdr.nonres_name_start=bswap_32(NE_hdr.nonres_name_start);
+ NE_hdr.nonres_name_start=bswap32(NE_hdr.nonres_name_start);
#endif
if (NE_hdr.magic != NE_HEADER_MAGIC ) {
@@ -119,7 +119,7 @@
fread(&number_of_fonts, 2, 1, fp);
#ifdef WORDS_BIGENDIAN
- number_of_fonts = bswap_32(number_of_fonts);
+ number_of_fonts = bswap32(number_of_fonts);
#endif
/* font info stored in 32bit 32bit 32bit l_e format for win fonts */
/* need to swap to use on ppc */
@@ -181,13 +181,13 @@
/* Do any sort of byte swapping necessary for big endian after reading data */
#ifdef WORDS_BIGENDIAN
- font->Header[i].Windows_version = bswap_16(font->Header[i].Windows_version);
- font->Header[i].Bytes_per_char_cell = bswap_16(font->Header[i].Bytes_per_char_cell);
- font->Header[i].File_sizeH = bswap_16(font->Header[i].File_sizeH);
- font->Header[i].File_sizeL = bswap_16(font->Header[i].File_sizeL);
- font->Header[i].Nominal_point_size = bswap_16(font->Header[i].Nominal_point_size);
- font->Header[i].Vertical_resolution = bswap_16(font->Header[i].Vertical_resolution);
- font->Header[i].Horizontal_resolution = bswap_16(font->Header[i].Horizontal_resolution);
+ font->Header[i].Windows_version = bswap16(font->Header[i].Windows_version);
+ font->Header[i].Bytes_per_char_cell = bswap16(font->Header[i].Bytes_per_char_cell);
+ font->Header[i].File_sizeH = bswap16(font->Header[i].File_sizeH);
+ font->Header[i].File_sizeL = bswap16(font->Header[i].File_sizeL);
+ font->Header[i].Nominal_point_size = bswap16(font->Header[i].Nominal_point_size);
+ font->Header[i].Vertical_resolution = bswap16(font->Header[i].Vertical_resolution);
+ font->Header[i].Horizontal_resolution = bswap16(font->Header[i].Horizontal_resolution);
#endif
}
@@ -231,7 +231,7 @@
(void)fread(&bitmap_start_offset, 2, 1, fp);
#ifdef WORDS_BIGENDIAN
- bitmap_start_offset = bswap_32(bitmap_start_offset);
+ bitmap_start_offset = bswap32(bitmap_start_offset);
#endif
/* b_s_off comes out of .fon in l_e, need to convert */

View file

@ -0,0 +1,35 @@
$NetBSD: patch-ae,v 1.1 2000/08/22 14:07:54 ad Exp $
--- lib/usbdrvlinux.c.orig Tue Aug 22 14:58:45 2000
+++ lib/usbdrvlinux.c Tue Aug 22 14:59:00 2000
@@ -54,7 +54,7 @@
#include <dirent.h>
#ifdef WORDS_BIGENDIAN
-# include <byteswap.h>
+# include <sys/bswap.h>
#endif
#if TIME_WITH_SYS_TIME
@@ -200,8 +200,8 @@
pid = desc.idProduct[0] | (desc.idProduct[1] << 8);
#ifdef WORDS_BIGENDIAN
- vid = bswap_16(vid);
- pid = bswap_16(pid);
+ vid = bswap16(vid);
+ pid = bswap16(pid);
#endif
if ((vid != vendorid && vendorid == -1) ||
@@ -270,8 +270,8 @@
pid = desc.idProduct[0] | (desc.idProduct[1] << 8);
#ifdef WORDS_BIGENDIAN
- vid = bswap_16(vid);
- pid = bswap_16(pid);
+ vid = bswap16(vid);
+ pid = bswap16(pid);
#endif
if ((vid == vendorid || vendorid == 0xffff) &&