summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclClock.c15
-rw-r--r--generic/tclClockFmt.c43
-rw-r--r--generic/tclDate.h2
3 files changed, 30 insertions, 30 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index cf5b7d5..1c91578 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -2412,12 +2412,11 @@ Tcl_Obj *
LookupLastTransition(
Tcl_Interp *interp, /* Interpreter for error messages */
Tcl_WideInt tick, /* Time from the epoch */
- int rowc, /* Number of rows of tzdata */
+ Tcl_Size rowc, /* Number of rows of tzdata */
Tcl_Obj *const *rowv, /* Rows in tzdata */
Tcl_WideInt *rangesVal) /* Return bounds for time period */
{
- int l = 0;
- int u;
+ Tcl_Size l, u;
Tcl_Obj *compObj;
Tcl_WideInt compVal, fromVal = LLONG_MIN, toVal = LLONG_MAX;
@@ -2447,9 +2446,10 @@ LookupLastTransition(
* Binary-search to find the transition.
*/
+ l = 0;
u = rowc-1;
while (l < u) {
- int m = (l + u + 1) / 2;
+ Tcl_Size m = (l + u + 1) / 2;
if (Tcl_ListObjIndex(interp, rowv[m], 0, &compObj) != TCL_OK ||
TclGetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) {
@@ -3955,7 +3955,8 @@ ClockFreeScan(
yyInput = Tcl_GetString(strObj);
if (TclClockFreeScan(interp, info) != TCL_OK) {
- Tcl_Obj *msg = Tcl_NewObj();
+ Tcl_Obj *msg;
+ TclNewObj(msg);
Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s",
Tcl_GetString(strObj), TclGetString(Tcl_GetObjResult(interp)));
Tcl_SetObjResult(interp, msg);
@@ -4628,7 +4629,7 @@ TzsetIfNecessary(void)
{
static WCHAR* tzWas = (WCHAR *)INT2PTR(-1); /* Previous value of TZ, protected by
* clockMutex. */
- static long tzLastRefresh = 0; /* Used for latency before next refresh */
+ static long long tzLastRefresh = 0; /* Used for latency before next refresh */
static size_t tzWasEpoch = 0; /* Epoch, signals that TZ changed */
static size_t tzEnvEpoch = 0; /* Last env epoch, for faster signaling,
that TZ changed via TCL */
@@ -4637,7 +4638,7 @@ TzsetIfNecessary(void)
/*
* Prevent performance regression on some platforms by resolving of system time zone:
* small latency for check whether environment was changed (once per second)
- * no latency if environment was chaned with tcl-env (compare both epoch values)
+ * no latency if environment was changed with tcl-env (compare both epoch values)
*/
Tcl_Time now;
Tcl_GetTime(&now);
diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c
index 9bf10ed..f79a863 100644
--- a/generic/tclClockFmt.c
+++ b/generic/tclClockFmt.c
@@ -606,7 +606,7 @@ ClockFmtObj_UpdateString(
Tcl_Obj *objPtr)
{
const char *name = "UNKNOWN";
- int len;
+ size_t len;
ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr);
if (fss != NULL) {
@@ -614,10 +614,11 @@ ClockFmtObj_UpdateString(
name = hPtr->key.string;
}
len = strlen(name);
- objPtr->length = len,
- objPtr->bytes = (char *)Tcl_Alloc((size_t)++len);
- if (objPtr->bytes)
+ objPtr->length = len++,
+ objPtr->bytes = (char *)Tcl_Alloc(len);
+ if (objPtr->bytes) {
memcpy(objPtr->bytes, name, len);
+ }
}
/*
@@ -1053,15 +1054,14 @@ DetermineGreedySearchLen(
static inline int
ObjListSearch(
DateInfo *info, int *val,
- Tcl_Obj **lstv, int lstc,
+ Tcl_Obj **lstv, Tcl_Size lstc,
int minLen, int maxLen)
{
- int i, l, lf = -1;
+ Tcl_Size i, l, lf = -1;
const char *s, *f, *sf;
/* search in list */
for (i = 0; i < lstc; i++) {
- s = TclGetString(lstv[i]);
- l = lstv[i]->length;
+ s = Tcl_GetStringFromObj(lstv[i], &l);
if ( l >= minLen
&& (f = TclUtfFindEqualNC(yyInput, yyInput + maxLen, s, s + l, &sf)) > yyInput
@@ -1323,7 +1323,7 @@ static int
StaticListSearch(ClockFmtScnCmdArgs *opts,
DateInfo *info, const char **lst, int *val)
{
- int len;
+ size_t len;
const char **s = lst;
while (*s != NULL) {
len = strlen(*s);
@@ -2598,7 +2598,7 @@ ClockFmtToken_AMPM_Proc(
{
Tcl_Obj *mcObj;
const char *s;
- int len;
+ Tcl_Size len;
if (*val < (SECONDS_PER_DAY / 2)) {
mcObj = ClockMCGet(opts, MCLIT_AM);
@@ -2608,7 +2608,7 @@ ClockFmtToken_AMPM_Proc(
if (mcObj == NULL) {
return TCL_ERROR;
}
- s = TclGetString(mcObj); len = mcObj->length;
+ s = Tcl_GetStringFromObj(mcObj, &len);
if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; };
memcpy(dateFmt->output, s, len + 1);
if (*tok->tokWord.start == 'p') {
@@ -2758,7 +2758,7 @@ ClockFmtToken_TimeZone_Proc(
}
} else {
Tcl_Obj * objPtr;
- const char *s; int len;
+ const char *s; Tcl_Size len;
/* convert seconds to local seconds to obtain tzName object */
if (ConvertUTCToLocal(opts->clientData, opts->interp,
&dateFmt->date, opts->timezoneObj,
@@ -2766,8 +2766,7 @@ ClockFmtToken_TimeZone_Proc(
return TCL_ERROR;
};
objPtr = dateFmt->date.tzName;
- s = TclGetString(objPtr);
- len = objPtr->length;
+ s = Tcl_GetStringFromObj(objPtr, &len);
if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; };
memcpy(dateFmt->output, s, len + 1);
dateFmt->output += len;
@@ -2784,7 +2783,7 @@ ClockFmtToken_LocaleERA_Proc(
{
Tcl_Obj *mcObj;
const char *s;
- int len;
+ Tcl_Size len;
if (dateFmt->date.isBce) {
mcObj = ClockMCGet(opts, MCLIT_BCE);
@@ -2794,7 +2793,7 @@ ClockFmtToken_LocaleERA_Proc(
if (mcObj == NULL) {
return TCL_ERROR;
}
- s = TclGetString(mcObj); len = mcObj->length;
+ s = Tcl_GetStringFromObj(mcObj, &len);
if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; };
memcpy(dateFmt->output, s, len + 1);
dateFmt->output += len;
@@ -2844,7 +2843,7 @@ ClockFmtToken_LocaleERAYear_Proc(
} else {
Tcl_Obj *objPtr;
const char *s;
- int len;
+ Tcl_Size len;
if (*tok->tokWord.start == 'C') { /* %EC */
if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 1,
&objPtr) != TCL_OK ) {
@@ -2877,8 +2876,7 @@ ClockFmtToken_LocaleERAYear_Proc(
return TCL_OK;
}
}
- s = TclGetString(objPtr);
- len = objPtr->length;
+ s = Tcl_GetStringFromObj(objPtr, &len);
if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; };
memcpy(dateFmt->output, s, len + 1);
dateFmt->output += len;
@@ -3281,7 +3279,7 @@ ClockFormat(
break;
case CTOKT_WORD:
if (1) {
- int len = tok->tokWord.end - tok->tokWord.start;
+ Tcl_Size len = tok->tokWord.end - tok->tokWord.start;
if (FrmResultAllocate(dateFmt, len) != TCL_OK) { goto error; };
if (len == 1) {
*dateFmt->output++ = *tok->tokWord.start;
@@ -3306,8 +3304,9 @@ error:
done:
if (dateFmt->resMem) {
- size_t size;
- Tcl_Obj * result = Tcl_NewObj();
+ size_t size;
+ Tcl_Obj *result;
+ TclNewObj(result);
result->length = dateFmt->output - dateFmt->resMem;
size = result->length+1;
if (dateFmt->resMem == resMem) {
diff --git a/generic/tclDate.h b/generic/tclDate.h
index 911e285..5033018 100644
--- a/generic/tclDate.h
+++ b/generic/tclDate.h
@@ -517,7 +517,7 @@ MODULE_SCOPE int ConvertUTCToLocal(void *clientData, Tcl_Interp *,
TclDateFields *, Tcl_Obj *timezoneObj, int);
MODULE_SCOPE Tcl_Obj *
LookupLastTransition(Tcl_Interp *, Tcl_WideInt,
- int, Tcl_Obj *const *, Tcl_WideInt *rangesVal);
+ Tcl_Size, Tcl_Obj *const *, Tcl_WideInt *rangesVal);
MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info);