shithub: sox

Download patch

ref: 6bd8afa4bf90f959cfe9c2343e510366152c3d75
parent: d9dd5b3c056063b2f7c63cc6a3d3cdf512fe7eac
author: cbagwell <cbagwell>
date: Sun Jul 15 00:47:35 EDT 2007

Get rid of code that needs both soxio and file handlers to both
invert reverse_bytes.  It was confusing me and removing also
fixes a few endian bugs.

--- a/src/soxio.c
+++ b/src/soxio.c
@@ -33,10 +33,15 @@
 {
   if (ft->signal.reverse_bytes == SOX_OPTION_DEFAULT) {
     if (ft->handler->flags & SOX_FILE_ENDIAN)
-      /* Set reverse_bytes for big-endian formats; on a big-endian
-         system this cancels out with the reversal made for being on a
-         big-endian system. */
-      ft->signal.reverse_bytes = (ft->handler->flags & SOX_FILE_ENDBIG) != 0;
+    {
+        /* Set revere_bytes if we are running on opposite endian
+         * machine compared to file format.
+         */
+        if (ft->handler->flags & SOX_FILE_ENDBIG)
+            ft->signal.reverse_bytes = SOX_IS_LITTLEENDIAN;
+        else
+            ft->signal.reverse_bytes = SOX_IS_BIGENDIAN;
+    }
     else
       ft->signal.reverse_bytes = SOX_OPTION_NO;
   }