From ae26c46dbe9c34a106b070fd4b511581b530f82f Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 27 May 2022 14:11:10 +0300
Subject: [PATCH] IMG_stb.c, stb_image.h: fixed some of the -Wunused-function
warnings .
---
IMG_stb.c | 5 ++++-
stb_image.h | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/IMG_stb.c b/IMG_stb.c
index e9dbf8bd..47788c2e 100644
--- a/IMG_stb.c
+++ b/IMG_stb.c
@@ -47,6 +47,9 @@
#define STBI_NO_STDIO
#define STBI_ONLY_PNG
#define STBI_ONLY_JPEG
+#define STBI_NO_GIF
+#define STBI_NO_HDR
+#define STBI_NO_LINEAR
#define STBI_ASSERT SDL_assert
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
@@ -140,7 +143,7 @@ SDL_Surface *IMG_LoadSTB_RW(SDL_RWops *src)
);
if ( !surface ) {
/* The error message should already be set */
- SDL_free(pixels);
+ stbi_image_free(pixels); /* calls SDL_free() */
SDL_RWseek(src, start, RW_SEEK_SET);
} else {
/* FIXME: This sucks. It'd be better to allocate the surface first, then
diff --git a/stb_image.h b/stb_image.h
index 062b6780..23426dbf 100644
--- a/stb_image.h
+++ b/stb_image.h
@@ -1378,10 +1378,12 @@ STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; }
STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; }
#endif
+#ifndef STBI_NO_HDR
static float stbi__h2l_gamma_i=1.0f/2.2f, stbi__h2l_scale_i=1.0f;
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; }
STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; }
+#endif
//////////////////////////////////////////////////////////////////////////////