bspatch: Fix compile warnings on Apple Clang 21

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Mon, 29 Jun 2026 23:11:38 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 3d3df07c45d5e818a493b75a6da3df9105aa6b42
Author: Vencislav Atanasov <[email protected]>
Date:   Mon Jun 29 21:30:13 2026 +0300

    bspatch: Fix compile warnings on Apple Clang 21
    
    - signed/unsigned comparisons
    - unambiguous fclose() result code handling
    
    Co-authored-by: ChatGPT (GPT-5.3 Mini) <[email protected]>
    Change-Id: I6c4184ddef39281610de01b5c6ab402450d9a3ec

diff --git a/utils/bspatch/bspatch.c b/utils/bspatch/bspatch.c
index d1d7a5aa7a..fe736213f0 100644
--- a/utils/bspatch/bspatch.c
+++ b/utils/bspatch/bspatch.c
@@ -147,8 +147,8 @@ int apply_bspatch(const char *infile, const char *outfile, const char *patchfile
 	pold = (u_char *)malloc(oldsize + 1);
 	if (pold == NULL)	err(1, "Malloc failed :%s", infile);
 	fseek(fs, 0, SEEK_SET);
-	if (fread(pold, 1, oldsize, fs) == -1)	err(1, "Read failed :%s", infile);
-	if (fclose(fs) == -1)	err(1, "Close failed :%s", infile);
+	if (fread(pold, 1, oldsize, fs) != (size_t)oldsize)	err(1, "Read failed :%s", infile);
+	if (fclose(fs) != 0)	err(1, "Close failed :%s", infile);
 
 	pnew = malloc(newsize + 1);
 	if (pnew == NULL)err(1, NULL);
@@ -208,8 +208,8 @@ int apply_bspatch(const char *infile, const char *outfile, const char *patchfile
 	/* Write the pnew file */
 	fs = fopen(outfile, "wb");
 	if (fs == NULL)err(1, "Create failed :%s", outfile);
-	if (fwrite(pnew, 1, newsize, fs) == -1)err(1, "Write failed :%s", outfile);
-	if (fclose(fs) == -1)err(1, "Close failed :%s", outfile);
+	if (fwrite(pnew, 1, newsize, fs) != (size_t)newsize)err(1, "Write failed :%s", outfile);
+	if (fclose(fs) != 0)err(1, "Close failed :%s", outfile);
 
 	free(pnew);
 	free(pold);
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs