From d33e961dc9bceb2eb762b915ad006937e6893b47 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 1 Feb 2016 02:13:10 +0100 Subject: [PATCH] =?UTF-8?q?Only=20declare=20weak=20symbols=20if=20the=20ru?= =?UTF-8?q?ntime=20doesn=E2=80=99t=20have=20them.=20Fixes=20#8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- caca/figfont.c | 8 ++++++++ caca/string.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/caca/figfont.c b/caca/figfont.c index caa44d5..815c5c4 100644 --- a/caca/figfont.c +++ b/caca/figfont.c @@ -30,8 +30,12 @@ #include "caca_internals.h" #if defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3 +# if !HAVE_SPRINTF_S int sprintf_s(char *s, size_t n, const char *fmt, ...) CACA_WEAK; +# endif +# if !HAVE_VSNPRINTF int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) CACA_WEAK; +# endif #endif struct caca_charfont @@ -637,6 +641,7 @@ static uint32_t hsmush(uint32_t ch1, uint32_t ch2, int rule) */ #if defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3 +# if !HAVE_SPRINTF_S int sprintf_s(char *s, size_t n, const char *fmt, ...) { va_list args; @@ -646,11 +651,14 @@ int sprintf_s(char *s, size_t n, const char *fmt, ...) va_end(args); return ret; } +# endif +# if !HAVE_VSNPRINTF int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) { return 0; } +# endif #endif /* diff --git a/caca/string.c b/caca/string.c index 22e0af2..963e349 100644 --- a/caca/string.c +++ b/caca/string.c @@ -37,9 +37,13 @@ #include "caca_internals.h" #if defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3 +# if !HAVE_VSNPRINTF_S int vsnprintf_s(char *s, size_t n, size_t c, const char *fmt, va_list ap) CACA_WEAK; +# endif +# if !HAVE_VSNPRINTF int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) CACA_WEAK; +# endif #endif /** \brief Set cursor position. @@ -611,15 +615,19 @@ int caca_set_canvas_boundaries(caca_canvas_t *cv, int x, int y, int w, int h) */ #if defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3 +# if !HAVE_VSNPRINTF_S int vsnprintf_s(char *s, size_t n, size_t c, const char *fmt, va_list ap) { return vsnprintf(s, n, fmt, ap); } +# endif +# if !HAVE_VSNPRINTF int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) { return 0; } +# endif #endif /*