diff --git a/code/debugconsole/console.h b/code/debugconsole/console.h index 9156b0a386..a3d51113a4 100644 --- a/code/debugconsole/console.h +++ b/code/debugconsole/console.h @@ -268,7 +268,7 @@ bool dc_pause_output(void); * @brief Prints the given char string to the debug console * @details See the doc for std::printf() for formating and more details */ -void dc_printf(const char *format, ...); +void dc_printf(SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(1, 2); /** * @brief Opens and processes the debug console. (Blocking call) diff --git a/code/fs2netd/fs2netd_client.cpp b/code/fs2netd/fs2netd_client.cpp index 67ea6be5fe..8a30704b73 100644 --- a/code/fs2netd/fs2netd_client.cpp +++ b/code/fs2netd/fs2netd_client.cpp @@ -34,6 +34,7 @@ #include "playerman/player.h" #include "popup/popup.h" #include "osapi/osapi.h" +#include "hud/hudmessage.h" #ifndef WIN32 #include @@ -53,7 +54,6 @@ extern int Multi_debrief_stats_accept_code; -extern void HUD_printf(const char *format, ...); extern int game_hacked_data(); diff --git a/code/graphics/2d.h b/code/graphics/2d.h index 2d4ce44945..82c8be29d5 100644 --- a/code/graphics/2d.h +++ b/code/graphics/2d.h @@ -876,13 +876,13 @@ bool gr_resize_screen_posf(float *x, float *y, float *w = NULL, float *h = NULL, // Does formatted printing. This calls gr_string after formatting, // so if you don't need to format the string, then call gr_string // directly. -extern void gr_printf( int x, int y, const char * format, ... ); +extern void gr_printf( int x, int y, const char * format, SCP_FORMAT_STRING ... ) SCP_FORMAT_STRING_ARGS(3, 4); // same as gr_printf but positions text correctly in menus -extern void gr_printf_menu( int x, int y, const char * format, ... ); +extern void gr_printf_menu( int x, int y, const char * format, SCP_FORMAT_STRING ... ) SCP_FORMAT_STRING_ARGS(3, 4); // same as gr_printf_menu but accounts for menu zooming -extern void gr_printf_menu_zoomed( int x, int y, const char * format, ... ); +extern void gr_printf_menu_zoomed( int x, int y, const char * format, SCP_FORMAT_STRING ... ) SCP_FORMAT_STRING_ARGS(3, 4); // same as gr_printf but doesn't resize for non-standard resolutions -extern void gr_printf_no_resize( int x, int y, const char * format, ... ); +extern void gr_printf_no_resize( int x, int y, const char * format, SCP_FORMAT_STRING ... ) SCP_FORMAT_STRING_ARGS(3, 4); // Returns the size of the string in pixels in w and h extern void gr_get_string_size( int *w, int *h, const char * text, int len = 9999 ); diff --git a/code/hud/hud.h b/code/hud/hud.h index 369433944e..4b2ad6bbf3 100644 --- a/code/hud/hud.h +++ b/code/hud/hud.h @@ -311,8 +311,8 @@ public: void renderString(int x, int y, const char *str); void renderString(int x, int y, int gauge_id, const char *str); void renderStringAlignCenter(int x, int y, int area_width, const char *s); - void renderPrintf(int x, int y, const char* format, ...); - void renderPrintf(int x, int y, int gauge_id, const char* format, ...); + void renderPrintf(int x, int y, SCP_FORMAT_STRING const char* format, ...) SCP_FORMAT_STRING_ARGS(4, 5); + void renderPrintf(int x, int y, int gauge_id, SCP_FORMAT_STRING const char* format, ...) SCP_FORMAT_STRING_ARGS(5, 6); void renderLine(int x1, int y1, int x2, int y2); void renderGradientLine(int x1, int y1, int x2, int y2); void renderRect(int x, int y, int w, int h); diff --git a/code/hud/hudmessage.h b/code/hud/hudmessage.h index 59928c2c89..c6d6384b38 100644 --- a/code/hud/hudmessage.h +++ b/code/hud/hudmessage.h @@ -65,11 +65,11 @@ void hud_init_msg_window(); void hud_clear_msg_buffer(); int HUD_team_get_source(int team); int HUD_source_get_team(int team); -void HUD_printf(const char *format, ...); +void HUD_printf(SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(1, 2); void hud_sourced_print(int source, const char *msg); -void HUD_sourced_printf(int source, const char *format, ...); // send hud message from specified source -void HUD_ship_sent_printf(int sh, const char *format, ...); // send hud message from a specific ship -void HUD_fixed_printf(float duration, color col, const char *format, ...); // Display a single message for duration seconds. +void HUD_sourced_printf(int source, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(2, 3); // send hud message from specified source +void HUD_ship_sent_printf(int sh, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(2, 3); // send hud message from a specific ship +void HUD_fixed_printf(float duration, color col, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(3, 4); // Display a single message for duration seconds. void HUD_init_fixed_text(); // Clear all pending fixed text. void HUD_add_to_scrollback(const char *text, int source); diff --git a/code/network/multi_log.h b/code/network/multi_log.h index 2a3644b486..c9e537f6db 100644 --- a/code/network/multi_log.h +++ b/code/network/multi_log.h @@ -12,6 +12,8 @@ #ifndef _FREESPACE_MULTIPLAYER_LOGFILE_HEADER_FILE #define _FREESPACE_MULTIPLAYER_LOGFILE_HEADER_FILE +#include "globalincs/pstypes.h" + // ---------------------------------------------------------------------------------------------------- // MULTI LOGFILE DEFINES/VARS // @@ -31,7 +33,7 @@ void multi_log_close(); void multi_log_process(); // printf function itself called by the ml_printf macro -void ml_printf(const char *format, ...); +void ml_printf(SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(1, 2); // string print function void ml_string(const char *string, int add_time = 1); diff --git a/code/parse/generic_log.h b/code/parse/generic_log.h index ee96e8667a..99740717e2 100644 --- a/code/parse/generic_log.h +++ b/code/parse/generic_log.h @@ -30,7 +30,7 @@ bool logfile_init(int logfile_type); void logfile_close(int logfile_type); // printf function itself called by the log_printf macro -void log_printf(int logfile_type, const char *format, ...); +void log_printf(int logfile_type, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(2, 3); // string print function void log_string(int logfile_type, const char *string, int add_time = 0); diff --git a/code/parse/parselo.h b/code/parse/parselo.h index 8bc7f8bad8..1e76d53187 100644 --- a/code/parse/parselo.h +++ b/code/parse/parselo.h @@ -91,8 +91,8 @@ extern void ignore_gray_space(); // error extern int get_line_num(); extern char *next_tokens(); -extern void diag_printf(const char *format, ...); -extern void error_display(int error_level, const char *format, ...); +extern void diag_printf(SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(1, 2); +extern void error_display(int error_level, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(2, 3); // skip extern int skip_to_string(const char *pstr, const char *end = NULL); @@ -289,7 +289,7 @@ extern bool can_construe_as_integer(const char *text); // Goober5000 (ditto for C++) extern void vsprintf(SCP_string &dest, const char *format, va_list ap); -extern void sprintf(SCP_string &dest, const char *format, ...); +extern void sprintf(SCP_string &dest, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(2, 3); // Goober5000 extern int subsystem_stricmp(const char *str1, const char *str2); diff --git a/code/weapon/emp.h b/code/weapon/emp.h index 0c1cde8285..3df662f7fb 100644 --- a/code/weapon/emp.h +++ b/code/weapon/emp.h @@ -105,7 +105,7 @@ int emp_should_blit_gauge(); void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode); // emp hud printf -void emp_hud_printf(int x, int y, int gauge_id, const char *format, ...); +void emp_hud_printf(int x, int y, int gauge_id, SCP_FORMAT_STRING const char *format, ...) SCP_FORMAT_STRING_ARGS(4, 5); // throw some jitter into HUD x and y coords void emp_hud_jitter(int *x, int *y);