diff options
author | Yang Tse <yangsita@gmail.com> | 2013-07-19 06:44:46 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2013-07-19 12:33:10 +0200 |
commit | 6bcacff1a52df5818c2a12807de6e7ca896da508 (patch) | |
tree | 9b32191db1fdcf2f3a78df13b4c3ee732b51b088 /lib | |
parent | 12d01cb6fa914519d1ced0223cd9ff96a2634de9 (diff) | |
download | curl-6bcacff1a52df5818c2a12807de6e7ca896da508.tar.gz |
WIN32 MemoryTracking: require UNICODE for wide strdup code support
Diffstat (limited to 'lib')
-rw-r--r-- | lib/curl_memory.h | 13 | ||||
-rw-r--r-- | lib/curl_setup.h | 4 | ||||
-rw-r--r-- | lib/easy.c | 8 | ||||
-rw-r--r-- | lib/memdebug.c | 2 | ||||
-rw-r--r-- | lib/memdebug.h | 13 |
5 files changed, 22 insertions, 18 deletions
diff --git a/lib/curl_memory.h b/lib/curl_memory.h index 4bba008c9..e3cdc721c 100644 --- a/lib/curl_memory.h +++ b/lib/curl_memory.h @@ -87,7 +87,7 @@ extern curl_free_callback Curl_cfree; extern curl_realloc_callback Curl_crealloc; extern curl_strdup_callback Curl_cstrdup; extern curl_calloc_callback Curl_ccalloc; -#ifdef WIN32 +#if defined(WIN32) && defined(UNICODE) extern curl_wcsdup_callback Curl_cwcsdup; #endif @@ -114,14 +114,15 @@ extern curl_wcsdup_callback Curl_cwcsdup; #define free(ptr) Curl_cfree(ptr) #ifdef WIN32 -# undef wcsdup -# define wcsdup(ptr) Curl_cwcsdup(ptr) -# undef _wcsdup -# define _wcsdup(ptr) Curl_cwcsdup(ptr) -# undef _tcsdup # ifdef UNICODE +# undef wcsdup +# define wcsdup(ptr) Curl_cwcsdup(ptr) +# undef _wcsdup +# define _wcsdup(ptr) Curl_cwcsdup(ptr) +# undef _tcsdup # define _tcsdup(ptr) Curl_cwcsdup(ptr) # else +# undef _tcsdup # define _tcsdup(ptr) Curl_cstrdup(ptr) # endif #endif diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 3f55a5c0f..7edeca212 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -270,7 +270,9 @@ # endif # endif # include <tchar.h> - typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str); +# ifdef UNICODE + typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str); +# endif #endif /* diff --git a/lib/easy.c b/lib/easy.c index 541e793fb..995328e1d 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -252,8 +252,8 @@ curl_free_callback Curl_cfree = (curl_free_callback)free; curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc; curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup; curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc; -#ifdef WIN32 -curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)wcsdup; +#if defined(WIN32) && defined(UNICODE) +curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)_wcsdup; #endif #else /* @@ -286,8 +286,8 @@ CURLcode curl_global_init(long flags) Curl_crealloc = (curl_realloc_callback)realloc; Curl_cstrdup = (curl_strdup_callback)system_strdup; Curl_ccalloc = (curl_calloc_callback)calloc; -#ifdef WIN32 - Curl_cwcsdup = (curl_wcsdup_callback)wcsdup; +#if defined(WIN32) && defined(UNICODE) + Curl_cwcsdup = (curl_wcsdup_callback)_wcsdup; #endif if(flags & CURL_GLOBAL_SSL) diff --git a/lib/memdebug.c b/lib/memdebug.c index b3ddfb430..4e4f84cb2 100644 --- a/lib/memdebug.c +++ b/lib/memdebug.c @@ -239,7 +239,7 @@ char *curl_dostrdup(const char *str, int line, const char *source) return mem; } -#ifdef WIN32 +#if defined(WIN32) && defined(UNICODE) wchar_t *curl_dowcsdup(const wchar_t *str, int line, const char *source) { wchar_t *mem; diff --git a/lib/memdebug.h b/lib/memdebug.h index 955e8b72b..bd565c8dc 100644 --- a/lib/memdebug.h +++ b/lib/memdebug.h @@ -46,7 +46,7 @@ CURL_EXTERN void *curl_dorealloc(void *ptr, size_t size, int line, const char *source); CURL_EXTERN void curl_dofree(void *ptr, int line, const char *source); CURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source); -#ifdef WIN32 +#if defined(WIN32) && defined(UNICODE) CURL_EXTERN wchar_t *curl_dowcsdup(const wchar_t *str, int line, const char *source); #endif @@ -90,14 +90,15 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source); #define free(ptr) curl_dofree(ptr, __LINE__, __FILE__) #ifdef WIN32 -# undef wcsdup -# define wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__) -# undef _wcsdup -# define _wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__) -# undef _tcsdup # ifdef UNICODE +# undef wcsdup +# define wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__) +# undef _wcsdup +# define _wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__) +# undef _tcsdup # define _tcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__) # else +# undef _tcsdup # define _tcsdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__) # endif #endif |