shithub: sox

Download patch

ref: a9ae4914828d1beb5b046db23f20630c22812eec
parent: 4c5aa45bf92cc988aa9d638febe41d92e071c629
author: cbagwell <cbagwell>
date: Mon Jul 9 23:16:33 EDT 2007

Hardcode WAV endian to work on big endian machines.  Ignore
user input for now since we can't tell the difference between
user override and default settings.

--- a/src/au.c
+++ b/src/au.c
@@ -489,7 +489,7 @@
  */
 static sox_format_handler_t sox_au_format = {
   aunames,
-  SOX_FILE_SEEK,
+  SOX_FILE_SEEK | SOX_FILE_BIG_END,
   sox_austartread,
   sox_auread,
   sox_rawstopread,
--- a/src/wav.c
+++ b/src/wav.c
@@ -418,9 +418,13 @@
     /* RIFX is a Big-endian RIFF */
     if (strncmp("RIFX", magic, 4) == 0) 
     {
-        sox_debug("Found RIFX header, swapping bytes");
-        ft->signal.reverse_bytes = !ft->signal.reverse_bytes;
+        sox_debug("Found RIFX header");
+        ft->signal.reverse_bytes = SOX_IS_LITTLEENDIAN;
     }
+    else
+    {
+        ft->signal.reverse_bytes = SOX_IS_BIGENDIAN;
+    }
 
     sox_readdw(ft, &dwRiffLength);
 
@@ -1442,7 +1446,7 @@
     /* If user specified opposite swap than we think, assume they are
      * asking to write a RIFX file.
      */
-    if (ft->signal.reverse_bytes != SOX_IS_BIGENDIAN)
+    if (ft->signal.reverse_bytes && SOX_IS_LITTLEENDIAN)
     {
         if (!second_header)
             sox_report("Requested to swap bytes so writing RIFX header");