diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinFCmd.c | 9 | ||||
-rw-r--r-- | win/tclWinInit.c | 24 | ||||
-rw-r--r-- | win/tclWinPipe.c | 33 | ||||
-rw-r--r-- | win/tclWinSerial.c | 19 |
4 files changed, 42 insertions, 43 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index acf61b7..7f35bd7 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -309,7 +309,7 @@ DoRenameFile( if (srcAttr & FILE_ATTRIBUTE_DIRECTORY) { WCHAR *nativeSrcRest, *nativeDstRest; const char **srcArgv, **dstArgv; - int size, srcArgc, dstArgc; + Tcl_Size size, srcArgc, dstArgc; WCHAR nativeSrcPath[MAX_PATH]; WCHAR nativeDstPath[MAX_PATH]; Tcl_DString srcString, dstString; @@ -317,7 +317,7 @@ DoRenameFile( size = GetFullPathNameW(nativeSrc, MAX_PATH, nativeSrcPath, &nativeSrcRest); - if ((size == 0) || (size > MAX_PATH)) { + if ((size <= 0) || (size > MAX_PATH)) { return TCL_ERROR; } size = GetFullPathNameW(nativeDst, MAX_PATH, @@ -1535,7 +1535,7 @@ GetWinFileAttributes( * We test for, and fix that case, here. */ - int len; + Tcl_Size len; const char *str = TclGetStringFromObj(fileName, &len); if (len < 4) { @@ -1595,7 +1595,7 @@ ConvertFileNameFormat( int longShort, /* 0 to short name, 1 to long name. */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { - int pathc, i; + Tcl_Size pathc, i, length; Tcl_Obj *splitPath; splitPath = Tcl_FSSplitPath(fileName, &pathc); @@ -1621,7 +1621,6 @@ ConvertFileNameFormat( for (i = 0; i < pathc; i++) { Tcl_Obj *elt; char *pathv; - int length; Tcl_ListObjIndex(NULL, splitPath, i, &elt); diff --git a/win/tclWinInit.c b/win/tclWinInit.c index c085c81..253acee 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -124,14 +124,14 @@ TclpInitPlatform(void) void TclpInitLibraryPath( char **valuePtr, - unsigned int *lengthPtr, + TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr) { #define LIBRARY_SIZE 64 Tcl_Obj *pathPtr; char installLib[LIBRARY_SIZE]; const char *bytes; - int length; + Tcl_Size length; TclNewObj(pathPtr); @@ -198,7 +198,7 @@ AppendEnvironment( Tcl_Obj *pathPtr, const char *lib) { - int pathc; + Tcl_Size pathc; WCHAR wBuf[MAX_PATH]; char buf[MAX_PATH * 3]; Tcl_Obj *objPtr; @@ -284,10 +284,10 @@ AppendEnvironment( static void InitializeDefaultLibraryDir( char **valuePtr, - unsigned int *lengthPtr, + TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr) { - HMODULE hModule = TclWinGetTclInstance(); + HMODULE hModule = (HMODULE)TclWinGetTclInstance(); WCHAR wName[MAX_PATH + LIBRARY_SIZE]; char name[(MAX_PATH + LIBRARY_SIZE) * 3]; char *end, *p; @@ -332,10 +332,10 @@ InitializeDefaultLibraryDir( static void InitializeSourceLibraryDir( char **valuePtr, - unsigned int *lengthPtr, + TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr) { - HMODULE hModule = TclWinGetTclInstance(); + HMODULE hModule = (HMODULE)TclWinGetTclInstance(); WCHAR wName[MAX_PATH + LIBRARY_SIZE]; char name[(MAX_PATH + LIBRARY_SIZE) * 3]; char *end, *p; @@ -582,16 +582,16 @@ TclpSetVariables( # define tenviron2utfdstr(string, len, dsPtr) \ (char *)Tcl_Char16ToUtfDString((const unsigned short *)(string), ((((len) + 2) >> 1) - 1), (dsPtr)) -int +Tcl_Size TclpFindVariable( const char *name, /* Name of desired environment variable * (UTF-8). */ - int *lengthPtr) /* Used to return length of name (for + Tcl_Size *lengthPtr) /* Used to return length of name (for * successful searches) or number of non-NULL * entries in environ (for unsuccessful * searches). */ { - int i, length, result = -1; + Tcl_Size i, length, result = -1; const WCHAR *env; const char *p1, *p2; char *envUpper, *nameUpper; @@ -617,12 +617,12 @@ TclpFindVariable( */ Tcl_DStringInit(&envString); - envUpper = Tcl_WCharToUtfDString(env, TCL_INDEX_NONE, &envString); + envUpper = Tcl_WCharToUtfDString(env, -1, &envString); p1 = strchr(envUpper, '='); if (p1 == NULL) { continue; } - length = (int) (p1 - envUpper); + length = p1 - envUpper; Tcl_DStringSetLength(&envString, length+1); Tcl_UtfToUpper(envUpper); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 14767f9..bcb0b2c 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -61,7 +61,7 @@ typedef struct { typedef struct ProcInfo { HANDLE hProcess; - DWORD dwProcessId; + TCL_HASH_TYPE dwProcessId; struct ProcInfo *nextPtr; } ProcInfo; @@ -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. */ + TCL_HASH_TYPE 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 @@ -869,7 +869,7 @@ TclpGetPid( Tcl_MutexLock(&pipeMutex); for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) { - if (infoPtr->dwProcessId == (DWORD)(size_t)pid) { + if (infoPtr->dwProcessId == PTR2INT(pid)) { Tcl_MutexUnlock(&pipeMutex); return infoPtr->dwProcessId; } @@ -1163,7 +1163,7 @@ TclpCreateProcess( WaitForInputIdle(procInfo.hProcess, 5000); CloseHandle(procInfo.hThread); - *pidPtr = (Tcl_Pid) (size_t) procInfo.dwProcessId; + *pidPtr = (Tcl_Pid)UINT2PTR(procInfo.dwProcessId); if (*pidPtr != 0) { TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId); } @@ -1906,8 +1906,8 @@ TclGetAndDetachPids( { PipeInfo *pipePtr; const Tcl_ChannelType *chanTypePtr; - Tcl_Obj *pidsObj; - Tcl_Size i; + Tcl_Obj *pidsObj, *elemPtr; + TCL_HASH_TYPE i; /* * Punt if the channel is not a command channel. @@ -1921,9 +1921,8 @@ TclGetAndDetachPids( pipePtr = (PipeInfo *)Tcl_GetChannelInstanceData(chan); TclNewObj(pidsObj); for (i = 0; i < pipePtr->numPids; i++) { - Tcl_ListObjAppendElement(NULL, pidsObj, - Tcl_NewWideIntObj((unsigned) - TclpGetPid(pipePtr->pidPtr[i]))); + TclNewIntObj(elemPtr, TclpGetPid(pipePtr->pidPtr[i])); + Tcl_ListObjAppendElement(NULL, pidsObj, elemPtr); Tcl_DetachPids(1, &pipePtr->pidPtr[i]); } Tcl_SetObjResult(interp, pidsObj); @@ -2566,7 +2565,7 @@ Tcl_WaitPid( prevPtrPtr = &procList; for (infoPtr = procList; infoPtr != NULL; prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) { - if (infoPtr->dwProcessId == (DWORD) (size_t) pid) { + if (infoPtr->dwProcessId == PTR2INT(pid)) { *prevPtrPtr = infoPtr->nextPtr; break; } @@ -2710,7 +2709,7 @@ Tcl_WaitPid( void TclWinAddProcess( void *hProcess, /* Handle to process */ - unsigned long id) /* Global process identifier */ + Tcl_Size id) /* Global process identifier */ { ProcInfo *procPtr = (ProcInfo *)ckalloc(sizeof(ProcInfo)); @@ -2751,15 +2750,16 @@ Tcl_PidObjCmd( Tcl_Channel chan; const Tcl_ChannelType *chanTypePtr; PipeInfo *pipePtr; - Tcl_Size i; - Tcl_Obj *resultPtr; + TCL_HASH_TYPE i; + Tcl_Obj *resultPtr, *elemPtr; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?channelId?"); return TCL_ERROR; } if (objc == 1) { - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((unsigned) getpid())); + TclNewIntObj(elemPtr, getpid()); + Tcl_SetObjResult(interp, elemPtr); } else { chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL); @@ -2774,9 +2774,8 @@ Tcl_PidObjCmd( pipePtr = (PipeInfo *) Tcl_GetChannelInstanceData(chan); TclNewObj(resultPtr); for (i = 0; i < pipePtr->numPids; i++) { - Tcl_ListObjAppendElement(/*interp*/ NULL, resultPtr, - Tcl_NewWideIntObj((unsigned) - TclpGetPid(pipePtr->pidPtr[i]))); + TclNewIntObj(elemPtr, TclpGetPid(pipePtr->pidPtr[i])); + Tcl_ListObjAppendElement(/*interp*/ NULL, resultPtr, elemPtr); } Tcl_SetObjResult(interp, resultPtr); } diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 6ab305c..372b77a 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 @@ -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; } @@ -918,7 +918,7 @@ SerialInputProc( } if (bufSize == 0) { - return bytesRead = 0; + return 0; } /* @@ -1630,7 +1630,7 @@ SerialSetOptionProc( size_t len, vlen; Tcl_DString ds; const WCHAR *native; - int argc; + Tcl_Size argc; const char **argv; infoPtr = (SerialInfo *) instanceData; @@ -1826,7 +1826,8 @@ SerialSetOptionProc( */ if ((len > 4) && (strncmp(optionName, "-ttycontrol", len) == 0)) { - int i, res = TCL_OK; + Tcl_Size i; + int res = TCL_OK; if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) { return TCL_ERROR; |