diff options
author | nijtmans <nijtmans> | 2010-01-10 22:58:39 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-01-10 22:58:39 (GMT) |
commit | a81c8243240443b1ffe54faec5e49d7e5dba4ee6 (patch) | |
tree | dbbc67aa5fc759bc2ea978873fb23e5c3a614329 /win | |
parent | 997d61c0f6049d4bc0dd57aefc84e5f7f12c4ac2 (diff) | |
download | tcl-a81c8243240443b1ffe54faec5e49d7e5dba4ee6.zip tcl-a81c8243240443b1ffe54faec5e49d7e5dba4ee6.tar.gz tcl-a81c8243240443b1ffe54faec5e49d7e5dba4ee6.tar.bz2 |
* win/tclWinDde.c: VC++ 6.0 doesn't have
* win/tclWinReg.c PDWORD_PTR
* win/tclWinThrd.c: Fix various minor gcc warnings.
* win/tclWinTime.c
* win/tclWinConsole.c Put channel type definitions
* win/tclWinChan.c in static const memory
* win/tclWinPipe.c
* win/tclWinSerial.c
* win/tclWinSock.c
* generic/tclIOGT.c
* generic/tclIORChan.c
* generic/tclIORTrans.c
* unix/tclUnixChan.c
* unix/tclUnixPipe.c
* unix/tclUnixSock.c
* unix/configure (regenerated with autoconf 2.59)
* tests/info.test: Make test independant from
tcltest implementation.
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinChan.c | 6 | ||||
-rw-r--r-- | win/tclWinConsole.c | 6 | ||||
-rw-r--r-- | win/tclWinDde.c | 55 | ||||
-rw-r--r-- | win/tclWinPipe.c | 8 | ||||
-rw-r--r-- | win/tclWinReg.c | 23 | ||||
-rw-r--r-- | win/tclWinSerial.c | 6 | ||||
-rw-r--r-- | win/tclWinSock.c | 6 | ||||
-rw-r--r-- | win/tclWinThrd.c | 12 | ||||
-rw-r--r-- | win/tclWinTime.c | 10 |
9 files changed, 67 insertions, 65 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 0511ca2..c2bddb9 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.54 2009/11/18 21:59:49 nijtmans Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.55 2010/01/10 22:58:39 nijtmans Exp $ */ #include "tclWinInt.h" @@ -102,7 +102,7 @@ static DWORD FileGetType(HANDLE handle); * This structure describes the channel type structure for file based IO. */ -static Tcl_ChannelType fileChannelType = { +static const Tcl_ChannelType fileChannelType = { "file", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ FileCloseProc, /* Close proc. */ @@ -119,7 +119,7 @@ static Tcl_ChannelType fileChannelType = { NULL, /* handler proc. */ FileWideSeekProc, /* Wide seek proc. */ FileThreadActionProc, /* Thread action proc. */ - FileTruncateProc, /* Truncate proc. */ + FileTruncateProc /* Truncate proc. */ }; #ifdef HAVE_NO_SEH diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 880841a..16ea391 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.21 2009/11/18 21:59:49 nijtmans Exp $ + * RCS: @(#) $Id: tclWinConsole.c,v 1.22 2010/01/10 22:58:39 nijtmans Exp $ */ #include "tclWinInt.h" @@ -163,7 +163,7 @@ static void ConsoleThreadActionProc(ClientData instanceData, * based IO. */ -static Tcl_ChannelType consoleChannelType = { +static const Tcl_ChannelType consoleChannelType = { "console", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ ConsoleCloseProc, /* Close proc. */ @@ -180,7 +180,7 @@ static Tcl_ChannelType consoleChannelType = { NULL, /* handler proc. */ NULL, /* wide seek proc */ ConsoleThreadActionProc, /* thread action proc */ - NULL, /* truncation */ + NULL /* truncation */ }; /* diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 4f94e76..40c44b7 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.39 2009/12/21 23:25:41 nijtmans Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.40 2010/01/10 22:58:40 nijtmans Exp $ */ #undef STATIC_BUILD @@ -714,7 +714,7 @@ DdeServerProc( } if (convPtr != NULL) { - const char *returnString; + BYTE *returnString; len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINANSI); Tcl_DStringInit(&dString); @@ -723,9 +723,9 @@ DdeServerProc( DdeQueryString(ddeInstance, ddeItem, utilString, (DWORD) len + 1, CP_WINANSI); if (strcasecmp(utilString, TCL_DDE_EXECUTE_RESULT) == 0) { - returnString = + returnString = (BYTE *) Tcl_GetStringFromObj(convPtr->returnPackagePtr, &len); - ddeReturn = DdeCreateDataHandle(ddeInstance, (LPBYTE)returnString, + ddeReturn = DdeCreateDataHandle(ddeInstance, returnString, (DWORD) len+1, 0, ddeItem, CF_TEXT, 0); } else { if (Tcl_IsSafe(convPtr->riPtr->interp)) { @@ -735,10 +735,10 @@ DdeServerProc( convPtr->riPtr->interp, utilString, NULL, TCL_GLOBAL_ONLY); if (variableObjPtr != NULL) { - returnString = Tcl_GetStringFromObj(variableObjPtr, - &len); + returnString = (BYTE *) Tcl_GetStringFromObj( + variableObjPtr, &len); ddeReturn = DdeCreateDataHandle(ddeInstance, - (PBYTE)returnString, (DWORD) len+1, 0, ddeItem, + returnString, (DWORD) len+1, 0, ddeItem, CF_TEXT, 0); } else { ddeReturn = NULL; @@ -889,7 +889,7 @@ MakeDdeConnection( HCONV ddeConv; ddeService = DdeCreateStringHandle(ddeInstance, TCL_DDE_SERVICE_NAME, 0); - ddeTopic = DdeCreateStringHandle(ddeInstance, (LPTSTR) name, 0); + ddeTopic = DdeCreateStringHandle(ddeInstance, name, 0); ddeConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); DdeFreeStringHandle(ddeInstance, ddeService); @@ -1041,12 +1041,12 @@ DdeEnumWindowsCallback( HWND hwndTarget, LPARAM lParam) { - LRESULT dwResult = 0; + DWORD dwResult = 0; struct DdeEnumServices *es = (struct DdeEnumServices *) lParam; SendMessageTimeout(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, MAKELONG(es->service, es->topic), SMTO_ABORTIFHUNG, 1000, - (PDWORD_PTR) &dwResult); + &dwResult); return TRUE; } @@ -1173,7 +1173,8 @@ DdeObjCmd( HSZ ddeService = NULL, ddeTopic = NULL, ddeItem = NULL, ddeCookie = NULL; HDDEDATA ddeData = NULL, ddeItemData = NULL, ddeReturn; HCONV hConv = NULL; - const char *serviceName = NULL, *topicName = NULL, *string; + const char *serviceName = NULL, *topicName = NULL; + char *string; DWORD ddeResult; Tcl_Obj *objPtr, *handlerPtr = NULL; @@ -1322,7 +1323,7 @@ DdeObjCmd( if (length == 0) { serviceName = NULL; } else if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) { - ddeService = DdeCreateStringHandle(ddeInstance, (LPTSTR) serviceName, + ddeService = DdeCreateStringHandle(ddeInstance, serviceName, CP_WINANSI); } @@ -1331,7 +1332,7 @@ DdeObjCmd( if (length == 0) { topicName = NULL; } else { - ddeTopic = DdeCreateStringHandle(ddeInstance, (LPTSTR)topicName, + ddeTopic = DdeCreateStringHandle(ddeInstance, topicName, CP_WINANSI); } } @@ -1348,8 +1349,8 @@ DdeObjCmd( case DDE_EXECUTE: { int dataLength; - const char *dataString = Tcl_GetStringFromObj(objv[firstArg + 2], - &dataLength); + BYTE *dataString = (BYTE *) Tcl_GetStringFromObj( + objv[firstArg + 2], &dataLength); if (dataLength == 0) { Tcl_SetObjResult(interp, @@ -1367,7 +1368,7 @@ DdeObjCmd( break; } - ddeData = DdeCreateDataHandle(ddeInstance, (PBYTE)dataString, + ddeData = DdeCreateDataHandle(ddeInstance, dataString, (DWORD) dataLength+1, 0, 0, CF_TEXT, 0); if (ddeData != NULL) { if (async) { @@ -1407,7 +1408,7 @@ DdeObjCmd( result = TCL_ERROR; } else { Tcl_Obj *returnObjPtr; - ddeItem = DdeCreateStringHandle(ddeInstance, (char *)itemString, + ddeItem = DdeCreateStringHandle(ddeInstance, itemString, CP_WINANSI); if (ddeItem != NULL) { ddeData = DdeClientTransaction(NULL, 0, hConv, ddeItem, @@ -1417,13 +1418,13 @@ DdeObjCmd( result = TCL_ERROR; } else { DWORD tmp; - char *dataString = (char *) DdeAccessData(ddeData, &tmp); + const BYTE *dataString = DdeAccessData(ddeData, &tmp); if (binary) { - returnObjPtr = Tcl_NewByteArrayObj((unsigned char *)dataString, + returnObjPtr = Tcl_NewByteArrayObj(dataString, (int) tmp); } else { - returnObjPtr = Tcl_NewStringObj(dataString, -1); + returnObjPtr = Tcl_NewStringObj((char *)dataString, -1); } DdeUnaccessData(ddeData); DdeFreeDataHandle(ddeData); @@ -1439,7 +1440,7 @@ DdeObjCmd( } case DDE_POKE: { const char *itemString = Tcl_GetStringFromObj(objv[firstArg + 2], &length); - const char *dataString; + BYTE *dataString; if (length == 0) { Tcl_SetObjResult(interp, @@ -1447,7 +1448,7 @@ DdeObjCmd( result = TCL_ERROR; goto cleanup; } - dataString = Tcl_GetStringFromObj(objv[firstArg + 3], &length); + dataString = (BYTE *) Tcl_GetStringFromObj(objv[firstArg + 3], &length); hConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); DdeFreeStringHandle(ddeInstance, ddeService); @@ -1457,10 +1458,10 @@ DdeObjCmd( SetDdeError(interp); result = TCL_ERROR; } else { - ddeItem = DdeCreateStringHandle(ddeInstance, (LPTSTR)itemString, + ddeItem = DdeCreateStringHandle(ddeInstance, itemString, CP_WINANSI); if (ddeItem != NULL) { - ddeData = DdeClientTransaction((PBYTE)dataString, (DWORD) length+1, + ddeData = DdeClientTransaction(dataString, (DWORD) length+1, hConv, ddeItem, CF_TEXT, XTYP_POKE, 5000, NULL); if (ddeData == NULL) { SetDdeError(interp); @@ -1602,8 +1603,8 @@ DdeObjCmd( objPtr = Tcl_ConcatObj(objc, objv); string = Tcl_GetStringFromObj(objPtr, &length); - ddeItemData = DdeCreateDataHandle(ddeInstance, (PBYTE)string, - (DWORD) length+1, 0, 0, CF_TEXT, 0); + ddeItemData = DdeCreateDataHandle(ddeInstance, + (BYTE *) string, (DWORD) length+1, 0, 0, CF_TEXT, 0); if (async) { ddeData = DdeClientTransaction((LPBYTE) ddeItemData, @@ -1645,7 +1646,7 @@ DdeObjCmd( length = DdeGetData(ddeData, NULL, 0, 0); Tcl_SetObjLength(resultPtr, length); string = Tcl_GetString(resultPtr); - DdeGetData(ddeData, (PBYTE)string, (DWORD) length, 0); + DdeGetData(ddeData, (BYTE *) string, (DWORD) length, 0); Tcl_SetObjLength(resultPtr, (int) strlen(string)); if (Tcl_ListObjIndex(NULL, resultPtr, 0, &objPtr) != TCL_OK) { diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 1306e1c..2b00ccf 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.71 2009/12/21 23:25:41 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.72 2010/01/10 22:58:40 nijtmans Exp $ */ #include "tclWinInt.h" @@ -208,7 +208,7 @@ static void PipeThreadActionProc(ClientData instanceData, * I/O. */ -static Tcl_ChannelType pipeChannelType = { +static const Tcl_ChannelType pipeChannelType = { "pipe", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ TCL_CLOSE2PROC, /* Close proc. */ @@ -225,7 +225,7 @@ static Tcl_ChannelType pipeChannelType = { NULL, /* handler proc. */ NULL, /* wide seek proc */ PipeThreadActionProc, /* thread action proc */ - NULL, /* truncate */ + NULL /* truncate */ }; /* @@ -2740,7 +2740,7 @@ Tcl_PidObjCmd( return TCL_ERROR; } if (objc == 1) { - wsprintfA(buf, "%lu", (unsigned long) getpid()); + wsprintfA(buf, "%lu", (unsigned long) _getpid()); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); } else { chan = Tcl_GetChannel(interp, Tcl_GetStringFromObj(objv[1], NULL), diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 4e6ba89..195afd2 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.49 2009/11/23 20:17:36 nijtmans Exp $ + * RCS: @(#) $Id: tclWinReg.c,v 1.50 2010/01/10 22:58:40 nijtmans Exp $ */ #undef STATIC_BUILD @@ -709,8 +709,7 @@ GetType( DWORD result; DWORD type; Tcl_DString ds; - const char *valueName; - const char *nativeValue; + const char *valueName, *nativeValue; int length; /* @@ -778,8 +777,7 @@ GetValue( Tcl_Obj *valueNameObj) /* Name of value to get. */ { HKEY key; - const char *valueName; - const char *nativeValue; + const char *valueName, *nativeValue; DWORD result, length, type; Tcl_DString data, buf; int nameLen; @@ -880,7 +878,7 @@ GetValue( */ Tcl_SetObjResult(interp, Tcl_NewByteArrayObj( - (const unsigned char *)Tcl_DStringValue(&data), (int) length)); + (BYTE *) Tcl_DStringValue(&data), (int) length)); } Tcl_DStringFree(&data); return result; @@ -1394,15 +1392,15 @@ SetValue( (DWORD) type, (BYTE *) data, (DWORD) length); Tcl_DStringFree(&buf); } else { - char *data; + BYTE *data; /* * Store binary data in the registry. */ - data = (char *) Tcl_GetByteArrayFromObj(dataObj, &length); + data = (BYTE *) Tcl_GetByteArrayFromObj(dataObj, &length); result = regWinProcs->regSetValueExProc(key, valueName, 0, - (DWORD) type, (BYTE *) data, (DWORD) length); + (DWORD) type, data, (DWORD) length); } Tcl_DStringFree(&nameBuf); @@ -1440,7 +1438,8 @@ BroadcastValue( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - LRESULT result, sendResult; + LRESULT result; + DWORD sendResult; UINT timeout = 3000; int len; const char *str; @@ -1473,7 +1472,7 @@ BroadcastValue( */ result = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, - (WPARAM) 0, (LPARAM) str, SMTO_ABORTIFHUNG, timeout, (PDWORD_PTR) &sendResult); + (WPARAM) 0, (LPARAM) str, SMTO_ABORTIFHUNG, timeout, &sendResult); objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewLongObj((long) result)); @@ -1606,7 +1605,7 @@ ConvertDWORD( */ localType = (*((char*) &order) == 1) ? REG_DWORD : REG_DWORD_BIG_ENDIAN; - return (type != localType) ? (DWORD)SWAPLONG(value) : value; + return (type != localType) ? (DWORD) SWAPLONG(value) : value; } /* diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 94d2863..ecefc2e 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.39 2008/10/26 18:43:27 dkf Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.40 2010/01/10 22:58:40 nijtmans Exp $ */ #include "tclWinInt.h" @@ -203,7 +203,7 @@ static int SerialBlockingWrite(SerialInfo *infoPtr, LPVOID buf, * based IO. */ -static Tcl_ChannelType serialChannelType = { +static const Tcl_ChannelType serialChannelType = { "serial", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ SerialCloseProc, /* Close proc. */ @@ -220,7 +220,7 @@ static Tcl_ChannelType serialChannelType = { NULL, /* handler proc. */ NULL, /* wide seek proc */ SerialThreadActionProc, /* thread action proc */ - NULL, /* truncate */ + NULL /* truncate */ }; /* diff --git a/win/tclWinSock.c b/win/tclWinSock.c index c843260..457ca80 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.67 2009/12/21 23:25:41 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.68 2010/01/10 22:58:40 nijtmans Exp $ */ #include "tclWinInt.h" @@ -181,7 +181,7 @@ static Tcl_DriverGetHandleProc TcpGetHandleProc; * based IO. */ -static Tcl_ChannelType tcpChannelType = { +static const Tcl_ChannelType tcpChannelType = { "tcp", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ TcpCloseProc, /* Close proc. */ @@ -198,7 +198,7 @@ static Tcl_ChannelType tcpChannelType = { NULL, /* handler proc. */ NULL, /* wide seek proc */ TcpThreadActionProc, /* thread action proc */ - NULL, /* truncate */ + NULL /* truncate */ }; /* diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index e4850b0..2d483ae 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.50 2009/01/09 11:21:46 dkf Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.51 2010/01/10 22:58:40 nijtmans Exp $ */ #include "tclWinInt.h" @@ -44,8 +44,10 @@ static CRITICAL_SECTION initLock; #ifdef TCL_THREADS -static CRITICAL_SECTION allocLock; -static Tcl_Mutex allocLockPtr = (Tcl_Mutex) &allocLock; +static struct Tcl_Mutex_ { + CRITICAL_SECTION crit; +} allocLock; +static Tcl_Mutex allocLockPtr = &allocLock; static int allocOnce = 0; #endif /* TCL_THREADS */ @@ -413,7 +415,7 @@ Tcl_GetAllocMutex(void) { #ifdef TCL_THREADS if (!allocOnce) { - InitializeCriticalSection(&allocLock); + InitializeCriticalSection(&allocLock.crit); allocOnce = 1; } return &allocLockPtr; @@ -455,7 +457,7 @@ TclFinalizeLock(void) #ifdef TCL_THREADS if (allocOnce) { - DeleteCriticalSection(&allocLock); + DeleteCriticalSection(&allocLock.crit); allocOnce = 0; } #endif diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 6fa0017..9b30247 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.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: tclWinTime.c,v 1.35 2008/10/26 18:43:27 dkf Exp $ + * RCS: @(#) $Id: tclWinTime.c,v 1.36 2010/01/10 22:58:39 nijtmans Exp $ */ #include "tclInt.h" @@ -29,11 +29,11 @@ * month, where index 1 is January. */ -static int normalDays[] = { +static const int normalDays[] = { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 }; -static int leapDays[] = { +static const int leapDays[] = { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; @@ -89,7 +89,7 @@ typedef struct TimeInfo { } TimeInfo; static TimeInfo timeInfo = { - { NULL }, + { NULL, 0, 0, NULL, NULL, 0 }, 0, 0, (HANDLE) NULL, @@ -736,7 +736,7 @@ ComputeGMT( struct tm *tmPtr; long tmp, rem; int isLeap; - int *days; + const int *days; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); tmPtr = &tsdPtr->tm; |