summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-08 15:01:20 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-08 15:01:20 (GMT)
commit10f4d4565dc1c86e6b26623c99d5709cac033f0f (patch)
tree2d02f6f002a36e9c48040d79092747aa92f77957 /win
parentfa28b1f243cc546f139050545122af9cc297d0b7 (diff)
downloadtcl-10f4d4565dc1c86e6b26623c99d5709cac033f0f.zip
tcl-10f4d4565dc1c86e6b26623c99d5709cac033f0f.tar.gz
tcl-10f4d4565dc1c86e6b26623c99d5709cac033f0f.tar.bz2
More -Wconversion warning fixes
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFile.c20
-rw-r--r--win/tclWinLoad.c2
-rw-r--r--win/tclWinNotify.c16
-rw-r--r--win/tclWinPipe.c20
-rw-r--r--win/tclWinSerial.c66
-rw-r--r--win/tclWinThrd.c8
6 files changed, 66 insertions, 66 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 4c63222..b16a707 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -170,7 +170,7 @@ static int NativeWriteReparse(const WCHAR *LinkDirectory,
static int NativeMatchType(int isDrive, DWORD attr,
const WCHAR *nativeName, Tcl_GlobTypeData *types);
static int WinIsDrive(const char *name, size_t nameLen);
-static Tcl_Size WinIsReserved(const char *path);
+static size_t WinIsReserved(const char *path);
static Tcl_Obj * WinReadLink(const WCHAR *LinkSource);
static Tcl_Obj * WinReadLinkDirectory(const WCHAR *LinkDirectory);
static int WinLink(const WCHAR *LinkSource,
@@ -921,7 +921,7 @@ TclpMatchInDirectory(
DWORD attr;
WIN32_FILE_ATTRIBUTE_DATA data;
- Tcl_Size len = 0;
+ size_t len = 0;
const char *str = Tcl_GetStringFromObj(norm, &len);
native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
@@ -943,7 +943,7 @@ TclpMatchInDirectory(
WIN32_FIND_DATAW data;
const char *dirName; /* UTF-8 dir name, later with pattern
* appended. */
- Tcl_Size dirLength;
+ size_t dirLength;
int matchSpecialDots;
Tcl_DString ds; /* Native encoding of dir, also used
* temporarily for other things. */
@@ -1226,7 +1226,7 @@ WinIsDrive(
* (not any trailing :).
*/
-static Tcl_Size
+static size_t
WinIsReserved(
const char *path) /* Path in UTF-8 */
{
@@ -2560,14 +2560,14 @@ TclpObjNormalizePath(
*/
if (isDrive) {
- Tcl_Size len = WinIsReserved(path);
+ size_t len = WinIsReserved(path);
if (len > 0) {
/*
* Actually it does exist - COM1, etc.
*/
- Tcl_Size i;
+ size_t i;
for (i=0 ; i<len ; i++) {
WCHAR wc = ((WCHAR *)nativePath)[i];
@@ -2796,7 +2796,7 @@ TclpObjNormalizePath(
*/
Tcl_Obj *tmpPathPtr;
- Tcl_Size len;
+ size_t len;
tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds),
nextCheckpoint);
@@ -2885,7 +2885,7 @@ TclWinVolumeRelativeNormalize(
* also on drive C.
*/
- Tcl_Size cwdLen;
+ size_t cwdLen;
const char *drive = Tcl_GetStringFromObj(useThisCwd, &cwdLen);
char drive_cur = path[0];
@@ -2959,7 +2959,7 @@ TclpNativeToNormalized(
{
Tcl_DString ds;
Tcl_Obj *objPtr;
- Tcl_Size len;
+ size_t len;
char *copy, *p;
Tcl_DStringInit(&ds);
@@ -3022,7 +3022,7 @@ TclNativeCreateNativeRep(
WCHAR *nativePathPtr = NULL;
const char *str;
Tcl_Obj *validPathPtr;
- Tcl_Size len;
+ size_t len;
WCHAR *wp;
if (TclFSCwdIsNative()) {
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index ccedb9d..893313c 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.c
@@ -175,7 +175,7 @@ TclpDlopen(
*/
handlePtr = (Tcl_LoadHandle)Tcl_Alloc(sizeof(struct Tcl_LoadHandle_));
- handlePtr->clientData = (ClientData) hInstance;
+ handlePtr->clientData = (void *)hInstance;
handlePtr->findSymbolProcPtr = &FindSymbol;
handlePtr->unloadFileProcPtr = &UnloadFile;
*loadHandle = handlePtr;
diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c
index ec6fd51..bcb4e08 100644
--- a/win/tclWinNotify.c
+++ b/win/tclWinNotify.c
@@ -76,7 +76,7 @@ static LRESULT CALLBACK NotifierProc(HWND hwnd, UINT message,
*----------------------------------------------------------------------
*/
-ClientData
+void *
TclpInitNotifier(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -148,7 +148,7 @@ TclpInitNotifier(void)
void
TclpFinalizeNotifier(
- ClientData clientData) /* Pointer to notifier data. */
+ void *clientData) /* Pointer to notifier data. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
@@ -218,7 +218,7 @@ TclpFinalizeNotifier(
void
TclpAlertNotifier(
- ClientData clientData) /* Pointer to thread data. */
+ void *clientData) /* Pointer to thread data. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
@@ -287,7 +287,7 @@ TclpSetTimer(
* Windows seems to get confused by zero length timers.
*/
- timeout = timePtr->sec * 1000 + timePtr->usec / 1000;
+ timeout = (UINT)timePtr->sec * 1000 + (unsigned long)timePtr->usec / 1000;
if (timeout == 0) {
timeout = 1;
}
@@ -437,7 +437,7 @@ NotifierProc(
*----------------------------------------------------------------------
*/
-ClientData
+void *
TclpNotifierData(void)
{
return NULL;
@@ -490,7 +490,7 @@ TclpWaitForEvent(
TclScaleTime(&myTime);
}
- timeout = myTime.sec * 1000 + myTime.usec / 1000;
+ timeout = (DWORD)myTime.sec * 1000 + (unsigned long)myTime.usec / 1000;
} else {
timeout = INFINITE;
}
@@ -610,7 +610,7 @@ Tcl_Sleep(
*/
TclScaleTime(&vdelay);
- sleepTime = vdelay.sec * 1000 + vdelay.usec / 1000;
+ sleepTime = (DWORD)vdelay.sec * 1000 + (unsigned long)vdelay.usec / 1000;
for (;;) {
SleepEx(sleepTime, TRUE);
@@ -625,7 +625,7 @@ Tcl_Sleep(
vdelay.usec = desired.usec - now.usec;
TclScaleTime(&vdelay);
- sleepTime = vdelay.sec * 1000 + vdelay.usec / 1000;
+ sleepTime = (DWORD)vdelay.sec * 1000 + (unsigned long)vdelay.usec / 1000;
}
}
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index b7949d1..84e6ab0 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -104,7 +104,7 @@ typedef struct PipeInfo {
TclFile readFile; /* Output from pipe. */
TclFile writeFile; /* Input from pipe. */
TclFile errorFile; /* Error output from pipe. */
- Tcl_Size numPids; /* Number of processes attached to pipe. */
+ size_t numPids; /* Number of processes attached to pipe. */
Tcl_Pid *pidPtr; /* Pids of attached processes. */
Tcl_ThreadId threadId; /* Thread to which events should be reported.
* This value is used by the reader/writer
@@ -171,7 +171,7 @@ typedef struct {
static int ApplicationType(Tcl_Interp *interp,
const char *fileName, char *fullName);
-static void BuildCommandLine(const char *executable, Tcl_Size argc,
+static void BuildCommandLine(const char *executable, size_t argc,
const char **argv, Tcl_DString *linePtr);
static BOOL HasConsole(void);
static int PipeBlockModeProc(void *instanceData, int mode);
@@ -859,7 +859,7 @@ TclpCloseFile(
*--------------------------------------------------------------------------
*/
-Tcl_Size
+size_t
TclpGetPid(
Tcl_Pid pid) /* The HANDLE of the child process. */
{
@@ -911,7 +911,7 @@ TclpCreateProcess(
* occurred when creating the child process.
* Error messages from the child process
* itself are sent to errorFile. */
- Tcl_Size argc, /* Number of arguments in following array. */
+ size_t argc, /* Number of arguments in following array. */
const char **argv, /* Array of argument strings. argv[0] contains
* the name of the executable converted to
* native format (using the
@@ -1536,14 +1536,14 @@ static void
BuildCommandLine(
const char *executable, /* Full path of executable (including
* extension). Replacement for argv[0]. */
- Tcl_Size argc, /* Number of arguments. */
+ size_t argc, /* Number of arguments. */
const char **argv, /* Argument strings in UTF. */
Tcl_DString *linePtr) /* Initialized Tcl_DString that receives the
* command line (WCHAR). */
{
const char *arg, *start, *special, *bspos;
int quote = 0;
- Tcl_Size i;
+ size_t i;
Tcl_DString ds;
static const char specMetaChars[] = "&|^<>!()%";
/* Characters to enclose in quotes if unpaired
@@ -1760,7 +1760,7 @@ TclpCreateCommandChannel(
TclFile writeFile, /* If non-null, gives the file for writing. */
TclFile errorFile, /* If non-null, gives the file where errors
* can be read. */
- Tcl_Size numPids, /* The number of pids in the pid array. */
+ size_t numPids, /* The number of pids in the pid array. */
Tcl_Pid *pidPtr) /* An array of process identifiers. */
{
char channelName[16 + TCL_INTEGER_SPACE];
@@ -1900,7 +1900,7 @@ TclGetAndDetachPids(
PipeInfo *pipePtr;
const Tcl_ChannelType *chanTypePtr;
Tcl_Obj *pidsObj;
- Tcl_Size i;
+ size_t i;
/*
* Punt if the channel is not a command channel.
@@ -2744,7 +2744,7 @@ Tcl_PidObjCmd(
Tcl_Channel chan;
const Tcl_ChannelType *chanTypePtr;
PipeInfo *pipePtr;
- Tcl_Size i;
+ size_t i;
Tcl_Obj *resultPtr;
if (objc > 2) {
@@ -3191,7 +3191,7 @@ TclpOpenTemporaryFile(
char *namePtr;
HANDLE handle;
DWORD flags = FILE_ATTRIBUTE_TEMPORARY;
- Tcl_Size length;
+ size_t length;
int counter, counter2;
Tcl_DString buf;
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index 3db36d5..78b47b9 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -85,7 +85,7 @@ typedef struct SerialInfo {
int readable; /* Flag that the channel is readable. */
int writable; /* Flag that the channel is writable. */
int blockTime; /* Maximum blocktime in msec. */
- unsigned int lastEventTime; /* Time in milliseconds since last readable
+ unsigned long long lastEventTime; /* Time in milliseconds since last readable
* event. */
/* Next readable event only after blockTime */
DWORD error; /* pending error code returned by
@@ -165,30 +165,30 @@ static COMMTIMEOUTS no_timeout = {
* Declarations for functions used only in this file.
*/
-static int SerialBlockProc(ClientData instanceData, int mode);
-static void SerialCheckProc(ClientData clientData, int flags);
-static int SerialCloseProc(ClientData instanceData,
+static int SerialBlockProc(void *instanceData, int mode);
+static void SerialCheckProc(void *clientData, int flags);
+static int SerialCloseProc(void *instanceData,
Tcl_Interp *interp, int flags);
static int SerialEventProc(Tcl_Event *evPtr, int flags);
-static void SerialExitHandler(ClientData clientData);
-static int SerialGetHandleProc(ClientData instanceData,
- int direction, ClientData *handlePtr);
+static void SerialExitHandler(void *clientData);
+static int SerialGetHandleProc(void *instanceData,
+ int direction, void **handlePtr);
static ThreadSpecificData *SerialInit(void);
-static int SerialInputProc(ClientData instanceData, char *buf,
+static int SerialInputProc(void *instanceData, char *buf,
int toRead, int *errorCode);
-static int SerialOutputProc(ClientData instanceData,
+static int SerialOutputProc(void *instanceData,
const char *buf, int toWrite, int *errorCode);
-static void SerialSetupProc(ClientData clientData, int flags);
-static void SerialWatchProc(ClientData instanceData, int mask);
-static void ProcExitHandler(ClientData clientData);
-static int SerialGetOptionProc(ClientData instanceData,
+static void SerialSetupProc(void *clientData, int flags);
+static void SerialWatchProc(void *instanceData, int mask);
+static void ProcExitHandler(void *clientData);
+static int SerialGetOptionProc(void *instanceData,
Tcl_Interp *interp, const char *optionName,
Tcl_DString *dsPtr);
-static int SerialSetOptionProc(ClientData instanceData,
+static int SerialSetOptionProc(void *instanceData,
Tcl_Interp *interp, const char *optionName,
const char *value);
static DWORD WINAPI SerialWriterThread(LPVOID arg);
-static void SerialThreadActionProc(ClientData instanceData,
+static void SerialThreadActionProc(void *instanceData,
int action);
static int SerialBlockingRead(SerialInfo *infoPtr, LPVOID buf,
DWORD bufSize, LPDWORD lpRead, LPOVERLAPPED osPtr);
@@ -373,14 +373,14 @@ SerialBlockTime(
*----------------------------------------------------------------------
*/
-static unsigned int
+static unsigned long long
SerialGetMilliseconds(void)
{
Tcl_Time time;
Tcl_GetTime(&time);
- return (time.sec * 1000 + time.usec / 1000);
+ return ((unsigned long long)time.sec * 1000 + (unsigned long)time.usec / 1000);
}
/*
@@ -469,7 +469,7 @@ SerialCheckProc(
int needEvent;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
COMSTAT cStat;
- unsigned int time;
+ unsigned long long time;
if (!(flags & TCL_FILE_EVENTS)) {
return;
@@ -519,8 +519,8 @@ SerialCheckProc(
(infoPtr->error & SERIAL_READ_ERRORS)) {
infoPtr->readable = 1;
time = SerialGetMilliseconds();
- if ((unsigned int) (time - infoPtr->lastEventTime)
- >= (unsigned int) infoPtr->blockTime) {
+ if ((time - infoPtr->lastEventTime)
+ >= (unsigned long long) infoPtr->blockTime) {
needEvent = 1;
infoPtr->lastEventTime = time;
}
@@ -561,7 +561,7 @@ SerialCheckProc(
static int
SerialBlockProc(
- ClientData instanceData, /* Instance data for channel. */
+ void *instanceData, /* Instance data for channel. */
int mode) /* TCL_MODE_BLOCKING or
* TCL_MODE_NONBLOCKING. */
{
@@ -600,7 +600,7 @@ SerialBlockProc(
static int
SerialCloseProc(
- ClientData instanceData, /* Pointer to SerialInfo structure. */
+ void *instanceData, /* Pointer to SerialInfo structure. */
TCL_UNUSED(Tcl_Interp *),
int flags)
{
@@ -796,7 +796,7 @@ SerialBlockingWrite(
LeaveCriticalSection(&infoPtr->csWrite);
if (result == FALSE) {
- int err = GetLastError();
+ DWORD err = GetLastError();
switch (err) {
case ERROR_IO_PENDING:
@@ -855,7 +855,7 @@ SerialBlockingWrite(
static int
SerialInputProc(
- ClientData instanceData, /* Serial state. */
+ void *instanceData, /* Serial state. */
char *buf, /* Where to store data read. */
int bufSize, /* How much space is available in the
* buffer? */
@@ -918,7 +918,7 @@ SerialInputProc(
}
if (bufSize == 0) {
- return bytesRead = 0;
+ return 0;
}
/*
@@ -962,7 +962,7 @@ SerialInputProc(
static int
SerialOutputProc(
- ClientData instanceData, /* Serial state. */
+ void *instanceData, /* Serial state. */
const char *buf, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
@@ -1192,7 +1192,7 @@ SerialEventProc(
static void
SerialWatchProc(
- ClientData instanceData, /* Serial state. */
+ void *instanceData, /* Serial state. */
int mask) /* What events to watch for, OR-ed combination
* of TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
@@ -1249,13 +1249,13 @@ SerialWatchProc(
static int
SerialGetHandleProc(
- ClientData instanceData, /* The serial state. */
+ void *instanceData, /* The serial state. */
TCL_UNUSED(int) /*direction*/,
- ClientData *handlePtr) /* Where to store the handle. */
+ void **handlePtr) /* Where to store the handle. */
{
SerialInfo *infoPtr = (SerialInfo *) instanceData;
- *handlePtr = (ClientData) infoPtr->handle;
+ *handlePtr = (void *) infoPtr->handle;
return TCL_OK;
}
@@ -1613,7 +1613,7 @@ SerialModemStatusStr(
static int
SerialSetOptionProc(
- ClientData instanceData, /* File state. */
+ void *instanceData, /* File state. */
Tcl_Interp *interp, /* For error reporting - can be NULL. */
const char *optionName, /* Which option to set? */
const char *value) /* New value for option. */
@@ -2037,7 +2037,7 @@ SerialSetOptionProc(
static int
SerialGetOptionProc(
- ClientData instanceData, /* File state. */
+ void *instanceData, /* File state. */
Tcl_Interp *interp, /* For error reporting - can be NULL. */
const char *optionName, /* Option to get. */
Tcl_DString *dsPtr) /* Where to store value(s). */
@@ -2274,7 +2274,7 @@ SerialGetOptionProc(
static void
SerialThreadActionProc(
- ClientData instanceData,
+ void *instanceData,
int action)
{
SerialInfo *infoPtr = (SerialInfo *) instanceData;
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 841a854..0195895 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -203,7 +203,7 @@ int
TclpThreadCreate(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread. */
- ClientData clientData, /* The one argument to Main(). */
+ void *clientData, /* The one argument to Main(). */
size_t stackSize, /* Size of stack for the new thread. */
int flags) /* Flags controlling behaviour of the new
* thread. */
@@ -535,7 +535,7 @@ TclFinalizeLock(void)
#if TCL_THREADS
/* locally used prototype */
-static void FinalizeConditionEvent(ClientData data);
+static void FinalizeConditionEvent(void *data);
/*
*----------------------------------------------------------------------
@@ -725,7 +725,7 @@ Tcl_ConditionWait(
if (timePtr == NULL) {
wtime = INFINITE;
} else {
- wtime = timePtr->sec * 1000 + timePtr->usec / 1000;
+ wtime = (DWORD)timePtr->sec * 1000 + (unsigned long)timePtr->usec / 1000;
}
/*
@@ -880,7 +880,7 @@ Tcl_ConditionNotify(
static void
FinalizeConditionEvent(
- ClientData data)
+ void *data)
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) data;