summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-12-11 19:43:11 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-12-11 19:43:11 (GMT)
commit00268d4ae68741fdbf73a54412cd38648f9d7302 (patch)
tree10a1aab809299681be8914d27e5320ee5f355c20
parent416725e4641bfe8aa72fcfa7812e7c978ebbf823 (diff)
downloadtcl-00268d4ae68741fdbf73a54412cd38648f9d7302.zip
tcl-00268d4ae68741fdbf73a54412cd38648f9d7302.tar.gz
tcl-00268d4ae68741fdbf73a54412cd38648f9d7302.tar.bz2
Better use of Tcl_WideInt in stead of long, sometimes
-rw-r--r--generic/tclBasic.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 24c1aa4..fd0d8c8 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -1058,11 +1058,11 @@ Tcl_CreateInterp(void)
TCL_GLOBAL_ONLY);
Tcl_SetVar2Ex(interp, "tcl_platform", "wordSize",
- Tcl_NewLongObj((long) sizeof(long)), TCL_GLOBAL_ONLY);
+ Tcl_NewWideIntObj(sizeof(long)), TCL_GLOBAL_ONLY);
/* TIP #291 */
Tcl_SetVar2Ex(interp, "tcl_platform", "pointerSize",
- Tcl_NewLongObj((long) sizeof(void *)), TCL_GLOBAL_ONLY);
+ Tcl_NewWideIntObj(sizeof(void *)), TCL_GLOBAL_ONLY);
/*
* Set up other variables such as tcl_version and tcl_library
@@ -2747,7 +2747,7 @@ TclInvokeStringCommand(
Command *cmdPtr = clientData;
int i, result;
const char **argv =
- TclStackAlloc(interp, (unsigned)(objc + 1) * sizeof(char *));
+ TclStackAlloc(interp, (objc + 1) * sizeof(char *));
for (i = 0; i < objc; i++) {
argv[i] = TclGetString(objv[i]);
@@ -2776,7 +2776,7 @@ TclInvokeStringCommand(
* in the Command structure.
*
* Results:
- * A standard Tcl string result value.
+ * A standard Tcl result value.
*
* Side effects:
* Besides those side effects of the called Tcl_ObjCmdProc,
@@ -2796,7 +2796,7 @@ TclInvokeObjectCommand(
Tcl_Obj *objPtr;
int i, length, result;
Tcl_Obj **objv =
- TclStackAlloc(interp, (unsigned)(argc * sizeof(Tcl_Obj *)));
+ TclStackAlloc(interp, (argc * sizeof(Tcl_Obj *)));
for (i = 0; i < argc; i++) {
length = strlen(argv[i]);
@@ -4976,7 +4976,7 @@ TEOV_NotFound(
Tcl_ListObjGetElements(NULL, currNsPtr->unknownHandlerPtr,
&handlerObjc, &handlerObjv);
newObjc = objc + handlerObjc;
- newObjv = TclStackAlloc(interp, (int) sizeof(Tcl_Obj *) * newObjc);
+ newObjv = TclStackAlloc(interp, sizeof(Tcl_Obj *) * newObjc);
/*
* Copy command prefix from unknown handler and add on the real command's
@@ -4988,7 +4988,7 @@ TEOV_NotFound(
newObjv[i] = handlerObjv[i];
Tcl_IncrRefCount(newObjv[i]);
}
- memcpy(newObjv+handlerObjc, objv, sizeof(Tcl_Obj *) * (unsigned)objc);
+ memcpy(newObjv+handlerObjc, objv, sizeof(Tcl_Obj *) * objc);
/*
* Look up and invoke the handler (by recursive call to this function). If
@@ -7790,7 +7790,7 @@ ExprAbsFunc(
while (numBytes) {
if (*bytes == '-') {
- Tcl_SetObjResult(interp, Tcl_NewLongObj(0));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
return TCL_OK;
}
bytes++; numBytes--;
@@ -8155,7 +8155,7 @@ ExprRoundFunc(
if (type == TCL_NUMBER_DOUBLE) {
double fractPart, intPart;
- long max = LONG_MAX, min = LONG_MIN;
+ Tcl_WideInt max = WIDE_MAX, min = WIDE_MIN;
fractPart = modf(*((const double *) ptr), &intPart);
if (fractPart <= -0.5) {
@@ -8178,14 +8178,14 @@ ExprRoundFunc(
Tcl_SetObjResult(interp, Tcl_NewBignumObj(&big));
return TCL_OK;
} else {
- long result = (long)intPart;
+ Tcl_WideInt result = (Tcl_WideInt)intPart;
if (fractPart <= -0.5) {
result--;
} else if (fractPart >= 0.5) {
result++;
}
- Tcl_SetObjResult(interp, Tcl_NewLongObj(result));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result));
return TCL_OK;
}
}