mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2026-09-23 07:02:22 +00:00
* zdump.c: Minor integer-size porting fixes.
(main): Don't assume SECSPERDAY <= INT_MAX here, since we try not to assume that sort of thing elsewhere in this file. Don't rely on undefined behavior in the weird case where cuthitime < absolute_min_time + SECSPERDAY / 2.
This commit is contained in:
@@ -452,7 +452,7 @@ main(int argc, char *argv[])
|
|||||||
t = absolute_min_time;
|
t = absolute_min_time;
|
||||||
if (!Vflag) {
|
if (!Vflag) {
|
||||||
show(argv[i], t, TRUE);
|
show(argv[i], t, TRUE);
|
||||||
t += SECSPERHOUR * HOURSPERDAY;
|
t += SECSPERDAY;
|
||||||
show(argv[i], t, TRUE);
|
show(argv[i], t, TRUE);
|
||||||
}
|
}
|
||||||
if (t < cutlotime)
|
if (t < cutlotime)
|
||||||
@@ -463,9 +463,11 @@ main(int argc, char *argv[])
|
|||||||
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
|
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
|
||||||
}
|
}
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
if (t >= cuthitime || t >= cuthitime - SECSPERHOUR * 12)
|
newt = (t < absolute_max_time - SECSPERDAY / 2
|
||||||
|
? t + SECSPERDAY / 2
|
||||||
|
: absolute_max_time);
|
||||||
|
if (cuthitime <= newt)
|
||||||
break;
|
break;
|
||||||
newt = t + SECSPERHOUR * 12;
|
|
||||||
newtmp = localtime(&newt);
|
newtmp = localtime(&newt);
|
||||||
if (newtmp != NULL)
|
if (newtmp != NULL)
|
||||||
newtm = *newtmp;
|
newtm = *newtmp;
|
||||||
@@ -488,9 +490,9 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (!Vflag) {
|
if (!Vflag) {
|
||||||
t = absolute_max_time;
|
t = absolute_max_time;
|
||||||
t -= SECSPERHOUR * HOURSPERDAY;
|
t -= SECSPERDAY;
|
||||||
show(argv[i], t, TRUE);
|
show(argv[i], t, TRUE);
|
||||||
t += SECSPERHOUR * HOURSPERDAY;
|
t += SECSPERDAY;
|
||||||
show(argv[i], t, TRUE);
|
show(argv[i], t, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user