mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
various: add more format specifiers checks
This commit is contained in:
@@ -5,11 +5,13 @@
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format(printf, a1, a2)))
|
||||
#define SCANF_ATTRIBUTE(a1, a2) __attribute__ ((format(scanf, a1, a2)))
|
||||
#define MP_NORETURN __attribute__((noreturn))
|
||||
#define MP_FALLTHROUGH __attribute__((fallthrough))
|
||||
#define MP_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
#define PRINTF_ATTRIBUTE(a1, a2)
|
||||
#define SCANF_ATTRIBUTE(a1, a2)
|
||||
#define MP_NORETURN
|
||||
#define MP_FALLTHROUGH do {} while (0)
|
||||
#define MP_WARN_UNUSED_RESULT
|
||||
|
||||
@@ -332,12 +332,14 @@ size_t mp_fwrite(const void *restrict buffer, size_t size, size_t count,
|
||||
}
|
||||
|
||||
#if HAVE_UWP
|
||||
PRINTF_ATTRIBUTE(2, 0)
|
||||
static int mp_vfprintf(FILE *stream, const char *format, va_list args)
|
||||
{
|
||||
return vfprintf(stream, format, args);
|
||||
}
|
||||
#else
|
||||
|
||||
PRINTF_ATTRIBUTE(2, 0)
|
||||
static int mp_vfprintf(FILE *stream, const char *format, va_list args)
|
||||
{
|
||||
HANDLE wstream = get_handle(stream);
|
||||
|
||||
@@ -27,6 +27,7 @@ void terminal_get_size2(int *rows, int *cols, int *px_width, int *px_height)
|
||||
{
|
||||
}
|
||||
|
||||
PRINTF_ATTRIBUTE(2, 0)
|
||||
int mp_console_vfprintf(void *wstream, const char *format, va_list args)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -62,7 +62,8 @@ void terminal_get_size2(int *rows, int *cols, int *px_width, int *px_height);
|
||||
void terminal_set_mouse_input(bool enable);
|
||||
|
||||
// Windows only.
|
||||
int mp_console_vfprintf(void *wstream, const char *format, va_list args);
|
||||
int mp_console_vfprintf(void *wstream, const char *format, va_list args)
|
||||
PRINTF_ATTRIBUTE(2, 0);
|
||||
int mp_console_write(void *wstream, bstr str);
|
||||
bool mp_check_console(void *handle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user