diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-08-15 11:07:46 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-08-15 11:07:46 (GMT) |
commit | 092dd70e63fd7c5fcc9526b06c1242322378d492 (patch) | |
tree | 06c8f4cccd36e0b288f5a6f6334af32307f44b5e | |
parent | 17c90c83d4e0dda77c45f716df7eb3e37a7171da (diff) | |
download | tcl-092dd70e63fd7c5fcc9526b06c1242322378d492.zip tcl-092dd70e63fd7c5fcc9526b06c1242322378d492.tar.gz tcl-092dd70e63fd7c5fcc9526b06c1242322378d492.tar.bz2 |
[Bug 3388350] mingw64 compiler warnings
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win/tclWinChan.c | 17 | ||||
-rw-r--r-- | win/tclWinConsole.c | 4 | ||||
-rw-r--r-- | win/tclWinDde.c | 38 | ||||
-rw-r--r-- | win/tclWinPipe.c | 25 | ||||
-rw-r--r-- | win/tclWinReg.c | 11 | ||||
-rw-r--r-- | win/tclWinSerial.c | 4 | ||||
-rw-r--r-- | win/tclWinSock.c | 5 | ||||
-rw-r--r-- | win/tclWinTest.c | 2 |
9 files changed, 41 insertions, 71 deletions
@@ -4,6 +4,12 @@ * win/configure * win/tclMtherr.c * win/tclWinPort.h + * win/tclWinChan.c + * win/tclWinDde.c + * win/tclWinPipe.c + * win/tclWinReg.c + * win/tclWinSerial.c + * win/tclWinSock.c * win/tclWinTest.c * win/tclWinTime.c * generic/tclPosixStr.c diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 767fa94..67a12a0 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -475,8 +475,7 @@ FileSeekProc(instanceData, offset, mode, errorCodePtr) { FileInfo *infoPtr = (FileInfo *) instanceData; DWORD moveMethod; - DWORD newPos, newPosHigh; - DWORD oldPos, oldPosHigh; + LONG newPos, newPosHigh, oldPos, oldPosHigh; *errorCodePtr = 0; if (mode == SEEK_SET) { @@ -552,7 +551,7 @@ FileWideSeekProc(instanceData, offset, mode, errorCodePtr) { FileInfo *infoPtr = (FileInfo *) instanceData; DWORD moveMethod; - DWORD newPos, newPosHigh; + LONG newPos, newPosHigh; *errorCodePtr = 0; if (mode == SEEK_SET) { @@ -781,8 +780,8 @@ TclpOpenFileChannel(interp, pathPtr, mode, permissions) * it? */ { Tcl_Channel channel = 0; - int channelPermissions; - DWORD accessMode, createMode, shareMode, flags; + int channelPermissions = 0; + DWORD accessMode = 0, createMode, shareMode, flags; CONST TCHAR *nativeName; HANDLE handle; char channelName[16 + TCL_INTEGER_SPACE]; @@ -1160,10 +1159,10 @@ TclpGetDefaultStdChannel(type) { Tcl_Channel channel; HANDLE handle; - int mode; - char *bufMode; - DWORD handleId; /* Standard handle to retrieve. */ - + int mode = -1; + char *bufMode = NULL; + DWORD handleId = (DWORD)INVALID_HANDLE_VALUE; + /* Standard handle to retrieve. */ switch (type) { case TCL_STDIN: diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 9000da2..f0dd62c 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -1113,7 +1113,7 @@ ConsoleReaderThread(LPVOID arg) { ConsoleInfo *infoPtr = (ConsoleInfo *)arg; HANDLE *handle = infoPtr->handle; - DWORD count, waitResult; + DWORD waitResult; HANDLE wEvents[2]; /* The first event takes precedence. */ @@ -1136,8 +1136,6 @@ ConsoleReaderThread(LPVOID arg) break; } - count = 0; - /* * Look for data on the console, but first ignore any events * that are not KEY_EVENTs diff --git a/win/tclWinDde.c b/win/tclWinDde.c index ee9019a..f16625c 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -122,16 +122,12 @@ int Dde_Init( Tcl_Interp *interp) { - ThreadSpecificData *tsdPtr; - if (!Tcl_InitStubs(interp, "8.0", 0)) { return TCL_ERROR; } Tcl_CreateObjCommand(interp, "dde", Tcl_DdeObjCmd, NULL, NULL); - tsdPtr = TCL_TSD_INIT(&dataKey); - Tcl_CreateExitHandler(DdeExitProc, NULL); return Tcl_PkgProvide(interp, TCL_DDE_PACKAGE_NAME, TCL_DDE_VERSION); @@ -236,7 +232,6 @@ DdeSetServerName( * unique. */ ) { - int suffix, offset; RegisteredInterp *riPtr, *prevPtr; Tcl_DString dString; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -285,8 +280,6 @@ DdeSetServerName( * unique. */ - suffix = 1; - offset = 0; Tcl_DStringInit(&dString); /* @@ -558,7 +551,7 @@ DdeServerProc ( } if (convPtr != NULL) { - char *returnString; + BYTE *returnString; len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINANSI); @@ -569,7 +562,7 @@ DdeServerProc ( (DWORD) len + 1, CP_WINANSI); if (stricmp(utilString, "$TCLEVAL$EXECUTE$RESULT") == 0) { returnString = - Tcl_GetStringFromObj(convPtr->returnPackagePtr, &len); + (BYTE *)Tcl_GetStringFromObj(convPtr->returnPackagePtr, &len); ddeReturn = DdeCreateDataHandle(ddeInstance, returnString, (DWORD) len+1, 0, ddeItem, CF_TEXT, 0); @@ -578,7 +571,7 @@ DdeServerProc ( convPtr->riPtr->interp, utilString, NULL, TCL_GLOBAL_ONLY); if (variableObjPtr != NULL) { - returnString = Tcl_GetStringFromObj(variableObjPtr, + returnString = (BYTE *)Tcl_GetStringFromObj(variableObjPtr, &len); ddeReturn = DdeCreateDataHandle(ddeInstance, returnString, (DWORD) len+1, 0, ddeItem, @@ -881,7 +874,7 @@ DdeServicesOnAck(HWND hwnd, WPARAM wParam, LPARAM lParam) static BOOL CALLBACK DdeEnumWindowsCallback(HWND hwndTarget, LPARAM lParam) { - LRESULT dwResult = 0; + DWORD_PTR dwResult = 0; ddeEnumServices *es = (ddeEnumServices *)lParam; SendMessageTimeout(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, @@ -894,12 +887,11 @@ static int DdeGetServicesList(Tcl_Interp *interp, char *serviceName, char *topicName) { ddeEnumServices es; - int r = TCL_OK; es.interp = interp; es.result = TCL_OK; - es.service = (serviceName == NULL) + es.service = (serviceName == NULL) ? (ATOM)NULL : GlobalAddAtom(serviceName); - es.topic = (topicName == NULL) + es.topic = (topicName == NULL) ? (ATOM)NULL : GlobalAddAtom(topicName); Tcl_ResetResult(interp); /* our list is to be appended to result. */ @@ -1011,9 +1003,9 @@ Tcl_DdeObjCmd( HDDEDATA ddeItemData = NULL; HCONV hConv = NULL; HSZ ddeCookie = 0; - char *serviceName, *topicName, *itemString, *dataString; + char *serviceName, *topicName = NULL, *itemString; char *string; - int firstArg, length, dataLength; + int firstArg = 0, length, dataLength; DWORD ddeResult; HDDEDATA ddeReturn; RegisteredInterp *riPtr; @@ -1174,7 +1166,8 @@ Tcl_DdeObjCmd( break; } case DDE_EXECUTE: { - dataString = Tcl_GetStringFromObj(objv[firstArg + 2], &dataLength); + BYTE *dataString = (BYTE *) Tcl_GetStringFromObj( + objv[firstArg + 2], &dataLength); if (dataLength == 0) { Tcl_SetStringObj(Tcl_GetObjResult(interp), "cannot execute null data", -1); @@ -1240,13 +1233,13 @@ Tcl_DdeObjCmd( result = TCL_ERROR; } else { DWORD tmp; - dataString = DdeAccessData(ddeData, &tmp); + BYTE *dataString = (BYTE *) DdeAccessData(ddeData, &tmp); dataLength = tmp; if (binary) { returnObjPtr = Tcl_NewByteArrayObj(dataString, dataLength); } else { - returnObjPtr = Tcl_NewStringObj(dataString, -1); + returnObjPtr = Tcl_NewStringObj((char *) dataString, -1); } DdeUnaccessData(ddeData); DdeFreeDataHandle(ddeData); @@ -1262,12 +1255,13 @@ Tcl_DdeObjCmd( } case DDE_POKE: { itemString = Tcl_GetStringFromObj(objv[firstArg + 2], &length); + BYTE *dataString; if (length == 0) { Tcl_SetStringObj(Tcl_GetObjResult(interp), "cannot have a null item", -1); goto errorNoResult; } - dataString = Tcl_GetStringFromObj(objv[firstArg + 3], &length); + dataString = (BYTE *) Tcl_GetStringFromObj(objv[firstArg + 3], &length); hConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); DdeFreeStringHandle(ddeInstance, ddeService); @@ -1387,7 +1381,7 @@ Tcl_DdeObjCmd( objPtr = Tcl_ConcatObj(objc, objv); string = Tcl_GetStringFromObj(objPtr, &length); - ddeItemData = DdeCreateDataHandle(ddeInstance, string, + ddeItemData = DdeCreateDataHandle(ddeInstance, (BYTE *) string, (DWORD) length+1, 0, 0, CF_TEXT, 0); if (async) { @@ -1431,7 +1425,7 @@ Tcl_DdeObjCmd( length = DdeGetData(ddeData, NULL, 0, 0); Tcl_SetObjLength(resultPtr, length); string = Tcl_GetString(resultPtr); - DdeGetData(ddeData, string, (DWORD) length, 0); + DdeGetData(ddeData, (BYTE *) string, (DWORD) length, 0); Tcl_SetObjLength(resultPtr, (int) strlen(string)); if (Tcl_ListObjIndex(NULL, resultPtr, 0, &objPtr) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index a493bca..f15daa5 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -324,7 +324,6 @@ PipeSetupProc( PipeInfo *infoPtr; Tcl_Time blockTime = { 0, 0 }; int block = 1; - WinFile *filePtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (!(flags & TCL_FILE_EVENTS)) { @@ -338,13 +337,11 @@ PipeSetupProc( for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; infoPtr = infoPtr->nextPtr) { if (infoPtr->watchMask & TCL_WRITABLE) { - filePtr = (WinFile*) infoPtr->writeFile; if (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT) { block = 0; } } if (infoPtr->watchMask & TCL_READABLE) { - filePtr = (WinFile*) infoPtr->readFile; if (WaitForRead(infoPtr, 0) >= 0) { block = 0; } @@ -379,7 +376,6 @@ PipeCheckProc( { PipeInfo *infoPtr; PipeEvent *evPtr; - WinFile *filePtr; int needEvent; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -403,13 +399,11 @@ PipeCheckProc( */ needEvent = 0; - filePtr = (WinFile*) infoPtr->writeFile; if ((infoPtr->watchMask & TCL_WRITABLE) && (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT)) { needEvent = 1; } - filePtr = (WinFile*) infoPtr->readFile; if ((infoPtr->watchMask & TCL_READABLE) && (WaitForRead(infoPtr, 0) >= 0)) { needEvent = 1; @@ -1651,7 +1645,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)); @@ -1670,21 +1663,6 @@ TclpCreateCommandChannel( infoPtr->writeError = 0; infoPtr->channel = (Tcl_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(); @@ -2291,7 +2269,6 @@ PipeEventProc( { PipeEvent *pipeEvPtr = (PipeEvent *)evPtr; PipeInfo *infoPtr; - WinFile *filePtr; int mask; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -2328,14 +2305,12 @@ PipeEventProc( * as being writable unless we have detected EOF. */ - filePtr = (WinFile*) ((PipeInfo*)infoPtr)->writeFile; mask = 0; if ((infoPtr->watchMask & TCL_WRITABLE) && (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT)) { mask = TCL_WRITABLE; } - filePtr = (WinFile*) ((PipeInfo*)infoPtr)->readFile; if ((infoPtr->watchMask & TCL_READABLE) && (WaitForRead(infoPtr, 0) >= 0)) { if (infoPtr->readFlags & PIPE_EOF) { diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 98e6548..a73be77 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -253,7 +253,7 @@ RegistryObjCmd( Tcl_Obj * CONST objv[]) /* Argument values. */ { int index; - char *errString; + char *errString = NULL; static CONST char *subcommands[] = { "broadcast", "delete", "get", "keys", "set", "type", "values", @@ -806,7 +806,7 @@ GetValue( * Save binary data as a byte array. */ - Tcl_SetByteArrayObj(resultPtr, Tcl_DStringValue(&data), (int) length); + Tcl_SetByteArrayObj(resultPtr, (BYTE *) Tcl_DStringValue(&data), (int) length); } Tcl_DStringFree(&data); return result; @@ -1327,7 +1327,7 @@ SetValue( (BYTE*)data, (DWORD) length); Tcl_DStringFree(&buf); } else { - char *data; + BYTE *data; /* * Store binary data in the registry. @@ -1335,7 +1335,7 @@ SetValue( data = Tcl_GetByteArrayFromObj(dataObj, &length); result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type, - (BYTE *)data, (DWORD) length); + data, (DWORD) length); } Tcl_DStringFree(&nameBuf); RegCloseKey(key); @@ -1371,7 +1371,8 @@ BroadcastValue( int objc, /* Number of arguments. */ Tcl_Obj * CONST objv[]) /* Argument values. */ { - LRESULT result, sendResult; + LRESULT result; + DWORD_PTR sendResult; UINT timeout = 3000; int len; char *str; diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 3c8dc9f..24c6a67 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1385,9 +1385,7 @@ TclWinSerialReopen(handle, name, access) CONST TCHAR *name; DWORD access; { - ThreadSpecificData *tsdPtr; - - tsdPtr = SerialInit(); + SerialInit(); /* * Multithreaded I/O needs the overlapped flag set diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 73820ea..f3fe979 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1008,7 +1008,6 @@ TcpCloseProc(instanceData, interp) SocketInfo *infoPtr = (SocketInfo *) instanceData; /* TIP #218 */ int errorCode = 0; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); /* * Check that WinSock is initialized; do not call it if not, to @@ -1988,9 +1987,9 @@ TcpSetOptionProc ( CONST char *optionName, /* Name of the option to set. */ CONST char *value) /* New value for option. */ { +/* SocketInfo *infoPtr; SOCKET sock; -/* BOOL val = FALSE; int boolVar, rtn; */ @@ -2008,10 +2007,10 @@ TcpSetOptionProc ( return TCL_ERROR; } +/* infoPtr = (SocketInfo *) instanceData; sock = infoPtr->socket; -/* if (!stricmp(optionName, "-keepalive")) { if (Tcl_GetBoolean(interp, value, &boolVar) != TCL_OK) { return TCL_ERROR; diff --git a/win/tclWinTest.c b/win/tclWinTest.c index ba35ec7..186d308 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -758,7 +758,7 @@ TestplatformChmod(CONST char *nativePath, int pmode) } done: - if (secDesc) ckfree(secDesc); + if (secDesc) ckfree((char *)secDesc); if (newAcl) ckfree((char *)newAcl); if (userSid) ckfree((char *)userSid); if (userDomain) ckfree(userDomain); |