summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-09-05 12:11:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-09-05 12:11:13 (GMT)
commit5c9968a001208bb4fc6d06ad040c28bd84b7831f (patch)
treed71658efb855b5f330940d518f9cd7ed473b1f9a
parentfdf1df3b29531c5031a33f2e3c1f4668937c1c5f (diff)
downloadtcl-5c9968a001208bb4fc6d06ad040c28bd84b7831f.zip
tcl-5c9968a001208bb4fc6d06ad040c28bd84b7831f.tar.gz
tcl-5c9968a001208bb4fc6d06ad040c28bd84b7831f.tar.bz2
Minor code cleanup.
win/tclWinPipe.c: Eliminate some compiler warnings on mingw-w64 win/tclWinNotify.c: Eliminate tsdPtr->timeout variable, since it's only being written to. other files: code cleanup, eliminate unnecessary type casts
-rw-r--r--generic/tclBasic.c8
-rw-r--r--generic/tclObj.c2
-rw-r--r--win/tclWinNotify.c4
-rw-r--r--win/tclWinPipe.c14
4 files changed, 12 insertions, 16 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 0190c13..71a1442 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -7700,13 +7700,11 @@ ExprWideFunc(
Tcl_Obj *const *objv) /* Actual parameter vector. */
{
Tcl_WideInt wResult;
- Tcl_Obj *objPtr;
if (ExprEntierFunc(NULL, interp, objc, objv) != TCL_OK) {
return TCL_ERROR;
}
- objPtr = Tcl_GetObjResult(interp);
- TclGetWideBitsFromObj(NULL, objPtr, &wResult);
+ TclGetWideBitsFromObj(NULL, Tcl_GetObjResult(interp), &wResult);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(wResult));
return TCL_OK;
}
@@ -7809,7 +7807,7 @@ ExprRandFunc(
* Make sure 1 <= randSeed <= (2^31) - 2. See below.
*/
- iPtr->randSeed &= (unsigned long) 0x7fffffff;
+ iPtr->randSeed &= 0x7fffffff;
if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) {
iPtr->randSeed ^= 123459876;
}
@@ -7974,7 +7972,7 @@ ExprSrandFunc(
*/
iPtr->flags |= RAND_SEED_INITIALIZED;
- iPtr->randSeed = (unsigned long) (w & 0x7fffffff);
+ iPtr->randSeed = (long) w & 0x7fffffff;
if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) {
iPtr->randSeed ^= 123459876;
}
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 490e80e..ce326fe 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -3111,7 +3111,7 @@ Tcl_GetWideIntFromObj(
* Attempt to return a wide integer from the Tcl object "objPtr". If the
* object is not already a int, double or bignum, an attempt will be made
* to convert it to one of these. Out-of-range values don't result in an
- * error, but only the least significant 64 bits will be returned.
+ * error, but only the least significant 64 bits will be returned.
*
* Results:
* The return value is a standard Tcl object result. If an error occurs
diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c
index 28c8445..b34fc4f 100644
--- a/win/tclWinNotify.c
+++ b/win/tclWinNotify.c
@@ -36,7 +36,6 @@ typedef struct {
int pending; /* Alert message pending, this field is locked
* by the notifierMutex. */
HWND hwnd; /* Messaging window. */
- int timeout; /* Current timeout value. */
int timerActive; /* 1 if interval timer is running. */
} ThreadSpecificData;
@@ -309,11 +308,10 @@ Tcl_SetTimer(
timeout = 1;
}
}
- tsdPtr->timeout = timeout;
if (timeout != 0) {
tsdPtr->timerActive = 1;
SetTimer(tsdPtr->hwnd, INTERVAL_TIMER,
- (unsigned long) tsdPtr->timeout, NULL);
+ timeout, NULL);
} else {
tsdPtr->timerActive = 0;
KillTimer(tsdPtr->hwnd, INTERVAL_TIMER);
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index cf0b80f..bd95ea4 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -869,7 +869,7 @@ TclpGetPid(
Tcl_MutexLock(&pipeMutex);
for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
- if (infoPtr->dwProcessId == (DWORD) pid) {
+ if (infoPtr->dwProcessId == (DWORD) (size_t) pid) {
Tcl_MutexUnlock(&pipeMutex);
return infoPtr->dwProcessId;
}
@@ -1163,7 +1163,7 @@ TclpCreateProcess(
WaitForInputIdle(procInfo.hProcess, 5000);
CloseHandle(procInfo.hThread);
- *pidPtr = (Tcl_Pid) procInfo.dwProcessId;
+ *pidPtr = (Tcl_Pid) (size_t) procInfo.dwProcessId;
if (*pidPtr != 0) {
TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId);
}
@@ -1478,10 +1478,10 @@ QuoteCmdLinePart(
QuoteCmdLineBackslash(dsPtr, start, *bspos, NULL);
start = *bspos;
}
- /*
- * escape all special chars enclosed in quotes like `"..."`, note that here we
+ /*
+ * escape all special chars enclosed in quotes like `"..."`, note that here we
* don't must escape `\` (with `\`), because it's outside of the main quotes,
- * so `\` remains `\`, but important - not at end of part, because results as
+ * so `\` remains `\`, but important - not at end of part, because results as
* before the quote, so `%\%\` should be escaped as `"%\%"\\`).
*/
TclDStringAppendLiteral(dsPtr, "\""); /* opening escape quote-char */
@@ -1636,7 +1636,7 @@ BuildCommandLine(
special++;
}
/* rest of argument (and escape backslashes before closing main quote) */
- QuoteCmdLineBackslash(&ds, start, special,
+ QuoteCmdLineBackslash(&ds, start, special,
(quote & CL_QUOTE) ? bspos : NULL);
}
if (quote & CL_QUOTE) {
@@ -2476,7 +2476,7 @@ Tcl_WaitPid(
prevPtrPtr = &procList;
for (infoPtr = procList; infoPtr != NULL;
prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) {
- if (infoPtr->dwProcessId == (DWORD) pid) {
+ if (infoPtr->dwProcessId == (DWORD) (size_t) pid) {
*prevPtrPtr = infoPtr->nextPtr;
break;
}