diff options
author | nijtmans <nijtmans> | 2011-01-25 22:33:56 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2011-01-25 22:33:56 (GMT) |
commit | b2a0e43c20f9760344b1df76388fb910a4849f3d (patch) | |
tree | 150b7e7d28f9c6fd1f44e197c65ffe5c4908eec8 /win | |
parent | 75f084f6970d2344bb5a82fdff6a73825bc6e64e (diff) | |
download | tcl-b2a0e43c20f9760344b1df76388fb910a4849f3d.zip tcl-b2a0e43c20f9760344b1df76388fb910a4849f3d.tar.gz tcl-b2a0e43c20f9760344b1df76388fb910a4849f3d.tar.bz2 |
Fix various gcc-4.5.2 64-bit warning messages,
e.g. by using full 64-bits for socket fd's
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinChan.c | 6 | ||||
-rw-r--r-- | win/tclWinConsole.c | 4 | ||||
-rw-r--r-- | win/tclWinDde.c | 8 | ||||
-rw-r--r-- | win/tclWinFile.c | 6 | ||||
-rw-r--r-- | win/tclWinPipe.c | 19 | ||||
-rw-r--r-- | win/tclWinReg.c | 4 | ||||
-rw-r--r-- | win/tclWinSerial.c | 4 | ||||
-rw-r--r-- | win/tclWinSock.c | 62 | ||||
-rw-r--r-- | win/tclWinThrd.c | 4 |
9 files changed, 51 insertions, 66 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 0b030dd..442b5ad 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinChan.c,v 1.60 2010/11/19 20:47:09 nijtmans Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.61 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1225,7 +1225,7 @@ TclpGetDefaultStdChannel( HANDLE handle; int mode = -1; const char *bufMode = NULL; - DWORD handleId = (DWORD)INVALID_HANDLE_VALUE; + DWORD handleId = (DWORD) -1; /* Standard handle to retrieve. */ switch (type) { @@ -1338,7 +1338,7 @@ TclWinOpenFileChannel( infoPtr->flags = appendMode; infoPtr->handle = handle; infoPtr->dirty = 0; - wsprintfA(channelName, "file%lx", (int) infoPtr); + sprintf(channelName, "file%Ix", (size_t) infoPtr); infoPtr->channel = Tcl_CreateChannel(&fileChannelType, channelName, infoPtr, permissions); diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 6ad92f1..8b2e074 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinConsole.c,v 1.25 2010/09/13 14:20:39 nijtmans Exp $ + * RCS: @(#) $Id: tclWinConsole.c,v 1.26 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1362,7 +1362,7 @@ TclWinOpenConsoleChannel( * for instance). */ - wsprintfA(channelName, "file%lx", (int) infoPtr); + sprintf(channelName, "file%Ix", (size_t) infoPtr); infoPtr->channel = Tcl_CreateChannel(&consoleChannelType, channelName, infoPtr, permissions); diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 2b1286c..4a045eb 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinDde.c,v 1.45 2010/10/11 12:11:53 nijtmans Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.46 2011/01/25 22:33:56 nijtmans Exp $ */ #undef STATIC_BUILD @@ -220,7 +220,7 @@ Initialize(void) if (ddeInstance == 0) { Tcl_MutexLock(&ddeMutex); if (ddeInstance == 0) { - if (DdeInitializeA(&ddeInstance, DdeServerProc, + if (DdeInitializeA(&ddeInstance, (PFNCALLBACK) DdeServerProc, CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS | CBF_FAIL_POKES, 0) != DMLERR_NO_ERROR) { ddeInstance = 0; @@ -967,7 +967,7 @@ DdeClientWindowProc( (struct DdeEnumServices *) lpcs->lpCreateParams; #ifdef _WIN64 - SetWindowLongPtr(hwnd, GWLP_USERDATA, (long)es); + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)es); #else SetWindowLongA(hwnd, GWL_USERDATA, (long)es); #endif @@ -1042,7 +1042,7 @@ DdeEnumWindowsCallback( HWND hwndTarget, LPARAM lParam) { - DWORD dwResult = 0; + DWORD_PTR dwResult = 0; struct DdeEnumServices *es = (struct DdeEnumServices *) lParam; SendMessageTimeoutA(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 0e3b33f..93c79eb 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.120 2011/01/12 07:32:02 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.121 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -985,7 +985,7 @@ TclpMatchInDirectory( } attr = GetFileAttributes(native); - if ((attr == INVALID_FILE_ATTRIBUTES) + if ((attr == INVALID_FILE_ATTRIBUTES) || ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0)) { return TCL_OK; } @@ -2054,7 +2054,7 @@ NativeStat( /* * We might have just been denied access */ - + WIN32_FIND_DATA ffd; HANDLE hFind; hFind = FindFirstFile(nativePath, &ffd); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index a859c8c..ab00b0f 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPipe.c,v 1.85 2010/10/12 10:21:55 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.86 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1574,7 +1574,6 @@ TclpCreateCommandChannel( Tcl_Pid *pidPtr) /* An array of process identifiers. */ { char channelName[16 + TCL_INTEGER_SPACE]; - int channelId; DWORD id; PipeInfo *infoPtr = (PipeInfo *) ckalloc((unsigned) sizeof(PipeInfo)); @@ -1593,20 +1592,6 @@ TclpCreateCommandChannel( infoPtr->writeError = 0; infoPtr->channel = NULL; - /* - * Use one of the fds associated with the channel as the channel id. - */ - - if (readFile) { - channelId = (int) ((WinFile *) readFile)->handle; - } else if (writeFile) { - channelId = (int) ((WinFile *) writeFile)->handle; - } else if (errorFile) { - channelId = (int) ((WinFile *) errorFile)->handle; - } else { - channelId = 0; - } - infoPtr->validMask = 0; infoPtr->threadId = Tcl_GetCurrentThread(); @@ -1647,7 +1632,7 @@ TclpCreateCommandChannel( * unique, in case channels share handles (stdin/stdout). */ - wsprintfA(channelName, "file%lx", infoPtr); + sprintf(channelName, "file%Ix", (size_t) infoPtr); infoPtr->channel = Tcl_CreateChannel(&pipeChannelType, channelName, infoPtr, infoPtr->validMask); diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 96aa3d8..22a8f72 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinReg.c,v 1.56 2010/11/03 12:09:23 nijtmans Exp $ + * RCS: @(#) $Id: tclWinReg.c,v 1.57 2011/01/25 22:33:56 nijtmans Exp $ */ #undef STATIC_BUILD @@ -1417,7 +1417,7 @@ BroadcastValue( Tcl_Obj *const objv[]) /* Argument values. */ { LRESULT result; - DWORD sendResult; + DWORD_PTR sendResult; UINT timeout = 3000; int len; const char *str; diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 2f8cbd9..986025d 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -11,7 +11,7 @@ * * Serial functionality implemented by Rolf.Schroedter@dlr.de * - * RCS: @(#) $Id: tclWinSerial.c,v 1.44 2010/09/13 14:20:38 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.45 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1503,7 +1503,7 @@ TclWinOpenSerialChannel( * are shared between multiple channels (stdin/stdout). */ - wsprintfA(channelName, "file%lx", (int) infoPtr); + sprintf(channelName, "file%Ix", (size_t) infoPtr); infoPtr->channel = Tcl_CreateChannel(&serialChannelType, channelName, infoPtr, permissions); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index c7df204..2e384ee 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.81 2010/12/14 17:22:55 rmax Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.82 2011/01/25 22:33:56 nijtmans Exp $ * * ----------------------------------------------------------------------- * @@ -1050,18 +1050,18 @@ CreateSocket( TclWinConvertWSAError((DWORD) WSAGetLastError()); continue; } - + /* * Win-NT has a misfeature that sockets are inherited in child * processes by default. Turn off the inherit bit. */ - + SetHandleInformation((HANDLE) sock, HANDLE_FLAG_INHERIT, 0); - + /* * Set kernel space buffering */ - + TclSockMinimumBuffers((ClientData)sock, TCP_BUFFER_SIZE); /* @@ -1103,34 +1103,34 @@ CreateSocket( chosenport = ntohs(sockname.sa4.sin_port); } } - + /* * Set the maximum number of pending connect requests to the max value * allowed on each platform (Win32 and Win32s may be different, and * there may be differences between TCP/IP stacks). */ - + if (listen(sock, SOMAXCONN) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); closesocket(sock); continue; } - + if (infoPtr == NULL) { /* * Add this socket to the global list of sockets. */ - + infoPtr = NewSocketInfo(sock); fds = infoPtr->sockets; - + /* * Set up the select mask for connection request events. */ - + infoPtr->selectEvents = FD_ACCEPT; infoPtr->watchEvents |= FD_ACCEPT; - + } else { newfds = (TcpFdList *) ckalloc((unsigned) sizeof(TcpFdList)); memset(newfds, (int) 0, sizeof(TcpFdList)); @@ -1159,7 +1159,7 @@ CreateSocket( TclWinConvertWSAError((DWORD) WSAGetLastError()); continue; } - + /* * Win-NT has a misfeature that sockets are inherited in child * processes by default. Turn off the inherit bit. @@ -1170,13 +1170,13 @@ CreateSocket( /* * Set kernel space buffering */ - + TclSockMinimumBuffers((ClientData)sock, TCP_BUFFER_SIZE); - + /* * Try to bind to a local port. */ - + if (bind(sock, myaddrPtr->ai_addr, myaddrPtr->ai_addrlen) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); @@ -1197,14 +1197,14 @@ CreateSocket( /* * Attempt to connect to the remote socket. */ - + if (connect(sock, addrPtr->ai_addr, addrPtr->ai_addrlen) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); if (Tcl_GetErrno() != EWOULDBLOCK) { goto looperror; } - + /* * The connection is progressing in the background. */ @@ -1227,14 +1227,14 @@ CreateSocket( /* * Add this socket to the global list of sockets. */ - + infoPtr = NewSocketInfo(sock); - + /* * Set up the select mask for read/write events. If the * connect attempt has not completed, include connect events. */ - + infoPtr->selectEvents = FD_READ | FD_WRITE | FD_CLOSE; if (asyncConnect) { infoPtr->flags |= SOCKET_ASYNC_CONNECT; @@ -1252,11 +1252,11 @@ CreateSocket( * Register for interest in events in the select mask. Note that this * automatically places the socket into non-blocking mode. */ - + if (infoPtr != NULL) { ioctlsocket(sock, (long) FIONBIO, &flag); SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) infoPtr); - + return infoPtr; } @@ -1455,7 +1455,7 @@ Tcl_OpenTcpClient( return NULL; } - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, (TCL_READABLE | TCL_WRITABLE)); @@ -1520,7 +1520,7 @@ Tcl_MakeTcpClientChannel( SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) infoPtr); - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, (TCL_READABLE | TCL_WRITABLE)); Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto crlf"); @@ -1573,7 +1573,7 @@ Tcl_OpenTcpServer( infoPtr->acceptProc = acceptProc; infoPtr->acceptProcData = acceptProcData; - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, 0); @@ -1679,7 +1679,7 @@ TcpAccept( SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) newInfoPtr); - wsprintfA(channelName, "sock%d", newInfoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) newInfoPtr->sockets->fd); newInfoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, newInfoPtr, (TCL_READABLE | TCL_WRITABLE)); if (Tcl_SetChannelOption(NULL, newInfoPtr->channel, "-translation", @@ -2171,7 +2171,7 @@ TcpGetOptionProc( address sockname; socklen_t size; int found = 0; - + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); @@ -2182,11 +2182,11 @@ TcpGetOptionProc( if (getsockname(sock, &(sockname.sa), &size) >= 0) { int flags = reverseDNS; found = 1; - + getnameinfo(&sockname.sa, size, host, sizeof(host), NULL, 0, NI_NUMERICHOST); Tcl_DStringAppendElement(dsPtr, host); - + /* * We don't want to resolve INADDR_ANY and sin6addr_any; they * can sometimes cause problems (and never have a name). @@ -2228,7 +2228,7 @@ TcpGetOptionProc( return TCL_ERROR; } } - + #ifdef TCL_FEATURE_KEEPALIVE_NAGLE if (len == 0 || !strncmp(optionName, "-keepalive", len)) { int optlen; diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 7154496..8c1d2f8 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -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: tclWinThrd.c,v 1.53 2010/06/16 14:49:51 nijtmans Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.54 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -263,7 +263,7 @@ TclpThreadExit( Tcl_ThreadId Tcl_GetCurrentThread(void) { - return (Tcl_ThreadId) GetCurrentThreadId(); + return (Tcl_ThreadId)(size_t)GetCurrentThreadId(); } /* |