From e40e34cb04d940b132e66ccd21b3018a68ffe3f7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 7 May 2012 06:33:12 +0000 Subject: move TCHAR definition for Cygwin from tclUnixPort.h to tclPlatDecls.h, so it can be used for the Plat* interfaces as well --- generic/tclIOSock.c | 2 +- generic/tclPlatDecls.h | 19 ++++++++----------- unix/tclUnixPort.h | 5 ++--- win/tclWinDde.c | 1 - 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 159f3da..1e57cc0 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -84,7 +84,7 @@ TclSockGetPort(interp, string, proto, portPtr) */ #undef TclSockMinimumBuffers -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__CYGWIN__) # define SOCKET int #endif diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index 3be40cb..02191ca 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -11,19 +11,16 @@ #define _TCLPLATDECLS /* - * Pull in the typedef of TCHAR for windows. + * TCHAR is needed here for win32, so if it is not defined yet do it here. + * This way, we don't need to include just for one define. */ -#if defined(__WIN32__) && !defined(_TCHAR_DEFINED) -# include -# ifndef _TCHAR_DEFINED - /* Borland seems to forget to set this. */ - typedef _TCHAR TCHAR; -# define _TCHAR_DEFINED -# endif -# if defined(_MSC_VER) && defined(__STDC__) - /* MSVC++ misses this. */ - typedef _TCHAR TCHAR; +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(_TCHAR_DEFINED) +# if defined(_UNICODE) + typedef wchar_t TCHAR; +# else + typedef char TCHAR; # endif +# define _TCHAR_DEFINED #endif /* !BEGIN!: Do not edit below this line. */ diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 85f2b13..9a76301 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -83,7 +83,6 @@ typedef off_t Tcl_SeekOffset; # define HINSTANCE void * # define SOCKET unsigned int # define WSAEWOULDBLOCK 10035 - typedef char TCHAR; DLLIMPORT extern __stdcall int GetModuleHandleExW(unsigned int, const char *, void *); DLLIMPORT extern __stdcall int GetModuleFileNameW(void *, const char *, int); DLLIMPORT extern __stdcall int WideCharToMultiByte(int, int, const char *, int, @@ -709,10 +708,10 @@ EXTERN void TclpMutexLock _ANSI_ARGS_((TclpMutex *mPtr)); EXTERN void TclpMutexUnlock _ANSI_ARGS_((TclpMutex *mPtr)); EXTERN Tcl_DirEntry * TclpReaddir(DIR *); #ifndef TclpLocaltime -EXTERN struct tm * TclpLocaltime(TclpTime_t_CONST); +EXTERN struct tm *TclpLocaltime(TclpTime_t_CONST); #endif #ifndef TclpGmtime -EXTERN struct tm * TclpGmtime(TclpTime_t_CONST); +EXTERN struct tm *TclpGmtime(TclpTime_t_CONST); #endif #define inet_ntoa(x) TclpInetNtoa(x) #else diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 291a244..1fa922b 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -14,7 +14,6 @@ #include "tclPort.h" #include #include -#include /* * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the -- cgit v0.12