From 6809eaff61c8aaf779b26eb8692f4f734e6076e0 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 27 May 2022 20:10:24 +0300
Subject: [PATCH] miniz: disable unaligned stores to avoid strict aliasing
warnings.
mainstream miniz disabled it by default recently, too .
---
IMG_png.c | 1 +
miniz.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/IMG_png.c b/IMG_png.c
index b5c6082..6ab0aa7 100644
--- a/IMG_png.c
+++ b/IMG_png.c
@@ -695,6 +695,7 @@ static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freed
#else
#define MINIZ_LITTLE_ENDIAN 0
#endif
+#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
#define MINIZ_SDL_NOUNUSED
#include "miniz.h"
diff --git a/miniz.h b/miniz.h
index 76f51cb..b213c4e 100644
--- a/miniz.h
+++ b/miniz.h
@@ -230,10 +230,12 @@
#endif
#endif /**/
+#ifndef MINIZ_USE_UNALIGNED_LOADS_AND_STORES
#if MINIZ_X86_OR_X64_CPU
// Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses.
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
#endif
+#endif /**/
#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
// Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions).