Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2004-12-08 20:54:38 +0300
committerJeff Johnston <jjohnstn@redhat.com>2004-12-08 20:54:38 +0300
commit4b30e15471f321e1332b8494c83d2c38025b75d8 (patch)
tree3ee30dfeeb789635f7707b152ab0d158284dd543 /newlib
parent465eab2eb41c08ebd5921800d568410653042e5c (diff)
2004-12-08 Alex Mogilnikov <alx@intellectronika.ru>
* libc/time/mktm_r (_mktm_r): Fix overflow calculation for m_day. (__tzcalc_limits): Fix reference to month array to be zero-based.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog6
-rw-r--r--newlib/libc/time/mktm_r.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 91e1fe243..24d6b1e8d 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-08 Alex Mogilnikov <alx@intellectronika.ru>
+
+ * libc/time/mktm_r (_mktm_r): Fix overflow calculation for
+ m_day.
+ (__tzcalc_limits): Fix reference to month array to be zero-based.
+
2004-12-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/linux/sys/unistd.h: Add prototypes for ftruncate, truncate,
diff --git a/newlib/libc/time/mktm_r.c b/newlib/libc/time/mktm_r.c
index 4fdfb9b7b..0ad568c96 100644
--- a/newlib/libc/time/mktm_r.c
+++ b/newlib/libc/time/mktm_r.c
@@ -2,6 +2,8 @@
* mktm_r.c
* Original Author: Adapted from tzcode maintained by Arthur David Olson.
* Modifications: Changed to mktm_r and added __tzcalc_limits - 04/10/02, Jeff Johnston
+ * Fixed bug in mday computations - 08/12/04, Alex Mogilnikov <alx@intellectronika.ru>
+ * Fixed bug in __tzcalc_limits - 08/12/04, Alex Mogilnikov <alx@intellectronika.ru>
*
* Converts the calendar time pointed to by tim_p into a broken-down time
* expressed as local time. Returns a pointer to a structure containing the
@@ -149,9 +151,9 @@ _DEFUN (_mktm_r, (tim_p, res, is_gmtime),
res->tm_wday = 0;
++res->tm_mday;
res->tm_hour -= HOURSPERDAY;
- if (res->tm_mday >= ip[res->tm_mon])
+ if (res->tm_mday > ip[res->tm_mon])
{
- res->tm_mday -= ip[res->tm_mon] - 1;
+ res->tm_mday -= ip[res->tm_mon];
res->tm_mon += 1;
if (res->tm_mon == 12)
{
@@ -231,7 +233,7 @@ _DEFUN (__tzcalc_limits, (year),
wday_diff += DAYSPERWEEK;
m_day = (__tzrule[i].n - 1) * DAYSPERWEEK + wday_diff;
- while (m_day >= ip[j])
+ while (m_day >= ip[j-1])
m_day -= DAYSPERWEEK;
days += m_day;