Browse Source

Only declare weak symbols if the runtime doesn’t have them. Fixes #8.

tags/v0.99.beta20
Sam Hocevar 9 years ago
parent
commit
d33e961dc9
2 changed files with 16 additions and 0 deletions
  1. +8
    -0
      caca/figfont.c
  2. +8
    -0
      caca/string.c

+ 8
- 0
caca/figfont.c View File

@@ -30,8 +30,12 @@
#include "caca_internals.h" #include "caca_internals.h"


#if defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3 #if defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3
# if !HAVE_SPRINTF_S
int sprintf_s(char *s, size_t n, const char *fmt, ...) CACA_WEAK; 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; int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) CACA_WEAK;
# endif
#endif #endif


struct caca_charfont 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 defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3
# if !HAVE_SPRINTF_S
int sprintf_s(char *s, size_t n, const char *fmt, ...) int sprintf_s(char *s, size_t n, const char *fmt, ...)
{ {
va_list args; va_list args;
@@ -646,11 +651,14 @@ int sprintf_s(char *s, size_t n, const char *fmt, ...)
va_end(args); va_end(args);
return ret; return ret;
} }
# endif


# if !HAVE_VSNPRINTF
int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) int vsnprintf(char *s, size_t n, const char *fmt, va_list ap)
{ {
return 0; return 0;
} }
# endif
#endif #endif


/* /*


+ 8
- 0
caca/string.c View File

@@ -37,9 +37,13 @@
#include "caca_internals.h" #include "caca_internals.h"


#if defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3 #if defined _WIN32 && defined __GNUC__ && __GNUC__ >= 3
# if !HAVE_VSNPRINTF_S
int vsnprintf_s(char *s, size_t n, size_t c, int vsnprintf_s(char *s, size_t n, size_t c,
const char *fmt, va_list ap) CACA_WEAK; 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; int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) CACA_WEAK;
# endif
#endif #endif


/** \brief Set cursor position. /** \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 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) int vsnprintf_s(char *s, size_t n, size_t c, const char *fmt, va_list ap)
{ {
return vsnprintf(s, n, fmt, ap); return vsnprintf(s, n, fmt, ap);
} }
# endif


# if !HAVE_VSNPRINTF
int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) int vsnprintf(char *s, size_t n, const char *fmt, va_list ap)
{ {
return 0; return 0;
} }
# endif
#endif #endif


/* /*


Loading…
Cancel
Save