detect bad SysMessage format
authornotaz <notasas@gmail.com>
Fri, 4 Oct 2024 23:07:42 +0000 (02:07 +0300)
committernotaz <notasas@gmail.com>
Mon, 7 Oct 2024 22:39:41 +0000 (01:39 +0300)
libpcsxcore/misc.c
libpcsxcore/psxmem.c
libpcsxcore/system.h

index aafe522..d4c886f 100644 (file)
@@ -585,7 +585,7 @@ int Load(const char *ExePath) {
                                                case 0: /* End of file */
                                                        break;
                                                default:
-                                                       SysPrintf(_("Unknown CPE opcode %02x at position %08x.\n"), opcode, ftell(tmpFile) - 1);
+                                                       SysPrintf(_("Unknown CPE opcode %02x at position %08zx.\n"), opcode, ftell(tmpFile) - 1);
                                                        retval = -1;
                                                        break;
                                        }
index ad47259..e08bd89 100644 (file)
@@ -101,7 +101,7 @@ void *psxMap(unsigned long addr, size_t size, int is_fixed,
                        return MAP_FAILED;
 
                if (addr != 0 && ret != (void *)(uintptr_t)addr) {
-                       SysMessage("psxMap: tried to map @%08x, got %p\n",
+                       SysMessage("psxMap: tried to map @%08lx, got %p\n",
                                addr, ret);
                        if (is_fixed) {
                                psxUnmap(ret, size, tag);
index fe4ab40..4e65911 100644 (file)
@@ -26,8 +26,16 @@ extern "C" {
 
 int SysInit();                                                 // Init mem and plugins
 void SysReset();                                               // Resets mem
-void SysPrintf(const char *fmt, ...);  // Printf used by bios syscalls
-void SysMessage(const char *fmt, ...); // Message used to print msg to users
+void SysPrintf(const char *fmt, ...)
+#if defined(__GNUC__) && defined(__x86_64__) // some platforms have int32_t as long
+        __attribute__((format(printf, 1, 2)))
+#endif
+        ;
+void SysMessage(const char *fmt, ...)  // Message used to print msg to users
+#if defined(__GNUC__) && defined(__x86_64__)
+        __attribute__((format(printf, 1, 2)))
+#endif
+        ;
 void *SysLoadLibrary(const char *lib); // Loads Library
 void *SysLoadSym(void *lib, const char *sym);  // Loads Symbol from Library
 const char *SysLibError();                             // Gets previous error loading sysbols