diff options
author | nijtmans <nijtmans> | 2010-04-08 14:06:20 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-04-08 14:06:20 (GMT) |
commit | 843ef125db98bc3a762319cc94e9ce8de0881cef (patch) | |
tree | b7fcf9bd3a46ca59ea6692d02cb7cacc14303358 /win | |
parent | 3b668a10084cd1d859858124bfa1799162453d08 (diff) | |
download | tk-843ef125db98bc3a762319cc94e9ce8de0881cef.zip tk-843ef125db98bc3a762319cc94e9ce8de0881cef.tar.gz tk-843ef125db98bc3a762319cc94e9ce8de0881cef.tar.bz2 |
Add <wchar.h> to tkWinPort.h, and
remove some earlier CYGWIN-related
hacks which then are no longer necessary.
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinPort.h | 48 | ||||
-rw-r--r-- | win/tkWinSend.c | 18 | ||||
-rw-r--r-- | win/tkWinSendCom.c | 6 |
3 files changed, 33 insertions, 39 deletions
diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 3a99c43..a596de1 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinPort.h,v 1.13 2010/01/22 14:17:53 nijtmans Exp $ + * RCS: @(#) $Id: tkWinPort.h,v 1.14 2010/04/08 14:06:20 nijtmans Exp $ */ #ifndef _WINPORT @@ -22,20 +22,16 @@ #include <X11/Xatom.h> #include <X11/Xutil.h> -#include <malloc.h> +#include <wchar.h> +#include <io.h> +#include <stdlib.h> #include <errno.h> +#include <fcntl.h> +#include <malloc.h> #include <ctype.h> #include <math.h> -#include <stdlib.h> #include <string.h> #include <limits.h> -#include <fcntl.h> -#ifdef __CYGWIN__ -# include <unistd.h> -# include <wchar.h> -#else -# include <io.h> -#endif /* * Need to block out this include for building extensions with MetroWerks @@ -47,29 +43,31 @@ #endif #include <time.h> -#ifdef __CYGWIN__ -# define _T(x) L##x -#else -# include <tchar.h> -#endif #ifdef _MSC_VER # define hypot _hypot #endif /* _MSC_VER */ -#ifdef __CYGWIN__ -# ifdef _UNICODE -# define _tcsrchr wcsrchr -# else -# define _tcsrchr strrchr - +/* + * Pull in the typedef of TCHAR for windows. + */ +#if !defined(_TCHAR_DEFINED) +# include <tchar.h> +# ifndef _TCHAR_DEFINED + /* Borland seems to forget to set this. */ + typedef _TCHAR TCHAR; +# define _TCHAR_DEFINED # endif -#else -# define wcscasecmp _wcsicmp -# define strncasecmp strnicmp -# define strcasecmp stricmp #endif +#ifdef __CYGWIN__ +#define _vsnprintf vsnprintf +#define _wcsicmp wcscasecmp +#endif + +#define strncasecmp strnicmp +#define strcasecmp stricmp + #define NBBY 8 #ifndef OPEN_MAX diff --git a/win/tkWinSend.c b/win/tkWinSend.c index 1eaf6d1..18a7d72 100644 --- a/win/tkWinSend.c +++ b/win/tkWinSend.c @@ -10,16 +10,12 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinSend.c,v 1.23 2010/02/03 23:56:49 patthoyts Exp $ + * RCS: @(#) $Id: tkWinSend.c,v 1.24 2010/04/08 14:06:20 nijtmans Exp $ */ - +#include <tchar.h> #include "tkInt.h" #include "tkWinSendCom.h" -#ifdef _MSC_VER -#define vsnprintf _vsnprintf -#endif - /* * Should be defined in WTypes.h but mingw 1.0 is missing them. */ @@ -847,11 +843,11 @@ Win32ErrorObj( if (lpBuffer == NULL) { lpBuffer = sBuffer; - wsprintf(sBuffer, (const char *)_T("Error Code: %08lX"), hrError); + wsprintf(sBuffer, TEXT("Error Code: %08lX"), hrError); } - if ((p = _tcsrchr(lpBuffer, _T('\r'))) != NULL) { - *p = _T('\0'); + if ((p = _tcsrchr(lpBuffer, TEXT('\r'))) != NULL) { + *p = TEXT('\0'); } #ifdef _UNICODE @@ -1038,8 +1034,8 @@ SendTrace( static char buffer[1024]; va_start(args, format); - vsnprintf(buffer, 1023, format, args); - OutputDebugString(buffer); + _vsnprintf(buffer, 1023, format, args); + OutputDebugStringA(buffer); va_end(args); } diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c index f3de005..e0f6d38 100644 --- a/win/tkWinSendCom.c +++ b/win/tkWinSendCom.c @@ -18,7 +18,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinSendCom.c,v 1.10 2010/01/22 14:17:53 nijtmans Exp $ + * RCS: @(#) $Id: tkWinSendCom.c,v 1.11 2010/04/08 14:06:20 nijtmans Exp $ */ #include "tkInt.h" @@ -252,9 +252,9 @@ WinSendCom_GetIDsOfNames( if (rgDispId) { hr = DISP_E_UNKNOWNNAME; - if (wcscasecmp(*rgszNames, L"Send") == 0) { + if (_wcsicmp(*rgszNames, L"Send") == 0) { *rgDispId = TKWINSENDCOM_DISPID_SEND, hr = S_OK; - } else if (wcscasecmp(*rgszNames, L"Async") == 0) { + } else if (_wcsicmp(*rgszNames, L"Async") == 0) { *rgDispId = TKWINSENDCOM_DISPID_ASYNC, hr = S_OK; } } |