shithub: sox

Download patch

ref: c86e649b0b53d78afe9ea808a0d793306f36fc3f
parent: e5244758e86ad4e5c6732a235beadd9b839005fb
author: rrt <rrt>
date: Sun Apr 15 11:00:35 EDT 2007

Fix automatic setting of reverse_bytes on big-endian machines: in
fact, the setting should depend only on the file format, not on the
machine type, as bytes are already swapped on big-endian machines, so
the setting needs to cancel it out there; on little-endian machines,
bytes should be swapped for big-endian formats (and not by default),
so it works there too.

--- a/src/soxio.c
+++ b/src/soxio.c
@@ -29,7 +29,10 @@
 {
   if (ft->signal.reverse_bytes == SOX_OPTION_DEFAULT) {
     if (ft->h->flags & SOX_FILE_ENDIAN)
-      ft->signal.reverse_bytes = SOX_IS_LITTLEENDIAN != !(ft->h->flags & SOX_FILE_ENDBIG);
+      /* 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->h->flags & SOX_FILE_ENDBIG) != 0;
     else
       ft->signal.reverse_bytes = SOX_OPTION_NO;
   }