summaryrefslogtreecommitdiffstats
path: root/win/tclWinError.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-23 14:15:29 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-23 14:15:29 (GMT)
commitaf8da26b34bd282986b54a9da8618c6c3f617c7a (patch)
tree0c4ebae9865c8fef52dcb8c18bab8e3eeee078a3 /win/tclWinError.c
parent6efd3e5fb18780e9e765151e807ed04c34293aa6 (diff)
downloadtcl-af8da26b34bd282986b54a9da8618c6c3f617c7a.zip
tcl-af8da26b34bd282986b54a9da8618c6c3f617c7a.tar.gz
tcl-af8da26b34bd282986b54a9da8618c6c3f617c7a.tar.bz2
add TclGetAndDetachPids and TclpCloseFile to cygwin port
Diffstat (limited to 'win/tclWinError.c')
-rw-r--r--win/tclWinError.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/win/tclWinError.c b/win/tclWinError.c
index d718584..b49271e 100644
--- a/win/tclWinError.c
+++ b/win/tclWinError.c
@@ -1,15 +1,16 @@
-/*
+/*
* tclWinError.c --
*
- * This file contains code for converting from Win32 errors to
- * errno errors.
+ * This file contains code for converting from Win32 errors to errno
+ * errors.
*
* Copyright (c) 1995-1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include "tclInt.h"
#include "tclPort.h"
#ifndef WSAEWOULDBLOCK
@@ -21,8 +22,7 @@
#endif
/*
- * The following table contains the mapping from Win32 errors to
- * errno errors.
+ * The following table contains the mapping from Win32 errors to errno errors.
*/
static CONST unsigned char errorTable[] = {
@@ -301,7 +301,7 @@ static CONST unsigned char errorTable[] = {
* errno errors.
*/
-static CONST unsigned char wsaErrorTable[] = {
+static CONST int wsaErrorTable[] = {
EWOULDBLOCK, /* WSAEWOULDBLOCK */
EINPROGRESS, /* WSAEINPROGRESS */
EALREADY, /* WSAEALREADY */
@@ -358,10 +358,10 @@ static CONST unsigned char wsaErrorTable[] = {
*/
void
-TclWinConvertError(errCode)
- DWORD errCode; /* Win32 error code. */
+TclWinConvertError(
+ DWORD errCode) /* Win32 error code. */
{
- if (errCode >= sizeof(errorTable)) {
+ if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) {
Tcl_SetErrno(EINVAL);
} else {
Tcl_SetErrno(errorTable[errCode]);
@@ -385,13 +385,22 @@ TclWinConvertError(errCode)
*/
void
-TclWinConvertWSAError(errCode)
- DWORD errCode; /* Win32 error code. */
+TclWinConvertWSAError(
+ DWORD errCode) /* Win32 error code. */
{
- errCode -= WSAEWOULDBLOCK;
- if ((errCode <= (DWORD) sizeof(wsaErrorTable))) {
- Tcl_SetErrno(wsaErrorTable[errCode]);
- } 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:
+ */