rpms/gt/devel gt-0.4-unsf-bigendian-fix.patch, NONE, 1.1 gt.spec, 1.1, 1.2

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Fri Feb 1 13:16:26 UTC 2008


Author: jwrdegoede

Update of /cvs/extras/rpms/gt/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4399

Modified Files:
	gt.spec 
Added Files:
	gt-0.4-unsf-bigendian-fix.patch 
Log Message:
* Fri Feb  1 2008 Hans de Goede <j.w.r.degoede at hhs.nl> 0.4-4
- Fix unsf running on big endian systems


gt-0.4-unsf-bigendian-fix.patch:

--- NEW FILE gt-0.4-unsf-bigendian-fix.patch ---
diff -up gt-0.4/utils/unsf.c~ gt-0.4/utils/unsf.c
--- gt-0.4/utils/unsf.c~	2008-02-01 13:41:46.000000000 +0100
+++ gt-0.4/utils/unsf.c	2008-02-01 13:43:18.000000000 +0100
@@ -290,59 +290,6 @@ double bend_coarse[128] = {
  1290.1591550923506, 1366.8760106701147, 1448.1546878700494, 1534.2664467217226
 };
 
-typedef union {
-      unsigned char c[4];
-      unsigned long l;
-} long_end;
-typedef union {
-      unsigned char c[2];
-      unsigned short s;
-} short_end;
-
-static int big_endian = 1;
-
-static long longnum(unsigned char c1, unsigned char c2,
-		unsigned char c3, unsigned char c4)
-{
-    long_end lswitch;
-    if (big_endian) {
-	lswitch.c[0] = c4;
-	lswitch.c[1] = c3;
-	lswitch.c[2] = c2;
-	lswitch.c[3] = c1;
-    } else {
-	lswitch.c[0] = c1;
-	lswitch.c[1] = c2;
-	lswitch.c[2] = c3;
-	lswitch.c[3] = c4;
-    }
-    return(lswitch.l);
-}
-
-static short shortnum(unsigned char c1, unsigned char c2)
-{
-    short_end sswitch;
-    if (big_endian) {
-	sswitch.c[0] = c2;
-	sswitch.c[1] = c1;
-    } else {
-	sswitch.c[0] = c1;
-	sswitch.c[1] = c2;
-    }
-    return(sswitch.s);
-}
-
-static void byteorder(void)
-{   long_end hexx;
-
-    hexx.c[0] = 0x12;
-    hexx.c[1] = 0x34;
-    hexx.c[2] = 0x56;
-    hexx.c[3] = 0x78;
-    if (hexx.l == 0x78563412) big_endian = 0;
-}
-
-
 static char *getname(char *p)
 {
 	int i, j, e;
@@ -425,14 +372,8 @@ static void mem_write8(int val)
 /* writes a word to the memory buffer (little endian) */
 static void mem_write16(int val)
 {
- if (big_endian) {
-   mem_write8((val >> 8) & 0xFF);
-   mem_write8(val & 0xFF);
- }
- else {
    mem_write8(val & 0xFF);
    mem_write8((val >> 8) & 0xFF);
- }
 }
 
 
@@ -440,41 +381,13 @@ static void mem_write16(int val)
 /* writes a long to the memory buffer (little endian) */
 static void mem_write32(int val)
 {
- if (big_endian) {
-   mem_write8((val >> 24) & 0xFF);
-   mem_write8((val >> 16) & 0xFF);
-   mem_write8((val >> 8) & 0xFF);
-   mem_write8(val & 0xFF);
- }
- else {
    mem_write8(val & 0xFF);
    mem_write8((val >> 8) & 0xFF);
    mem_write8((val >> 16) & 0xFF);
    mem_write8((val >> 24) & 0xFF);
- }
-}
-
-
-
-/* alters data already written to the memory buffer (little endian) */
-static void mem_modify32(int pos, int val)
-{
- if (big_endian) {
-   mem[pos+3] = (val >> 24) & 0xFF;
-   mem[pos+2] = (val >> 16) & 0xFF;
-   mem[pos+1] = (val >> 8) & 0xFF;
-   mem[pos] = val & 0xFF;
- }
- else {
-   mem[pos] = val & 0xFF;
-   mem[pos+1] = (val >> 8) & 0xFF;
-   mem[pos+2] = (val >> 16) & 0xFF;
-   mem[pos+3] = (val >> 24) & 0xFF;
- }
 }
 
 
-
 /* writes a block of data the memory buffer */
 static void mem_write_block(void *data, int size)
 {
@@ -3254,9 +3167,6 @@ static int get16(FILE *f)
    b1 = get8(f);
    b2 = get8(f);
 
- if (big_endian)
-   return ((b1 << 8) | b2);
- else
    return ((b2 << 8) | b1);
 }
 
@@ -3272,9 +3182,6 @@ static int get32(FILE *f)
    b3 = get8(f);
    b4 = get8(f);
 
- if (big_endian)
-   return ((b1 << 24) | (b2 << 16) | (b3 << 8) | b4);
- else
    return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
 }
 
@@ -3753,8 +3660,6 @@ int main(int argc, char *argv[])
 
 	opt_soundfont = argv[optind];
 
-	byteorder();
-
 	add_soundfont_patches();
 
 	if (!opt_no_write) fclose(cfg_fd);


Index: gt.spec
===================================================================
RCS file: /cvs/extras/rpms/gt/devel/gt.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gt.spec	30 Jan 2008 21:23:32 -0000	1.1
+++ gt.spec	1 Feb 2008 13:15:44 -0000	1.2
@@ -1,6 +1,6 @@
 Name:           gt
 Version:        0.4
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Modified Timidity which supportes enhanced gus format patches
 Group:          Applications/Multimedia
 License:        GPLv2+
@@ -15,6 +15,7 @@
 Patch2:         gt-0.4-optflags.patch
 Patch3:         gt-0.4-config-default-velocity-layer.patch
 Patch4:         gt-0.4-ppc-compile-fix.patch
+Patch5:         gt-0.4-unsf-bigendian-fix.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  alsa-lib-devel libvorbis-devel
 Requires:       timidity++-patches
@@ -40,6 +41,7 @@
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 cp -p src/README README.timidity
 
 
@@ -79,6 +81,9 @@
 
 
 %changelog
+* Fri Feb  1 2008 Hans de Goede <j.w.r.degoede at hhs.nl> 0.4-4
+- Fix unsf running on big endian systems
+
 * Wed Jan 30 2008 Hans de Goede <j.w.r.degoede at hhs.nl> 0.4-3
 - Correct license field from GPLv2 to GPLv2+
 




More information about the fedora-extras-commits mailing list