From 8d0a8690c2c683fd8660531aab1aceb3418599a3 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 16 Mar 2007 21:03:38 +0000 Subject: [PATCH] use _snprintf instead of switch_snprintf on windows for now.. snprintf seems to be having issues handling anything that uses the #define'd format strings for time t and 64 bit ints on windows. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4621 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_apr.h | 4 ---- src/include/switch_platform.h | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 767d63741a..d84801ed75 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -131,10 +131,6 @@ SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *bu * @{ */ -#ifndef snprintf -#define snprintf switch_snprintf -#endif - SWITCH_DECLARE(int) switch_snprintf(char *buf, switch_size_t len, const char *format, ...); SWITCH_DECLARE(int) switch_vasprintf(char **buf, const char *format, va_list ap); diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index e54cda61b0..65675f3a58 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -101,6 +101,10 @@ typedef int gid_t; #include #define strcasecmp(s1, s2) stricmp(s1, s2) #define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) +#ifndef snprintf +#define snprintf _snprintf +#endif + #else /* packed attribute */ #ifndef PACKED @@ -199,31 +203,31 @@ typedef intptr_t switch_ssize_t; #ifdef WIN32 #ifdef WIN64 -#define SWITCH_SSIZE_T_FMT "%I64d" -#define SWITCH_SIZE_T_FMT "%I64d" +#define SWITCH_SSIZE_T_FMT "I64d" +#define SWITCH_SIZE_T_FMT "I64d" #else -#define SWITCH_SSIZE_T_FMT "%d" -#define SWITCH_SIZE_T_FMT "%d" +#define SWITCH_SSIZE_T_FMT "d" +#define SWITCH_SIZE_T_FMT "d" #endif -#define SWITCH_INT64_T_FMT "%I64d" -#define SWITCH_UINT64_T_FMT "%I64u" +#define SWITCH_INT64_T_FMT "I64d" +#define SWITCH_UINT64_T_FMT "I64u" #else #ifndef SWITCH_SSIZE_T_FMT -#define SWITCH_SSIZE_T_FMT (sizeof (switch_ssize_t) == sizeof (long) ? "%ld" : sizeof (switch_ssize_t) == sizeof (int) ? "%d" : "%lld") +#define SWITCH_SSIZE_T_FMT (sizeof (switch_ssize_t) == sizeof (long) ? "ld" : sizeof (switch_ssize_t) == sizeof (int) ? "d" : "lld") #endif #ifndef SWITCH_SIZE_T_FMT -#define SWITCH_SIZE_T_FMT (sizeof (switch_size_t) == sizeof (long) ? "%lu" : sizeof (switch_size_t) == sizeof (int) ? "%u" : "%llu") +#define SWITCH_SIZE_T_FMT (sizeof (switch_size_t) == sizeof (long) ? "lu" : sizeof (switch_size_t) == sizeof (int) ? "u" : "llu") #endif #ifndef SWITCH_INT64_T_FMT -#define SWITCH_INT64_T_FMT (sizeof (long) == 8 ? "%ld" : "%lld") +#define SWITCH_INT64_T_FMT (sizeof (long) == 8 ? "ld" : "lld") #endif #ifndef SWITCH_UINT64_T_FMT -#define SWITCH_UINT64_T_FMT (sizeof (long) == 8 ? "%lu" : "%llu") +#define SWITCH_UINT64_T_FMT (sizeof (long) == 8 ? "lu" : "llu") #endif #endif