Changeset 4817
- Timestamp:
- 06/13/12 13:32:42 (12 months ago)
- Location:
- libcaca/trunk
- Files:
-
- 4 edited
-
caca/figfont.c (modified) (3 diffs)
-
caca/string.c (modified) (1 diff)
-
configure.ac (modified) (1 diff)
-
win32/config.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/figfont.c
r4812 r4817 298 298 static caca_charfont_t * open_charfont(char const *path) 299 299 { 300 #if !defined __KERNEL__ && defined HAVE_SNPRINTF301 char altpath[2048];302 #endif303 300 char buf[2048]; 304 301 char hardblank[10]; … … 306 303 char *data = NULL; 307 304 caca_file_t *f; 305 #if !defined __KERNEL__ && (defined HAVE_SNPRINTF || defined HAVE_SPRINTF_S) 306 int const pathlen = 2048; 307 char *altpath = NULL; 308 #endif 308 309 int i, j, size, comment_lines; 309 310 … … 317 318 /* Open font: if not found, try .tlf, then .flf */ 318 319 f = caca_file_open(path, "r"); 319 #if !defined __KERNEL__ && defined HAVE_SNPRINTF 320 321 #if (! defined(snprintf)) && ( defined(_WIN32) || defined(WIN32) ) && (! defined(__CYGWIN__)) 322 #define snprintf _snprintf 320 #if !defined __KERNEL__ && (defined HAVE_SNPRINTF || defined HAVE_SPRINTF_S) 321 if(!f) 322 altpath = malloc(pathlen); 323 if(!f) 324 { 325 #if defined HAVE_SPRINTF_S 326 sprintf_s(altpath, pathlen - 1, "%s.tlf", path); 327 #else 328 snprintf(altpath, pathlen - 1, "%s.tlf", path); 323 329 #endif 324 330 altpath[pathlen - 1] = '\0'; 331 f = caca_file_open(altpath, "r"); 332 } 325 333 if(!f) 326 334 { 327 snprintf(altpath, 2047, "%s.tlf", path); 328 altpath[2047] = '\0'; 335 #if defined HAVE_SPRINTF_S 336 sprintf_s(altpath, pathlen - 1, "%s.flf", path); 337 #else 338 snprintf(altpath, pathlen - 1, "%s.flf", path); 339 #endif 340 altpath[pathlen - 1] = '\0'; 329 341 f = caca_file_open(altpath, "r"); 330 342 } 331 if(!f) 332 { 333 snprintf(altpath, 2047, "%s.flf", path); 334 altpath[2047] = '\0'; 335 f = caca_file_open(altpath, "r"); 336 } 343 if (altpath) 344 free(altpath); 337 345 #endif 338 346 if(!f) -
libcaca/trunk/caca/string.c
r4369 r4817 337 337 buf = malloc(cv->width - x + 1); 338 338 339 #if defined(HAVE_VSNPRINTF) 339 #if defined(HAVE_VSNPRINTF_S) 340 vsnprintf_s(buf, cv->width - x + 1, _TRUNCATE, format, args); 341 #elif defined(HAVE_VSNPRINTF) 340 342 vsnprintf(buf, cv->width - x + 1, format, args); 341 343 #else -
libcaca/trunk/configure.ac
r4816 r4817 121 121 122 122 AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h termios.h) 123 AC_CHECK_FUNCS(signal ioctl snprintf vsnprintfgetenv putenv strcasecmp htons)123 AC_CHECK_FUNCS(signal ioctl snprintf sprintf_s vsnprintf vsnprintf_s getenv putenv strcasecmp htons) 124 124 AC_CHECK_FUNCS(usleep gettimeofday atexit) 125 125 -
libcaca/trunk/win32/config.h
r4679 r4817 44 44 /* #undef HAVE_SLSMG_UTF8_ENABLE */ 45 45 #define HAVE_SNPRINTF 1 46 #define HAVE_SPRINTF_S 1 46 47 #define HAVE_STDARG_H 1 47 48 #define HAVE_STDIO_H 1 … … 60 61 /* #undef HAVE_USLEEP */ 61 62 /* #undef HAVE_VSNPRINTF */ 63 #define HAVE_VSNPRINTF_S 1 62 64 #define HAVE_WINDOWS_H 1 63 65 #define HAVE_WINSOCK2_H 1
Note: See TracChangeset
for help on using the changeset viewer.
