Mercurial > sdl-ios-xcode
comparison include/SDL_stdinc.h @ 1379:c0a74f199ecf
Use only safe string functions
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 19 Feb 2006 23:46:34 +0000 |
parents | 533567cbb576 |
children | 8570e1f4b1f1 |
comparison
equal
deleted
inserted
replaced
1378:dc0e13e7e1ae | 1379:c0a74f199ecf |
---|---|
203 #if HAVE_ABS | 203 #if HAVE_ABS |
204 #define SDL_abs abs | 204 #define SDL_abs abs |
205 #else | 205 #else |
206 #define SDL_abs(X) ((X) < 0 ? -(X) : (X)) | 206 #define SDL_abs(X) ((X) < 0 ? -(X) : (X)) |
207 #endif | 207 #endif |
208 | |
209 #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) | |
210 #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) | |
208 | 211 |
209 #if HAVE_CTYPE_H | 212 #if HAVE_CTYPE_H |
210 #define SDL_isdigit(X) isdigit(X) | 213 #define SDL_isdigit(X) isdigit(X) |
211 #define SDL_isspace(X) isspace(X) | 214 #define SDL_isspace(X) isspace(X) |
212 #define SDL_toupper(X) toupper(X) | 215 #define SDL_toupper(X) toupper(X) |
353 #define SDL_strlen strlen | 356 #define SDL_strlen strlen |
354 #else | 357 #else |
355 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); | 358 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); |
356 #endif | 359 #endif |
357 | 360 |
358 #if HAVE_STRCPY | 361 #if HAVE_STRLCPY |
359 #define SDL_strcpy strcpy | 362 #define SDL_strlcpy strlcpy |
360 #else | 363 #else |
361 extern DECLSPEC char * SDLCALL SDL_strcpy(char *dst, const char *src); | 364 extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); |
362 #endif | 365 #endif |
363 | 366 |
364 #if HAVE_STRNCPY | 367 #if HAVE_STRLCAT |
365 #define SDL_strncpy strncpy | 368 #define SDL_strlcat strlcat |
366 #else | 369 #else |
367 extern DECLSPEC char * SDLCALL SDL_strncpy(char *dst, const char *src, size_t maxlen); | 370 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); |
368 #endif | |
369 | |
370 #if HAVE_STRCAT | |
371 #define SDL_strcat strcat | |
372 #else | |
373 #define SDL_strcat(dst, src) (SDL_strcpy(dst+SDL_strlen(dst), src), dst) | |
374 #endif | |
375 | |
376 #if HAVE_STRNCAT | |
377 #define SDL_strncat strncat | |
378 #else | |
379 #define SDL_strncat(dst, src, n) (SDL_strncpy(dst+SDL_strlen(dst), src, n), dst) | |
380 #endif | 371 #endif |
381 | 372 |
382 #if HAVE_STRDUP | 373 #if HAVE_STRDUP |
383 #define SDL_strdup strdup | 374 #define SDL_strdup strdup |
384 #else | 375 #else |