shithub: sox

Download patch

ref: 2d5b2941c9b541683937a66e92632461b7edd7fe
parent: b5d46fd0e56a3e302467ed51231a343f202a7917
author: Doug Cook <idigdoug@users.sourceforge.net>
date: Sat Mar 19 22:31:23 EDT 2011

Fix warning for strict aliasing of magic

--- a/src/sox-fmt.c
+++ b/src/sox-fmt.c
@@ -77,8 +77,11 @@
   size_t comments_len = strlen(comments);
   size_t comments_bytes = (comments_len + 7) & ~7u; /* Multiple of 8 bytes */
   uint64_t size   = ft->olength? ft->olength : ft->signal.length;
-  sox_bool error  = sox_false
-  ||lsx_writedw(ft, *(uint32_t *)&magic[MACHINE_IS_BIGENDIAN])
+  int error;
+  uint32_t header;
+  memcpy(&header, magic[MACHINE_IS_BIGENDIAN], sizeof(header));
+  error = 0
+  ||lsx_writedw(ft, header)
   ||lsx_writedw(ft, FIXED_HDR + (unsigned)comments_bytes)
   ||lsx_writeqw(ft, size)
   ||lsx_writedf(ft, ft->signal.rate)