From 9b6d683f4d6bc6bf7da181153e0b233daa6be096 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 13 May 2026 14:53:02 +0300
Subject: [PATCH] IMG_xcf.c (read_string): inline the SDL12_RWsize() code in
there
---
IMG_xcf.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/IMG_xcf.c b/IMG_xcf.c
index d688b5942..c8becfec8 100644
--- a/IMG_xcf.c
+++ b/IMG_xcf.c
@@ -227,22 +227,16 @@ int IMG_isXCF(SDL_RWops *src)
return(is_XCF);
}
-/* SDL-1.2 doesn't have a SDL_RWsize(). sigh... */
-static Sint32 SDLCALL SDL12_RWsize(SDL_RWops *rw) {
- Sint32 pos, size;
- if ((pos=SDL_RWtell(rw))<0) return -1;
- size = SDL_RWseek(rw, 0, RW_SEEK_END);
- SDL_RWseek(rw, pos, RW_SEEK_SET);
- return size;
-}
-
static char * read_string (SDL_RWops * src) {
- Sint32 remaining;
+ Sint32 remaining, pos;
Uint32 tmp;
char * data;
tmp = SDL_ReadBE32 (src);
- remaining = SDL12_RWsize(src) - SDL_RWtell(src);
+ pos = SDL_RWtell (src);
+ remaining = SDL_RWseek(src, 0, RW_SEEK_END) - pos;
+ SDL_RWseek(src, pos, RW_SEEK_SET);
+
if (tmp == 0) {
data = (char *) malloc(1);
if (data) {