diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-23 15:26:25 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-23 15:26:25 (GMT) |
commit | fa9a43ff5fd981089f0a432872444073f8710c99 (patch) | |
tree | 34b85e3f87e715d54fb7d13964c94e8e828dca13 /win/tclWinError.c | |
parent | 507f8de77f501bd26ff176139ce8f8fd7b7279de (diff) | |
download | tcl-fa9a43ff5fd981089f0a432872444073f8710c99.zip tcl-fa9a43ff5fd981089f0a432872444073f8710c99.tar.gz tcl-fa9a43ff5fd981089f0a432872444073f8710c99.tar.bz2 |
Revert some cygwin-related signature changes from [835f8e1e9d] (2010-02-01)
They were an attempt to make the cygwin port compile again, but since cygwin
is based on unix this serves no purpose any more.
Add tclWinError.c to the CYGWIN build.
Diffstat (limited to 'win/tclWinError.c')
-rw-r--r-- | win/tclWinError.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/win/tclWinError.c b/win/tclWinError.c index ca1b0e8..b49271e 100644 --- a/win/tclWinError.c +++ b/win/tclWinError.c @@ -11,12 +11,21 @@ */ #include "tclInt.h" +#include "tclPort.h" + +#ifndef WSAEWOULDBLOCK +# define WSAEWOULDBLOCK 10035L +#endif + +#ifndef __WIN32__ +# define DWORD unsigned int +#endif /* * The following table contains the mapping from Win32 errors to errno errors. */ -static char errorTable[] = { +static CONST unsigned char errorTable[] = { 0, EINVAL, /* ERROR_INVALID_FUNCTION 1 */ ENOENT, /* ERROR_FILE_NOT_FOUND 2 */ @@ -284,17 +293,15 @@ static char errorTable[] = { EINVAL, /* 264 */ EINVAL, /* 265 */ EINVAL, /* 266 */ - ENOTDIR, /* ERROR_DIRECTORY 267 */ + ENOTDIR /* ERROR_DIRECTORY 267 */ }; -static const unsigned int tableLen = sizeof(errorTable); - /* * The following table contains the mapping from WinSock errors to * errno errors. */ -static int wsaErrorTable[] = { +static CONST int wsaErrorTable[] = { EWOULDBLOCK, /* WSAEWOULDBLOCK */ EINPROGRESS, /* WSAEINPROGRESS */ EALREADY, /* WSAEALREADY */ @@ -331,7 +338,7 @@ static int wsaErrorTable[] = { EUSERS, /* WSAEUSERS */ EDQUOT, /* WSAEDQUOT */ ESTALE, /* WSAESTALE */ - EREMOTE, /* WSAEREMOTE */ + EREMOTE /* WSAEREMOTE */ }; /* @@ -352,9 +359,9 @@ static int wsaErrorTable[] = { void TclWinConvertError( - unsigned long errCode) /* Win32 error code. */ + DWORD errCode) /* Win32 error code. */ { - if (errCode >= tableLen) { + if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) { Tcl_SetErrno(EINVAL); } else { Tcl_SetErrno(errorTable[errCode]); @@ -379,11 +386,21 @@ TclWinConvertError( void TclWinConvertWSAError( - unsigned long errCode) /* Win32 error code. */ + DWORD errCode) /* Win32 error code. */ { - if ((errCode >= WSAEWOULDBLOCK) && (errCode <= WSAEREMOTE)) { - Tcl_SetErrno(wsaErrorTable[errCode - WSAEWOULDBLOCK]); - } else { + errCode -= WSAEWOULDBLOCK; + if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) { Tcl_SetErrno(EINVAL); + } else { + Tcl_SetErrno(wsaErrorTable[errCode]); } } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * tab-width: 8 + * End: + */ |