summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-28 12:46:42 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-28 12:46:42 (GMT)
commit4af90e27e5e22978b56d6cb5d0d1ecd90af0f48f (patch)
treed5db4ca8a1fecbd63d9e72730fad2f404367daff /win
parent63994a73e3f641451b26f48f697b6a069863751c (diff)
parent52e543c5691a60c3ef802fecf1ae08e7efcf19b7 (diff)
downloadtcl-4af90e27e5e22978b56d6cb5d0d1ecd90af0f48f.zip
tcl-4af90e27e5e22978b56d6cb5d0d1ecd90af0f48f.tar.gz
tcl-4af90e27e5e22978b56d6cb5d0d1ecd90af0f48f.tar.bz2
Merge 8.7
Diffstat (limited to 'win')
-rwxr-xr-xwin/configure2
-rw-r--r--win/tcl.m44
-rw-r--r--win/tclAppInit.c6
-rw-r--r--win/tclWin32Dll.c10
-rw-r--r--win/tclWinChan.c39
-rw-r--r--win/tclWinConsole.c48
-rw-r--r--win/tclWinDde.c2
-rw-r--r--win/tclWinFCmd.c23
-rw-r--r--win/tclWinFile.c40
-rw-r--r--win/tclWinInit.c8
-rw-r--r--win/tclWinLoad.c16
-rw-r--r--win/tclWinPipe.c28
-rw-r--r--win/tclWinReg.c2
-rw-r--r--win/tclWinSerial.c27
-rw-r--r--win/tclWinSock.c83
-rw-r--r--win/tclWinTest.c18
-rw-r--r--win/tclWinThrd.c14
-rw-r--r--win/tclWinTime.c15
18 files changed, 226 insertions, 159 deletions
diff --git a/win/configure b/win/configure
index 5e1adc5..c210d89 100755
--- a/win/configure
+++ b/win/configure
@@ -4196,7 +4196,7 @@ $as_echo "using shared flags" >&6; }
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wsign-compare -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
diff --git a/win/tcl.m4 b/win/tcl.m4
index 4728cdf..6ad7cf9 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -685,7 +685,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -694,7 +694,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
;;
*)
- CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -Wdeclaration-after-statement"
;;
esac
diff --git a/win/tclAppInit.c b/win/tclAppInit.c
index 3292335..3e95e3b 100644
--- a/win/tclAppInit.c
+++ b/win/tclAppInit.c
@@ -90,14 +90,16 @@ main(
char *dummy[]) /* Not used. */
{
TCHAR **argv;
+ TCHAR *p;
+ (void)dummy;
#else
int
_tmain(
int argc, /* Number of command-line arguments. */
TCHAR *argv[]) /* Values of command-line arguments. */
{
-#endif
TCHAR *p;
+#endif
/*
* Set up the default locale to be standard "C" locale so parsing is
@@ -270,7 +272,7 @@ setargv(
/* Make sure we don't call Tcl_Alloc through the (not yet initialized) stub table */
# undef Tcl_Alloc
- argSpace = Tcl_Alloc(size * sizeof(char *)
+ argSpace = (TCHAR *)Tcl_Alloc(size * sizeof(char *)
+ (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR));
argv = (TCHAR **) argSpace;
argSpace += size * (sizeof(char *)/sizeof(TCHAR));
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 8299eed..fc6fd16 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -119,6 +119,8 @@ DllMain(
DWORD reason, /* Reason this function is being called. */
LPVOID reserved) /* Not used. */
{
+ (void)reserved;
+
switch (reason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInst);
@@ -385,8 +387,8 @@ TclWinDriveLetterForVolMountPoint(
}
}
if (!alreadyStored) {
- dlPtr2 = Tcl_Alloc(sizeof(MountPointMap));
- dlPtr2->volumeName = TclNativeDupInternalRep(Target);
+ dlPtr2 = (MountPointMap *)Tcl_Alloc(sizeof(MountPointMap));
+ dlPtr2->volumeName = (WCHAR *)TclNativeDupInternalRep(Target);
dlPtr2->driveLetter = (char) drive[0];
dlPtr2->nextPtr = driveLetterLookup;
driveLetterLookup = dlPtr2;
@@ -411,8 +413,8 @@ TclWinDriveLetterForVolMountPoint(
* that fact and store '-1' so we don't have to look it up each time.
*/
- dlPtr2 = Tcl_Alloc(sizeof(MountPointMap));
- dlPtr2->volumeName = TclNativeDupInternalRep((ClientData) mountPoint);
+ dlPtr2 = (MountPointMap *)Tcl_Alloc(sizeof(MountPointMap));
+ dlPtr2->volumeName = (WCHAR *)TclNativeDupInternalRep((ClientData) mountPoint);
dlPtr2->driveLetter = -1;
dlPtr2->nextPtr = driveLetterLookup;
driveLetterLookup = dlPtr2;
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index f5b324f..23a3545 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -180,8 +180,10 @@ FileInit(void)
static void
FileChannelExitHandler(
- ClientData clientData) /* Old window proc */
+ ClientData dummy) /* Old window proc */
{
+ (void)dummy;
+
Tcl_DeleteEventSource(FileSetupProc, FileCheckProc, NULL);
}
@@ -204,12 +206,13 @@ FileChannelExitHandler(
void
FileSetupProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
FileInfo *infoPtr;
Tcl_Time blockTime = { 0, 0 };
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!TEST_FLAG(flags, TCL_FILE_EVENTS)) {
return;
@@ -247,12 +250,13 @@ FileSetupProc(
static void
FileCheckProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
FileEvent *evPtr;
FileInfo *infoPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!TEST_FLAG(flags, TCL_FILE_EVENTS)) {
return;
@@ -267,7 +271,7 @@ FileCheckProc(
infoPtr = infoPtr->nextPtr) {
if (infoPtr->watchMask && !TEST_FLAG(infoPtr->flags, FILE_PENDING)) {
SET_FLAG(infoPtr->flags, FILE_PENDING);
- evPtr = Tcl_Alloc(sizeof(FileEvent));
+ evPtr = (FileEvent *)Tcl_Alloc(sizeof(FileEvent));
evPtr->header.proc = FileEventProc;
evPtr->infoPtr = infoPtr;
Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL);
@@ -350,7 +354,7 @@ FileBlockProc(
int mode) /* TCL_MODE_BLOCKING or
* TCL_MODE_NONBLOCKING. */
{
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
/*
* Files on Windows can not be switched between blocking and nonblocking,
@@ -386,12 +390,13 @@ FileBlockProc(
static int
FileCloseProc(
ClientData instanceData, /* Pointer to FileInfo structure. */
- Tcl_Interp *interp) /* Not used. */
+ Tcl_Interp *dummy) /* Not used. */
{
- FileInfo *fileInfoPtr = instanceData;
+ FileInfo *fileInfoPtr = (FileInfo *)instanceData;
FileInfo *infoPtr;
ThreadSpecificData *tsdPtr;
int errorCode = 0;
+ (void)dummy;
/*
* Remove the file from the watch list.
@@ -463,7 +468,7 @@ FileSeekProc(
int mode, /* Relative to where should we seek? */
int *errorCodePtr) /* To store error code. */
{
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
LONG newPos, newPosHigh, oldPos, oldPosHigh;
DWORD moveMethod;
@@ -541,7 +546,7 @@ FileWideSeekProc(
int mode, /* Relative to where should we seek? */
int *errorCodePtr) /* To store error code. */
{
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
DWORD moveMethod;
LONG newPos, newPosHigh;
@@ -591,7 +596,7 @@ FileTruncateProc(
ClientData instanceData, /* File state. */
Tcl_WideInt length) /* Length to truncate at. */
{
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
LONG newPos, newPosHigh, oldPos, oldPosHigh;
/*
@@ -669,7 +674,7 @@ FileInputProc(
int bufSize, /* Num bytes available in buffer. */
int *errorCode) /* Where to store error code. */
{
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
DWORD bytesRead;
*errorCode = 0;
@@ -724,7 +729,7 @@ FileOutputProc(
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
DWORD bytesWritten;
*errorCode = 0;
@@ -771,7 +776,7 @@ FileWatchProc(
* of TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
{
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
Tcl_Time blockTime = { 0, 0 };
/*
@@ -809,7 +814,7 @@ FileGetHandleProc(
int direction, /* TCL_READABLE or TCL_WRITABLE */
ClientData *handlePtr) /* Where to store the handle. */
{
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
if (!TEST_FLAG(direction, infoPtr->validMask)) {
return TCL_ERROR;
@@ -854,7 +859,7 @@ TclpOpenFileChannel(
char channelName[16 + TCL_INTEGER_SPACE];
TclFile readFile = NULL, writeFile = NULL;
- nativeName = Tcl_FSGetNativePath(pathPtr);
+ nativeName = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (nativeName == NULL) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1365,7 +1370,7 @@ TclWinOpenFileChannel(
}
}
- infoPtr = Tcl_Alloc(sizeof(FileInfo));
+ infoPtr = (FileInfo *)Tcl_Alloc(sizeof(FileInfo));
/*
* TIP #218. Removed the code inserting the new structure into the global
@@ -1456,7 +1461,7 @@ FileThreadActionProc(
int action)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- FileInfo *infoPtr = instanceData;
+ FileInfo *infoPtr = (FileInfo *)instanceData;
if (action == TCL_CHANNEL_THREAD_INSERT) {
infoPtr->nextPtr = tsdPtr->firstFilePtr;
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c
index f1bb75c..b92be89 100644
--- a/win/tclWinConsole.c
+++ b/win/tclWinConsole.c
@@ -317,8 +317,10 @@ ConsoleInit(void)
static void
ConsoleExitHandler(
- ClientData clientData) /* Old window proc. */
+ ClientData dummy) /* Old window proc. */
{
+ (void)dummy;
+
Tcl_DeleteEventSource(ConsoleSetupProc, ConsoleCheckProc, NULL);
}
@@ -341,8 +343,10 @@ ConsoleExitHandler(
static void
ProcExitHandler(
- ClientData clientData) /* Old window proc. */
+ ClientData dummy) /* Old window proc. */
{
+ (void)dummy;
+
Tcl_MutexLock(&consoleMutex);
initialized = 0;
Tcl_MutexUnlock(&consoleMutex);
@@ -367,13 +371,14 @@ ProcExitHandler(
void
ConsoleSetupProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
ConsoleInfo *infoPtr;
Tcl_Time blockTime = { 0, 0 };
int block = 1;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!(flags & TCL_FILE_EVENTS)) {
return;
@@ -421,12 +426,13 @@ ConsoleSetupProc(
static void
ConsoleCheckProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
ConsoleInfo *infoPtr;
int needEvent;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!(flags & TCL_FILE_EVENTS)) {
return;
@@ -462,7 +468,7 @@ ConsoleCheckProc(
}
if (needEvent) {
- ConsoleEvent *evPtr = Tcl_Alloc(sizeof(ConsoleEvent));
+ ConsoleEvent *evPtr = (ConsoleEvent *)Tcl_Alloc(sizeof(ConsoleEvent));
infoPtr->flags |= CONSOLE_PENDING;
evPtr->header.proc = ConsoleEventProc;
@@ -494,7 +500,7 @@ ConsoleBlockModeProc(
int mode) /* TCL_MODE_BLOCKING or
* TCL_MODE_NONBLOCKING. */
{
- ConsoleInfo *infoPtr = instanceData;
+ ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData;
/*
* Consoles on Windows can not be switched between blocking and
@@ -531,12 +537,13 @@ ConsoleBlockModeProc(
static int
ConsoleCloseProc(
ClientData instanceData, /* Pointer to ConsoleInfo structure. */
- Tcl_Interp *interp) /* For error reporting. */
+ Tcl_Interp *dummy) /* For error reporting. */
{
- ConsoleInfo *consolePtr = instanceData;
+ ConsoleInfo *consolePtr = (ConsoleInfo *)instanceData;
int errorCode = 0;
ConsoleInfo *infoPtr, **nextPtrPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
/*
* Clean up the background thread if necessary. Note that this must be
@@ -651,7 +658,7 @@ ConsoleInputProc(
* buffer? */
int *errorCode) /* Where to store error code. */
{
- ConsoleInfo *infoPtr = instanceData;
+ ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData;
DWORD count, bytesRead = 0;
int result;
@@ -743,7 +750,7 @@ ConsoleOutputProc(
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
- ConsoleInfo *infoPtr = instanceData;
+ ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData;
ConsoleThreadInfo *threadInfo = &infoPtr->writer;
DWORD bytesWritten, timeout;
@@ -787,7 +794,7 @@ ConsoleOutputProc(
Tcl_Free(infoPtr->writeBuf);
}
infoPtr->writeBufLen = toWrite;
- infoPtr->writeBuf = Tcl_Alloc(toWrite);
+ infoPtr->writeBuf = (char *)Tcl_Alloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
@@ -928,7 +935,7 @@ ConsoleWatchProc(
* TCL_EXCEPTION. */
{
ConsoleInfo **nextPtrPtr, *ptr;
- ConsoleInfo *infoPtr = instanceData;
+ ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData;
int oldMask = infoPtr->watchMask;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -986,7 +993,8 @@ ConsoleGetHandleProc(
int direction, /* TCL_READABLE or TCL_WRITABLE. */
ClientData *handlePtr) /* Where to store the handle. */
{
- ConsoleInfo *infoPtr = instanceData;
+ ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData;
+ (void)direction;
*handlePtr = infoPtr->handle;
return TCL_OK;
@@ -1020,7 +1028,7 @@ WaitForRead(
* or not. */
{
DWORD timeout, count;
- HANDLE *handle = infoPtr->handle;
+ HANDLE *handle = (HANDLE *)infoPtr->handle;
ConsoleThreadInfo *threadInfo = &infoPtr->reader;
INPUT_RECORD input;
@@ -1136,7 +1144,7 @@ ConsoleReaderThread(
}
if (!infoPtr) {
infoPtr = (ConsoleInfo *)pipeTI->clientData;
- handle = infoPtr->handle;
+ handle = (HANDLE *)infoPtr->handle;
threadInfo = &infoPtr->reader;
}
@@ -1234,7 +1242,7 @@ ConsoleWriterThread(
}
if (!infoPtr) {
infoPtr = (ConsoleInfo *)pipeTI->clientData;
- handle = infoPtr->handle;
+ handle = (HANDLE *)infoPtr->handle;
threadInfo = &infoPtr->writer;
}
@@ -1321,7 +1329,7 @@ TclWinOpenConsoleChannel(
* See if a channel with this handle already exists.
*/
- infoPtr = Tcl_Alloc(sizeof(ConsoleInfo));
+ infoPtr = (ConsoleInfo *)Tcl_Alloc(sizeof(ConsoleInfo));
memset(infoPtr, 0, sizeof(ConsoleInfo));
infoPtr->validMask = permissions;
@@ -1405,7 +1413,7 @@ ConsoleThreadActionProc(
ClientData instanceData,
int action)
{
- ConsoleInfo *infoPtr = instanceData;
+ ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData;
/*
* We do not access firstConsolePtr in the thread structures. This is not
@@ -1459,7 +1467,7 @@ ConsoleSetOptionProc(
const char *optionName, /* Which option to set? */
const char *value) /* New value for option. */
{
- ConsoleInfo *infoPtr = instanceData;
+ ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData;
int len = strlen(optionName);
int vlen = strlen(value);
@@ -1557,7 +1565,7 @@ ConsoleGetOptionProc(
const char *optionName, /* Option to get. */
Tcl_DString *dsPtr) /* Where to store value(s). */
{
- ConsoleInfo *infoPtr = instanceData;
+ ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData;
int valid = 0; /* Flag if valid option parsed. */
unsigned int len;
char buf[TCL_INTEGER_SPACE];
diff --git a/win/tclWinDde.c b/win/tclWinDde.c
index a4c00fa..2fc4990 100644
--- a/win/tclWinDde.c
+++ b/win/tclWinDde.c
@@ -251,7 +251,7 @@ Initialize(void)
if (ddeInstance == 0) {
Tcl_MutexLock(&ddeMutex);
if (ddeInstance == 0) {
- if (DdeInitializeW(&ddeInstance, (PFNCALLBACK) DdeServerProc,
+ if (DdeInitializeW(&ddeInstance, (PFNCALLBACK)(void *)DdeServerProc,
CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS
| CBF_FAIL_POKES, 0) != DMLERR_NO_ERROR) {
ddeInstance = 0;
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index b796b29..960188e 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -145,8 +145,8 @@ TclpObjRenameFile(
Tcl_Obj *srcPathPtr,
Tcl_Obj *destPathPtr)
{
- return DoRenameFile(Tcl_FSGetNativePath(srcPathPtr),
- Tcl_FSGetNativePath(destPathPtr));
+ return DoRenameFile((const WCHAR *)Tcl_FSGetNativePath(srcPathPtr),
+ (const WCHAR *)Tcl_FSGetNativePath(destPathPtr));
}
static int
@@ -536,8 +536,8 @@ TclpObjCopyFile(
Tcl_Obj *srcPathPtr,
Tcl_Obj *destPathPtr)
{
- return DoCopyFile(Tcl_FSGetNativePath(srcPathPtr),
- Tcl_FSGetNativePath(destPathPtr));
+ return DoCopyFile((const WCHAR *)Tcl_FSGetNativePath(srcPathPtr),
+ (const WCHAR *)Tcl_FSGetNativePath(destPathPtr));
}
static int
@@ -751,7 +751,7 @@ TclpDeleteFile(
const void *nativePath) /* Pathname of file to be removed (native). */
{
DWORD attr;
- const WCHAR *path = nativePath;
+ const WCHAR *path = (const WCHAR *)nativePath;
/*
* The DeleteFile API acts differently under Win95/98 and NT WRT NULL and
@@ -856,7 +856,7 @@ int
TclpObjCreateDirectory(
Tcl_Obj *pathPtr)
{
- return DoCreateDirectory(Tcl_FSGetNativePath(pathPtr));
+ return DoCreateDirectory((const WCHAR *)Tcl_FSGetNativePath(pathPtr));
}
static int
@@ -993,7 +993,7 @@ TclpObjRemoveDirectory(
ret = DoRemoveDirectory(&native, recursive, &ds);
Tcl_DStringFree(&native);
} else {
- ret = DoRemoveJustDirectory(Tcl_FSGetNativePath(pathPtr), 0, &ds);
+ ret = DoRemoveJustDirectory((const WCHAR *)Tcl_FSGetNativePath(pathPtr), 0, &ds);
}
if (ret != TCL_OK) {
@@ -1432,6 +1432,8 @@ TraversalDelete(
Tcl_DString *errorPtr) /* If non-NULL, initialized DString filled
* with UTF-8 name of file causing error. */
{
+ (void)dstPtr;
+
switch (type) {
case DOTREE_F:
if (TclpDeleteFile(nativeSrc) == TCL_OK) {
@@ -1517,7 +1519,7 @@ GetWinFileAttributes(
const WCHAR *nativeName;
int attr;
- nativeName = Tcl_FSGetNativePath(fileName);
+ nativeName = (const WCHAR *)Tcl_FSGetNativePath(fileName);
result = GetFileAttributesW(nativeName);
if (result == 0xffffffff) {
@@ -1598,6 +1600,7 @@ ConvertFileNameFormat(
int pathc, i;
Tcl_Obj *splitPath;
size_t length;
+ (void)objIndex;
splitPath = Tcl_FSSplitPath(fileName, &pathc);
@@ -1843,7 +1846,7 @@ SetWinFileAttributes(
int yesNo, result;
const WCHAR *nativeName;
- nativeName = Tcl_FSGetNativePath(fileName);
+ nativeName = (const WCHAR *)Tcl_FSGetNativePath(fileName);
fileAttributes = old = GetFileAttributesW(nativeName);
if (fileAttributes == 0xffffffff) {
@@ -1894,6 +1897,8 @@ CannotSetAttribute(
Tcl_Obj *fileName, /* The name of the file. */
Tcl_Obj *attributePtr) /* The new value of the attribute. */
{
+ (void)attributePtr;
+
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"cannot set attribute \"%s\" for file \"%s\": attribute is readonly",
tclpFileAttrStrings[objIndex], TclGetString(fileName)));
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 10d846e..083375d 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -859,6 +859,7 @@ TclpFindExecutable(
{
WCHAR wName[MAX_PATH];
char name[MAX_PATH * 3];
+ (void)argv0;
GetModuleFileNameW(NULL, wName, MAX_PATH);
WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL);
@@ -918,7 +919,7 @@ TclpMatchInDirectory(
size_t length = 0;
const char *str = TclGetStringFromObj(norm, &length);
- native = Tcl_FSGetNativePath(pathPtr);
+ native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (GetFileAttributesExW(native,
GetFileExInfoStandard, &data) != TRUE) {
@@ -959,7 +960,7 @@ TclpMatchInDirectory(
* Verify that the specified path exists and is actually a directory.
*/
- native = Tcl_FSGetNativePath(pathPtr);
+ native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (native == NULL) {
return TCL_OK;
}
@@ -1481,7 +1482,7 @@ TclpGetUserHome(
if (rc != 0) {
break;
}
- domain = INT2PTR(-1); /* repeat once */
+ domain = (const char *)INT2PTR(-1); /* repeat once */
}
if (rc == 0) {
DWORD i, size = MAX_PATH;
@@ -1900,7 +1901,7 @@ TclpObjChdir(
int result;
const WCHAR *nativePath;
- nativePath = Tcl_FSGetNativePath(pathPtr);
+ nativePath = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (!nativePath) {
return -1;
@@ -1993,7 +1994,7 @@ TclpObjStat(
TclWinFlushDirtyChannels();
- return NativeStat(Tcl_FSGetNativePath(pathPtr), statPtr, 0);
+ return NativeStat((const WCHAR *)Tcl_FSGetNativePath(pathPtr), statPtr, 0);
}
/*
@@ -2187,7 +2188,7 @@ NativeDev(
p = strchr(p + 1, '\\');
if (p == NULL) {
/*
- * Add terminating backslash to fullpath or GetVolumeInformation()
+ * Add terminating backslash to fullpath or GetVolumeInformationW()
* won't work.
*/
@@ -2364,7 +2365,7 @@ TclpObjAccess(
Tcl_Obj *pathPtr,
int mode)
{
- return NativeAccess(Tcl_FSGetNativePath(pathPtr), mode);
+ return NativeAccess((const WCHAR *)Tcl_FSGetNativePath(pathPtr), mode);
}
int
@@ -2380,7 +2381,7 @@ TclpObjLstat(
TclWinFlushDirtyChannels();
- return NativeStat(Tcl_FSGetNativePath(pathPtr), statPtr, 1);
+ return NativeStat((const WCHAR *)Tcl_FSGetNativePath(pathPtr), statPtr, 1);
}
#ifdef S_IFLNK
@@ -2393,14 +2394,14 @@ TclpObjLink(
if (toPtr != NULL) {
int res;
const WCHAR *LinkTarget;
- const WCHAR *LinkSource = Tcl_FSGetNativePath(pathPtr);
+ const WCHAR *LinkSource = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
Tcl_Obj *normalizedToPtr = Tcl_FSGetNormalizedPath(NULL, toPtr);
if (normalizedToPtr == NULL) {
return NULL;
}
- LinkTarget = Tcl_FSGetNativePath(normalizedToPtr);
+ LinkTarget = (const WCHAR *)Tcl_FSGetNativePath(normalizedToPtr);
if (LinkSource == NULL || LinkTarget == NULL) {
return NULL;
@@ -2412,7 +2413,7 @@ TclpObjLink(
return NULL;
}
} else {
- const WCHAR *LinkSource = Tcl_FSGetNativePath(pathPtr);
+ const WCHAR *LinkSource = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (LinkSource == NULL) {
return NULL;
@@ -2461,13 +2462,13 @@ TclpFilesystemPathType(
firstSeparator = strchr(path, '/');
if (firstSeparator == NULL) {
- found = GetVolumeInformationW(Tcl_FSGetNativePath(pathPtr),
+ found = GetVolumeInformationW((const WCHAR *)Tcl_FSGetNativePath(pathPtr),
NULL, 0, NULL, NULL, NULL, volType, VOL_BUF_SIZE);
} else {
Tcl_Obj *driveName = Tcl_NewStringObj(path, firstSeparator - path+1);
Tcl_IncrRefCount(driveName);
- found = GetVolumeInformationW(Tcl_FSGetNativePath(driveName),
+ found = GetVolumeInformationW((const WCHAR *)Tcl_FSGetNativePath(driveName),
NULL, 0, NULL, NULL, NULL, volType, VOL_BUF_SIZE);
Tcl_DecrRefCount(driveName);
}
@@ -2521,7 +2522,7 @@ TclpFilesystemPathType(
int
TclpObjNormalizePath(
- Tcl_Interp *interp,
+ Tcl_Interp *dummy,
Tcl_Obj *pathPtr, /* An unshared object containing the path to
* normalize */
int nextCheckpoint) /* offset to start at in pathPtr */
@@ -2532,6 +2533,7 @@ TclpObjNormalizePath(
Tcl_Obj *temp = NULL;
int isDrive = 1;
Tcl_DString ds; /* Some workspace. */
+ (void)dummy;
Tcl_DStringInit(&dsNorm);
path = TclGetString(pathPtr);
@@ -3093,7 +3095,7 @@ TclNativeCreateNativeRep(
* Overallocate 6 chars, making some room for extended paths
*/
- wp = nativePathPtr = Tcl_Alloc((len + 6) * sizeof(WCHAR));
+ wp = nativePathPtr = (WCHAR *)Tcl_Alloc((len + 6) * sizeof(WCHAR));
if (nativePathPtr==0) {
goto done;
}
@@ -3191,7 +3193,7 @@ TclNativeDupInternalRep(
len = sizeof(WCHAR) * (wcslen((const WCHAR *) clientData) + 1);
- copy = Tcl_Alloc(len);
+ copy = (char *)Tcl_Alloc(len);
memcpy(copy, clientData, len);
return copy;
}
@@ -3228,7 +3230,7 @@ TclpUtime(
FromCTime(tval->actime, &lastAccessTime);
FromCTime(tval->modtime, &lastModTime);
- native = Tcl_FSGetNativePath(pathPtr);
+ native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
attr = GetFileAttributesW(native);
@@ -3279,7 +3281,7 @@ TclWinFileOwned(
DWORD bufsz;
int owned = 0;
- native = Tcl_FSGetNativePath(pathPtr);
+ native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (GetNamedSecurityInfoW((LPWSTR) native, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION, &ownerSid, NULL, NULL, NULL,
@@ -3307,7 +3309,7 @@ TclWinFileOwned(
bufsz = 0;
GetTokenInformation(token, TokenUser, NULL, 0, &bufsz);
if (bufsz) {
- buf = Tcl_Alloc(bufsz);
+ buf = (LPBYTE)Tcl_Alloc(bufsz);
if (GetTokenInformation(token, TokenUser, buf, bufsz, &bufsz)) {
owned = EqualSid(ownerSid, ((PTOKEN_USER) buf)->User.Sid);
}
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index d2fa32c..1dfc9b5 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -226,7 +226,7 @@ TclpInitLibraryPath(
*encodingPtr = NULL;
bytes = TclGetStringFromObj(pathPtr, &length);
*lengthPtr = length++;
- *valuePtr = Tcl_Alloc(length);
+ *valuePtr = (char *)Tcl_Alloc(length);
memcpy(*valuePtr, bytes, length);
Tcl_DecrRefCount(pathPtr);
}
@@ -363,7 +363,7 @@ InitializeDefaultLibraryDir(
TclWinNoBackslash(name);
sprintf(end + 1, "lib/tcl%s", TCL_VERSION);
*lengthPtr = strlen(name);
- *valuePtr = Tcl_Alloc(*lengthPtr + 1);
+ *valuePtr = (char *)Tcl_Alloc(*lengthPtr + 1);
*encodingPtr = NULL;
memcpy(*valuePtr, name, *lengthPtr + 1);
}
@@ -411,7 +411,7 @@ InitializeSourceLibraryDir(
TclWinNoBackslash(name);
sprintf(end + 1, "../library");
*lengthPtr = strlen(name);
- *valuePtr = Tcl_Alloc(*lengthPtr + 1);
+ *valuePtr = (char *)Tcl_Alloc(*lengthPtr + 1);
*encodingPtr = NULL;
memcpy(*valuePtr, name, *lengthPtr + 1);
}
@@ -644,7 +644,7 @@ TclpFindVariable(
*/
length = strlen(name);
- nameUpper = Tcl_Alloc(length + 1);
+ nameUpper = (char *)Tcl_Alloc(length + 1);
memcpy(nameUpper, name, length+1);
Tcl_UtfToUpper(nameUpper);
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index aac48af..238af65 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.c
@@ -67,6 +67,7 @@ TclpDlopen(
const WCHAR *nativeName;
Tcl_LoadHandle handlePtr;
DWORD firstError;
+ (void)flags;
/*
* First try the full path the user gave us. This is particularly
@@ -74,7 +75,7 @@ TclpDlopen(
* relative path.
*/
- nativeName = Tcl_FSGetNativePath(pathPtr);
+ nativeName = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (nativeName != NULL) {
hInstance = LoadLibraryExW(nativeName, NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
@@ -171,7 +172,7 @@ TclpDlopen(
* Succeded; package everything up for Tcl.
*/
- handlePtr = Tcl_Alloc(sizeof(struct Tcl_LoadHandle_));
+ handlePtr = (Tcl_LoadHandle)Tcl_Alloc(sizeof(struct Tcl_LoadHandle_));
handlePtr->clientData = (ClientData) hInstance;
handlePtr->findSymbolProcPtr = &FindSymbol;
handlePtr->unloadFileProcPtr = &UnloadFile;
@@ -203,14 +204,14 @@ FindSymbol(
const char *symbol)
{
HINSTANCE hInstance = (HINSTANCE) loadHandle->clientData;
- Tcl_PackageInitProc *proc = NULL;
+ void *proc = NULL;
/*
* For each symbol, check for both Symbol and _Symbol, since Borland
* generates C symbols with a leading '_' by default.
*/
- proc = (void *) GetProcAddress(hInstance, symbol);
+ proc = (void *)GetProcAddress(hInstance, symbol);
if (proc == NULL) {
Tcl_DString ds;
const char *sym2;
@@ -218,7 +219,7 @@ FindSymbol(
Tcl_DStringInit(&ds);
TclDStringAppendLiteral(&ds, "_");
sym2 = Tcl_DStringAppend(&ds, symbol, -1);
- proc = (Tcl_PackageInitProc *) GetProcAddress(hInstance, sym2);
+ proc = (void *)GetProcAddress(hInstance, sym2);
Tcl_DStringFree(&ds);
}
if (proc == NULL && interp != NULL) {
@@ -286,6 +287,9 @@ TclGuessPackageName(
Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
+ (void)fileName;
+ (void)bufPtr;
+
return 0;
}
@@ -417,7 +421,7 @@ InitDLLDirectoryName(void)
*/
copyToGlobalBuffer:
- dllDirectoryName = Tcl_Alloc((nameLen+1) * sizeof(WCHAR));
+ dllDirectoryName = (WCHAR *)Tcl_Alloc((nameLen+1) * sizeof(WCHAR));
wcscpy(dllDirectoryName, name);
return TCL_OK;
}
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 96a6e93..4d2b20a 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -310,13 +310,14 @@ TclpFinalizePipes(void)
void
PipeSetupProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
PipeInfo *infoPtr;
Tcl_Time blockTime = { 0, 0 };
int block = 1;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!(flags & TCL_FILE_EVENTS)) {
return;
@@ -363,13 +364,14 @@ PipeSetupProc(
static void
PipeCheckProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
PipeInfo *infoPtr;
PipeEvent *evPtr;
int needEvent;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!(flags & TCL_FILE_EVENTS)) {
return;
@@ -402,7 +404,7 @@ PipeCheckProc(
if (needEvent) {
infoPtr->flags |= PIPE_PENDING;
- evPtr = Tcl_Alloc(sizeof(PipeEvent));
+ evPtr = (PipeEvent *)Tcl_Alloc(sizeof(PipeEvent));
evPtr->header.proc = PipeEventProc;
evPtr->infoPtr = infoPtr;
Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL);
@@ -433,7 +435,7 @@ TclWinMakeFile(
{
WinFile *filePtr;
- filePtr = Tcl_Alloc(sizeof(WinFile));
+ filePtr = (WinFile *)Tcl_Alloc(sizeof(WinFile));
filePtr->type = WIN_FILE;
filePtr->handle = handle;
@@ -1763,7 +1765,7 @@ TclpCreateCommandChannel(
Tcl_Pid *pidPtr) /* An array of process identifiers. */
{
char channelName[16 + TCL_INTEGER_SPACE];
- PipeInfo *infoPtr = Tcl_Alloc(sizeof(PipeInfo));
+ PipeInfo *infoPtr = (PipeInfo *)Tcl_Alloc(sizeof(PipeInfo));
PipeInit();
@@ -1860,6 +1862,7 @@ Tcl_CreatePipe(
{
HANDLE readHandle, writeHandle;
SECURITY_ATTRIBUTES sec;
+ (void)flags;
sec.nLength = sizeof(SECURITY_ATTRIBUTES);
sec.lpSecurityDescriptor = NULL;
@@ -1917,7 +1920,7 @@ TclGetAndDetachPids(
return;
}
- pipePtr = Tcl_GetChannelInstanceData(chan);
+ pipePtr = (PipeInfo *)Tcl_GetChannelInstanceData(chan);
TclNewObj(pidsObj);
for (i = 0; i < pipePtr->numPids; i++) {
Tcl_ListObjAppendElement(NULL, pidsObj,
@@ -2303,7 +2306,7 @@ PipeOutputProc(
Tcl_Free(infoPtr->writeBuf);
}
infoPtr->writeBufLen = toWrite;
- infoPtr->writeBuf = Tcl_Alloc(toWrite);
+ infoPtr->writeBuf = (char *)Tcl_Alloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
@@ -2711,7 +2714,7 @@ TclWinAddProcess(
void *hProcess, /* Handle to process */
size_t id) /* Global process identifier */
{
- ProcInfo *procPtr = Tcl_Alloc(sizeof(ProcInfo));
+ ProcInfo *procPtr = (ProcInfo*)Tcl_Alloc(sizeof(ProcInfo));
PipeInit();
@@ -2753,6 +2756,7 @@ Tcl_PidObjCmd(
PipeInfo *pipePtr;
int i;
Tcl_Obj *resultPtr;
+ (void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?channelId?");
@@ -2812,7 +2816,7 @@ WaitForRead(
* or not. */
{
DWORD timeout, count;
- HANDLE *handle = ((WinFile *) infoPtr->readFile)->handle;
+ HANDLE *handle = (HANDLE *)((WinFile *) infoPtr->readFile)->handle;
while (1) {
/*
@@ -3201,6 +3205,8 @@ TclpOpenTemporaryFile(
size_t length;
int counter, counter2;
Tcl_DString buf;
+ (void)dirObj;
+ (void)extensionObj;
if (!resultingNameObj) {
flags |= FILE_FLAG_DELETE_ON_CLOSE;
@@ -3287,9 +3293,9 @@ TclPipeThreadCreateTI(
{
TclPipeThreadInfo *pipeTI;
#ifndef _PTI_USE_CKALLOC
- pipeTI = malloc(sizeof(TclPipeThreadInfo));
+ pipeTI = (TclPipeThreadInfo *)malloc(sizeof(TclPipeThreadInfo));
#else
- pipeTI = Tcl_Alloc(sizeof(TclPipeThreadInfo));
+ pipeTI = (TclPipeThreadInfo *)Tcl_Alloc(sizeof(TclPipeThreadInfo));
#endif /* !_PTI_USE_CKALLOC */
pipeTI->evControl = CreateEventW(NULL, FALSE, FALSE, NULL);
pipeTI->state = PTI_STATE_IDLE;
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 7bbb10b..16a0d3d 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -1235,7 +1235,7 @@ RecursiveDeleteKey(
checkExProc = 1;
handle = GetModuleHandleW(L"ADVAPI32");
regDeleteKeyExProc = (LONG (*) (HKEY, LPCWSTR, REGSAM, DWORD))
- GetProcAddress(handle, "RegDeleteKeyExW");
+ (void *)GetProcAddress(handle, "RegDeleteKeyExW");
}
if (mode && regDeleteKeyExProc) {
result = regDeleteKeyExProc(startKey, keyName, mode, 0);
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index fc0255a..bcc7983 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -285,10 +285,11 @@ SerialInit(void)
static void
SerialExitHandler(
- ClientData clientData) /* Old window proc */
+ ClientData dummy) /* Old window proc */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
SerialInfo *infoPtr;
+ (void)dummy;
/*
* Clear all eventually pending output. Otherwise Tcl's exit could totally
@@ -323,8 +324,10 @@ SerialExitHandler(
static void
ProcExitHandler(
- ClientData clientData) /* Old window proc */
+ ClientData dummy) /* Old window proc */
{
+ (void)dummy;
+
Tcl_MutexLock(&serialMutex);
initialized = 0;
Tcl_MutexUnlock(&serialMutex);
@@ -400,15 +403,20 @@ SerialGetMilliseconds(void)
*----------------------------------------------------------------------
*/
+#ifdef __cplusplus
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
void
SerialSetupProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
SerialInfo *infoPtr;
int block = 1;
int msec = INT_MAX; /* min. found block time */
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!(flags & TCL_FILE_EVENTS)) {
return;
@@ -457,7 +465,7 @@ SerialSetupProc(
static void
SerialCheckProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
SerialInfo *infoPtr;
@@ -466,6 +474,7 @@ SerialCheckProc(
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
COMSTAT cStat;
unsigned int time;
+ (void)dummy;
if (!(flags & TCL_FILE_EVENTS)) {
return;
@@ -531,7 +540,7 @@ SerialCheckProc(
if (needEvent) {
infoPtr->flags |= SERIAL_PENDING;
- evPtr = Tcl_Alloc(sizeof(SerialEvent));
+ evPtr = (SerialEvent *)Tcl_Alloc(sizeof(SerialEvent));
evPtr->header.proc = SerialEventProc;
evPtr->infoPtr = infoPtr;
Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL);
@@ -597,12 +606,13 @@ SerialBlockProc(
static int
SerialCloseProc(
ClientData instanceData, /* Pointer to SerialInfo structure. */
- Tcl_Interp *interp) /* For error reporting. */
+ Tcl_Interp *dummy) /* For error reporting. */
{
SerialInfo *serialPtr = (SerialInfo *) instanceData;
int errorCode, result = 0;
SerialInfo *infoPtr, **nextPtrPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
errorCode = 0;
@@ -1030,7 +1040,7 @@ SerialOutputProc(
Tcl_Free(infoPtr->writeBuf);
}
infoPtr->writeBufLen = toWrite;
- infoPtr->writeBuf = Tcl_Alloc(toWrite);
+ infoPtr->writeBuf = (char *)Tcl_Alloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
@@ -1246,6 +1256,7 @@ SerialGetHandleProc(
ClientData *handlePtr) /* Where to store the handle. */
{
SerialInfo *infoPtr = (SerialInfo *) instanceData;
+ (void)direction;
*handlePtr = (ClientData) infoPtr->handle;
return TCL_OK;
@@ -1447,7 +1458,7 @@ TclWinOpenSerialChannel(
SerialInit();
- infoPtr = Tcl_Alloc(sizeof(SerialInfo));
+ infoPtr = (SerialInfo *)Tcl_Alloc(sizeof(SerialInfo));
memset(infoPtr, 0, sizeof(SerialInfo));
infoPtr->validMask = permissions;
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 13aaf0b..c6d5501 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -310,7 +310,7 @@ static ProcessGlobalValue hostName =
*/
#define SendSelectMessage(tsdPtr, message, payload) \
- SendMessage((tsdPtr)->hwnd, SOCKET_SELECT, \
+ SendMessageW((tsdPtr)->hwnd, SOCKET_SELECT, \
(WPARAM) (message), (LPARAM) (payload))
@@ -397,7 +397,7 @@ InitializeHostName(
*encodingPtr = Tcl_GetEncoding(NULL, "utf-8");
*lengthPtr = Tcl_DStringLength(&ds);
- *valuePtr = Tcl_Alloc(*lengthPtr + 1);
+ *valuePtr = (char *)Tcl_Alloc(*lengthPtr + 1);
memcpy(*valuePtr, Tcl_DStringValue(&ds), *lengthPtr + 1);
Tcl_DStringFree(&ds);
}
@@ -489,7 +489,7 @@ TclpHasSockets(
void
TclpFinalizeSockets(void)
{
- ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
/*
* Careful! This is a finalizer!
@@ -501,7 +501,7 @@ TclpFinalizeSockets(void)
if (tsdPtr->socketThread != NULL) {
if (tsdPtr->hwnd != NULL) {
- PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0);
+ PostMessageW(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0);
/*
* Wait for the thread to exit. This ensures that we are
@@ -550,7 +550,7 @@ TcpBlockModeProc(
* TCL_MODE_BLOCKING or
* TCL_MODE_NONBLOCKING. */
{
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
if (mode == TCL_MODE_NONBLOCKING) {
SET_BITS(statePtr->flags, TCP_NONBLOCKING);
@@ -646,10 +646,10 @@ WaitForConnect(
while (1) {
/*
- * Get the statePtr lock.
- */
+ * Get the statePtr lock.
+ */
- tsdPtr = TclThreadDataKeyGet(&dataKey);
+ tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
WaitForSingleObject(tsdPtr->socketListLock, INFINITE);
/*
@@ -783,10 +783,10 @@ TcpInputProc(
* buffer? */
int *errorCodePtr) /* Where to store error code. */
{
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
int bytesRead;
DWORD error;
- ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
*errorCodePtr = 0;
@@ -926,10 +926,10 @@ TcpOutputProc(
int toWrite, /* How many bytes to write? */
int *errorCodePtr) /* Where to store error code. */
{
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
int written;
DWORD error;
- ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
*errorCodePtr = 0;
@@ -1038,12 +1038,13 @@ TcpOutputProc(
static int
TcpCloseProc(
ClientData instanceData, /* The socket to close. */
- Tcl_Interp *interp) /* Unused. */
+ Tcl_Interp *dummy) /* Unused. */
{
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
/* TIP #218 */
int errorCode = 0;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
/*
* Check that WinSock is initialized; do not call it if not, to prevent
@@ -1135,7 +1136,7 @@ TcpClose2Proc(
Tcl_Interp *interp, /* For error reporting. */
int flags) /* Flags that indicate which side to close. */
{
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
int readError = 0;
int writeError = 0;
@@ -1189,7 +1190,10 @@ TcpSetOptionProc(
#ifdef TCL_FEATURE_KEEPALIVE_NAGLE
TcpState *statePtr = instanceData;
SOCKET sock;
+#else
+ (void)instanceData;
#endif /*TCL_FEATURE_KEEPALIVE_NAGLE*/
+ (void)value;
/*
* Check that WinSock is initialized; do not call it if not, to prevent
@@ -1292,7 +1296,7 @@ TcpGetOptionProc(
Tcl_DString *dsPtr) /* Where to store the computed value;
* initialized by caller. */
{
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
char host[NI_MAXHOST], port[NI_MAXSERV];
SOCKET sock;
size_t len = 0;
@@ -1611,7 +1615,7 @@ TcpWatchProc(
* TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
{
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
/*
* Update the watch events mask. Only if the socket is not a server
@@ -1665,7 +1669,8 @@ TcpGetHandleProc(
int direction, /* Not used. */
ClientData *handlePtr) /* Where to store the handle. */
{
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
+ (void)direction;
*handlePtr = INT2PTR(statePtr->sockets->fd);
return TCL_OK;
@@ -1722,7 +1727,7 @@ TcpConnect(
int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING);
/* We were called by the event procedure and
* continue our loop. */
- ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
if (async_callback) {
goto reenter;
@@ -2141,7 +2146,7 @@ Tcl_MakeTcpClientChannel(
return NULL;
}
- tsdPtr = TclThreadDataKeyGet(&dataKey);
+ tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
/*
* Set kernel space buffering and non-blocking.
@@ -2333,7 +2338,7 @@ Tcl_OpenTcpServerEx(
}
if (statePtr != NULL) {
- ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
statePtr->acceptProc = acceptProc;
statePtr->acceptProcData = acceptProcData;
@@ -2401,7 +2406,7 @@ TcpAccept(
int len = sizeof(addr);
char channelName[SOCK_CHAN_LENGTH];
char host[NI_MAXHOST], port[NI_MAXSERV];
- ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
/*
* Win-NT has a misfeature that sockets are inherited in child processes
@@ -2472,7 +2477,7 @@ static void
InitSockets(void)
{
DWORD id;
- ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
if (!initialized) {
initialized = 1;
@@ -2521,11 +2526,11 @@ InitSockets(void)
tsdPtr->socketList = NULL;
tsdPtr->hwnd = NULL;
tsdPtr->threadId = Tcl_GetCurrentThread();
- tsdPtr->readyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ tsdPtr->readyEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (tsdPtr->readyEvent == NULL) {
goto initFailure;
}
- tsdPtr->socketListLock = CreateEvent(NULL, FALSE, TRUE, NULL);
+ tsdPtr->socketListLock = CreateEventW(NULL, FALSE, TRUE, NULL);
if (tsdPtr->socketListLock == NULL) {
goto initFailure;
}
@@ -2611,8 +2616,10 @@ SocketsEnabled(void)
/* ARGSUSED */
static void
SocketExitHandler(
- ClientData clientData) /* Not used. */
+ ClientData dummy) /* Not used. */
{
+ (void)dummy;
+
Tcl_MutexLock(&socketMutex);
/*
@@ -2645,12 +2652,13 @@ SocketExitHandler(
void
SocketSetupProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
TcpState *statePtr;
Tcl_Time blockTime = { 0, 0 };
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!GOT_BITS(flags, TCL_FILE_EVENTS)) {
return;
@@ -2690,12 +2698,13 @@ SocketSetupProc(
static void
SocketCheckProc(
- ClientData data, /* Not used. */
+ ClientData dummy, /* Not used. */
int flags) /* Event flags as passed to Tcl_DoOneEvent. */
{
TcpState *statePtr;
SocketEvent *evPtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ (void)dummy;
if (!GOT_BITS(flags, TCL_FILE_EVENTS)) {
return;
@@ -2714,7 +2723,7 @@ SocketCheckProc(
statePtr->watchEvents | FD_CONNECT | FD_ACCEPT)
&& !GOT_BITS(statePtr->flags, SOCKET_PENDING)) {
SET_BITS(statePtr->flags, SOCKET_PENDING);
- evPtr = Tcl_Alloc(sizeof(SocketEvent));
+ evPtr = (SocketEvent *)Tcl_Alloc(sizeof(SocketEvent));
evPtr->header.proc = SocketEventProc;
evPtr->socket = statePtr->sockets->fd;
Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL);
@@ -2989,7 +2998,7 @@ AddSocketInfoFd(
* Add the first FD.
*/
- statePtr->sockets = Tcl_Alloc(sizeof(TcpFdList));
+ statePtr->sockets = (TcpFdList *)Tcl_Alloc(sizeof(TcpFdList));
fds = statePtr->sockets;
} else {
/*
@@ -3000,7 +3009,7 @@ AddSocketInfoFd(
fds = fds->next;
}
- fds->next = Tcl_Alloc(sizeof(TcpFdList));
+ fds->next = (TcpFdList *)Tcl_Alloc(sizeof(TcpFdList));
fds = fds->next;
}
@@ -3033,7 +3042,7 @@ AddSocketInfoFd(
static TcpState *
NewSocketInfo(SOCKET socket)
{
- TcpState *statePtr = Tcl_Alloc(sizeof(TcpState));
+ TcpState *statePtr = (TcpState *)Tcl_Alloc(sizeof(TcpState));
memset(statePtr, 0, sizeof(TcpState));
@@ -3076,7 +3085,7 @@ WaitForSocketEvent(
{
int result = 1;
int oldMode;
- ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
/*
* Be sure to disable event servicing so we are truly modal.
@@ -3162,7 +3171,7 @@ SocketThread(
LPVOID arg)
{
MSG msg;
- ThreadSpecificData *tsdPtr = arg;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)arg;
/*
* Create a dummy window receiving socket events.
@@ -3188,7 +3197,7 @@ SocketThread(
/*
* Process all messages on the socket window until WM_QUIT. This threads
* exits only when instructed to do so by the call to
- * PostMessage(SOCKET_TERMINATE) in TclpFinalizeSockets().
+ * PostMessageW(SOCKET_TERMINATE) in TclpFinalizeSockets().
*/
while (GetMessageW(&msg, NULL, 0, 0) > 0) {
@@ -3254,7 +3263,7 @@ SocketProc(
*/
#ifdef _WIN64
- SetWindowLongPtr(hwnd, GWLP_USERDATA,
+ SetWindowLongPtrW(hwnd, GWLP_USERDATA,
(LONG_PTR) ((LPCREATESTRUCT)lParam)->lpCreateParams);
#else
SetWindowLongW(hwnd, GWL_USERDATA,
@@ -3415,7 +3424,7 @@ TcpThreadActionProc(
int action)
{
ThreadSpecificData *tsdPtr;
- TcpState *statePtr = instanceData;
+ TcpState *statePtr = (TcpState *)instanceData;
int notifyCmd;
if (action == TCL_CHANNEL_THREAD_INSERT) {
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index 07b83a4..062e4f1 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.c
@@ -102,7 +102,7 @@ TclplatformtestInit(
static int
TesteventloopCmd(
- ClientData clientData, /* Not used. */
+ ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -110,6 +110,7 @@ TesteventloopCmd(
static int *framePtr = NULL;/* Pointer to integer on stack frame of
* innermost invocation of the "wait"
* subcommand. */
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ...");
@@ -178,7 +179,7 @@ TesteventloopCmd(
static int
TestvolumetypeCmd(
- ClientData clientData, /* Not used. */
+ ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -187,6 +188,7 @@ TestvolumetypeCmd(
int found;
char volType[VOL_BUF_SIZE];
const char *path;
+ (void)dummy;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?name?");
@@ -257,6 +259,7 @@ TestwinclockCmd(
Tcl_Obj *result; /* Result of the command */
LARGE_INTEGER t1, t2;
LARGE_INTEGER p1, p2;
+ (void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, "");
@@ -293,12 +296,13 @@ TestwinclockCmd(
static int
TestwinsleepCmd(
- ClientData clientData, /* Unused */
+ ClientData dummy, /* Unused */
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const * objv) /* Parameter vector */
{
int ms;
+ (void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "ms");
@@ -363,6 +367,7 @@ TestExceptionCmd(
EXCEPTION_GUARD_PAGE, EXCEPTION_INVALID_HANDLE, CONTROL_C_EXIT
};
int cmd;
+ (void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 0, objv, "<type-of-exception>");
@@ -466,7 +471,7 @@ TestplatformChmod(
goto done;
}
- secDesc = Tcl_Alloc(secDescLen);
+ secDesc = (BYTE *)Tcl_Alloc(secDescLen);
if (!GetFileSecurityA(nativePath, infoBits,
(PSECURITY_DESCRIPTOR) secDesc, secDescLen, &secDescLen2)
|| (secDescLen < secDescLen2)) {
@@ -478,7 +483,7 @@ TestplatformChmod(
* Get the World SID.
*/
- userSid = Tcl_Alloc(GetSidLengthRequired((UCHAR) 1));
+ userSid = (SID *)Tcl_Alloc(GetSidLengthRequired((UCHAR) 1));
InitializeSid(userSid, &userSidAuthority, (BYTE) 1);
*(GetSidSubAuthority(userSid, 0)) = SECURITY_WORLD_RID;
@@ -504,7 +509,7 @@ TestplatformChmod(
newAclSize = ACLSize.AclBytesInUse + sizeof(ACCESS_DENIED_ACE)
+ GetLengthSid(userSid) - sizeof(DWORD);
- newAcl = Tcl_Alloc(newAclSize);
+ newAcl = (PACL) Tcl_Alloc(newAclSize);
/*
* Initialize the new ACL.
@@ -631,6 +636,7 @@ TestchmodCmd(
Tcl_Obj *const * objv) /* Parameter vector */
{
int i, mode;
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "mode file ?file ...?");
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 3e8b7d5..6bd9f11 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -568,7 +568,7 @@ Tcl_MutexLock(
*/
if (*mutexPtr == NULL) {
- csPtr = Tcl_Alloc(sizeof(CRITICAL_SECTION));
+ csPtr = (CRITICAL_SECTION *)Tcl_Alloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(csPtr);
*mutexPtr = (Tcl_Mutex)csPtr;
TclRememberMutex(mutexPtr);
@@ -711,7 +711,7 @@ Tcl_ConditionWait(
*/
if (*condPtr == NULL) {
- winCondPtr = Tcl_Alloc(sizeof(WinCondition));
+ winCondPtr = (WinCondition *)Tcl_Alloc(sizeof(WinCondition));
InitializeCriticalSection(&winCondPtr->condLock);
winCondPtr->firstPtr = NULL;
winCondPtr->lastPtr = NULL;
@@ -940,7 +940,7 @@ TclpNewAllocMutex(void)
{
allocMutex *lockPtr;
- lockPtr = malloc(sizeof(allocMutex));
+ lockPtr = (allocMutex *)malloc(sizeof(allocMutex));
if (lockPtr == NULL) {
Tcl_Panic("could not allocate lock");
}
@@ -1037,7 +1037,7 @@ TclpThreadCreateKey(void)
{
DWORD *key;
- key = TclpSysAlloc(sizeof *key);
+ key = (DWORD *)TclpSysAlloc(sizeof *key);
if (key == NULL) {
Tcl_Panic("unable to allocate thread key!");
}
@@ -1055,7 +1055,7 @@ void
TclpThreadDeleteKey(
void *keyPtr)
{
- DWORD *key = keyPtr;
+ DWORD *key = (DWORD *)keyPtr;
if (!TlsFree(*key)) {
Tcl_Panic("unable to delete key");
@@ -1069,7 +1069,7 @@ TclpThreadSetMasterTSD(
void *tsdKeyPtr,
void *ptr)
{
- DWORD *key = tsdKeyPtr;
+ DWORD *key = (DWORD *)tsdKeyPtr;
if (!TlsSetValue(*key, ptr)) {
Tcl_Panic("unable to set master TSD value");
@@ -1080,7 +1080,7 @@ void *
TclpThreadGetMasterTSD(
void *tsdKeyPtr)
{
- DWORD *key = tsdKeyPtr;
+ DWORD *key = (DWORD *)tsdKeyPtr;
return TlsGetValue(*key);
}
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index cce2776..0c2f212 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -73,7 +73,7 @@ static TimeInfo timeInfo = {
(HANDLE) NULL,
(HANDLE) NULL,
(HANDLE) NULL,
-#ifdef HAVE_CAST_TO_UNION
+#if defined(HAVE_CAST_TO_UNION) && !defined(__cplusplus)
(LARGE_INTEGER) (Tcl_WideInt) 0,
(ULARGE_INTEGER) (DWORDLONG) 0,
(LARGE_INTEGER) (Tcl_WideInt) 0,
@@ -386,8 +386,11 @@ Tcl_GetTime(
static void
NativeScaleTime(
Tcl_Time *timePtr,
- ClientData clientData)
+ ClientData dummy)
{
+ (void)timePtr;
+ (void)dummy;
+
/*
* Native scale is 1:1. Nothing is done.
*/
@@ -621,9 +624,10 @@ NativeGetMicroseconds(void)
static void
NativeGetTime(
Tcl_Time *timePtr,
- ClientData clientData)
+ ClientData dummy)
{
Tcl_WideInt usecSincePosixEpoch;
+ (void)dummy;
/*
* Try to use high resolution timer.
@@ -666,8 +670,10 @@ void TclWinResetTimerResolution(void);
static void
StopCalibration(
- ClientData unused) /* Client data is unused */
+ ClientData dummy) /* Client data is unused */
{
+ (void)dummy;
+
SetEvent(timeInfo.exitEvent);
/*
@@ -712,6 +718,7 @@ CalibrationThread(
{
FILETIME curFileTime;
DWORD waitResult;
+ (void)arg;
/*
* Get initial system time and performance counter.