From bd6e048a1e0760c5413d590378c0a7899710a924 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 23 Sep 2023 21:07:31 +0100 Subject: [PATCH] porting recent change on yquake2 here for message based callbacks --- src/common/header/common.h | 10 +++++----- src/common/header/shared.h | 6 +++--- src/common/shared.c | 2 +- src/vk/vk_main.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/common/header/common.h b/src/common/header/common.h index 2d58ade..8d6f3bf 100644 --- a/src/common/header/common.h +++ b/src/common/header/common.h @@ -740,11 +740,11 @@ void FS_CreatePath(char *path); void Com_BeginRedirect(int target, char *buffer, int buffersize, void (*flush)(int, char *)); void Com_EndRedirect(void); -void Com_Printf(char *fmt, ...) PRINTF_ATTR(1, 2); -void Com_DPrintf(char *fmt, ...) PRINTF_ATTR(1, 2); +void Com_Printf(const char *fmt, ...) PRINTF_ATTR(1, 2); +void Com_DPrintf(const char *fmt, ...) PRINTF_ATTR(1, 2); void Com_VPrintf(int print_level, const char *fmt, va_list argptr); /* print_level is PRINT_ALL or PRINT_DEVELOPER */ -void Com_MDPrintf(char *fmt, ...) PRINTF_ATTR(1, 2); -YQ2_ATTR_NORETURN_FUNCPTR void Com_Error(int code, char *fmt, ...) PRINTF_ATTR(2, 3); +void Com_MDPrintf(const char *fmt, ...) PRINTF_ATTR(1, 2); +YQ2_ATTR_NORETURN_FUNCPTR void Com_Error(int code, const char *fmt, ...) PRINTF_ATTR(2, 3); YQ2_ATTR_NORETURN void Com_Quit(void); /* Ugly work around for unsupported @@ -839,7 +839,7 @@ void SV_Frame(int usec); // system.c char *Sys_ConsoleInput(void); void Sys_ConsoleOutput(char *string); -YQ2_ATTR_NORETURN void Sys_Error(char *error, ...); +YQ2_ATTR_NORETURN void Sys_Error(const char *error, ...); YQ2_ATTR_NORETURN void Sys_Quit(void); void Sys_Init(void); char *Sys_GetHomeDir(void); diff --git a/src/common/header/shared.h b/src/common/header/shared.h index da8f307..003f46b 100644 --- a/src/common/header/shared.h +++ b/src/common/header/shared.h @@ -315,7 +315,7 @@ void COM_DefaultExtension(char *path, const char *extension); char *COM_Parse(char **data_p); /* data is an in/out parm, returns a parsed out token */ -void Com_sprintf(char *dest, int size, char *fmt, ...); +void Com_sprintf(char *dest, int size, const char *fmt, ...); void Com_PageInMemory(byte *buffer, int size); @@ -410,8 +410,8 @@ char *Sys_FindNext(unsigned musthave, unsigned canthave); void Sys_FindClose(void); /* this is only here so the functions in shared source files can link */ -YQ2_ATTR_NORETURN void Sys_Error(char *error, ...); -void Com_Printf(char *msg, ...); +YQ2_ATTR_NORETURN void Sys_Error(const char *error, ...); +void Com_Printf(const char *msg, ...); /* * ========================================================== diff --git a/src/common/shared.c b/src/common/shared.c index 7b87018..53eaedf 100644 --- a/src/common/shared.c +++ b/src/common/shared.c @@ -1075,7 +1075,7 @@ Q_strcasecmp(char *s1, char *s2) } void -Com_sprintf(char *dest, int size, char *fmt, ...) +Com_sprintf(char *dest, int size, const char *fmt, ...) { int len; va_list argptr; diff --git a/src/vk/vk_main.c b/src/vk/vk_main.c index df352b0..8f7524d 100644 --- a/src/vk/vk_main.c +++ b/src/vk/vk_main.c @@ -1770,7 +1770,7 @@ void R_Printf(int level, const char* msg, ...) } void -Sys_Error (char *error, ...) +Sys_Error (const char *error, ...) { va_list argptr; char text[4096]; // MAXPRINTMSG == 4096 @@ -1783,7 +1783,7 @@ Sys_Error (char *error, ...) } void -Com_Printf (char *msg, ...) +Com_Printf (const char *msg, ...) { va_list argptr; va_start(argptr, msg);