shithub: mp3dec

Download patch

ref: bbf3fda5a0f1fed28c59a619cf858792a32d20a1
parent: 3f3bff3cee806c1884fa13fd829d2ec5089cfcfa
author: lieff <[email protected]>
date: Sat Feb 17 12:18:20 EST 2018

fix clang -Wcast-align

--- a/minimp3.h
+++ b/minimp3.h
@@ -1297,7 +1297,7 @@
         if (k > n - 3)
         {
 #if HAVE_SSE
-#define VSAVE2(i, v) _mm_storel_pi((__m64 *)&y[i*18], v)
+#define VSAVE2(i, v) _mm_storel_pi((__m64 *)(void*)&y[i*18], v)
 #else
 #define VSAVE2(i, v) vst1_f32((float32_t *)&y[i*18],  vget_low_f32(v))
 #endif
--- a/minimp3_test.c
+++ b/minimp3_test.c
@@ -19,14 +19,14 @@
     unsigned long nAvgBytesPerSec = bips*ch*hz >> 3;
     unsigned int nBlockAlign      = bips*ch >> 3;
 
-    *(int *  )(hdr + 0x04) = 44 + data_bytes - 8;   /* File size - 8 */
-    *(short *)(hdr + 0x14) = 1;                     /* Integer PCM format */
-    *(short *)(hdr + 0x16) = ch;
-    *(int *  )(hdr + 0x18) = hz;
-    *(int *  )(hdr + 0x1C) = nAvgBytesPerSec;
-    *(short *)(hdr + 0x20) = nBlockAlign;
-    *(short *)(hdr + 0x22) = bips;
-    *(int *  )(hdr + 0x28) = data_bytes;
+    *(int *  )(void*)(hdr + 0x04) = 44 + data_bytes - 8;   /* File size - 8 */
+    *(short *)(void*)(hdr + 0x14) = 1;                     /* Integer PCM format */
+    *(short *)(void*)(hdr + 0x16) = ch;
+    *(int *  )(void*)(hdr + 0x18) = hz;
+    *(int *  )(void*)(hdr + 0x1C) = nAvgBytesPerSec;
+    *(short *)(void*)(hdr + 0x20) = nBlockAlign;
+    *(short *)(void*)(hdr + 0x22) = bips;
+    *(int *  )(void*)(hdr + 0x28) = data_bytes;
     return hdr;
 }
 #endif
@@ -72,7 +72,7 @@
                 total_samples += samples*info.channels;
                 for (i = 0; i < samples*info.channels; i++)
                 {
-                    int MSEtemp = abs((int)pcm[i] - (int)(((short*)buf_ref)[i]));
+                    int MSEtemp = abs((int)pcm[i] - (int)(((short*)(void*)buf_ref)[i]));
                     if (MSEtemp > maxdiff)
                         maxdiff = MSEtemp;
                     MSE += (float)MSEtemp*(float)MSEtemp;