mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
2007-12-08 Ulrich Drepper <drepper@redhat.com> [BZ #5424] * stdio-common/vfprintf.c: Do not overflow when adding to done. * stdio-common/Makefile (tests): Add bug22. * stdio-common/bug22.c: New file. [BZ #5451] * time/getdate.c: Fix filling in default values. * time/bug-getdate1.c: New file. * time/Makefile: Add rules to build and run bug-getdate1. * iconvdata/ebcdic-is-friss.c: Use 8bit-gap instead of 8bit-generic. * iconvdata/ebcdic-es.c: Likewise. * iconvdata/ebcdic-es-a.c: Likewise. * iconvdata/ebcdic-uk.c: Likewise. * iconvdata/iso8859-16.c: Likewise. * iconvdata/viscii.c: Likewise. * iconvdata/iso8859-9e.c: Likewise. * iconvdata/Makefile: Adjust appropriately. [BZ #5428] * wcsmbs/wchar.h: Unconditionally undefine __need_mbstate and __need_wint_t. * iconvdata/gconv-modules: Likewise.
This commit is contained in:
@ -212,22 +212,7 @@ __getdate_r (const char *string, struct tm *tp)
|
||||
tp->tm_sec = tm.tm_sec;
|
||||
}
|
||||
|
||||
/* If no date is given, today is assumed if the given hour is
|
||||
greater than the current hour and tomorrow is assumed if
|
||||
it is less. */
|
||||
if (tp->tm_hour >= 0 && tp->tm_hour <= 23
|
||||
&& tp->tm_year == INT_MIN && tp->tm_mon == INT_MIN
|
||||
&& tp->tm_mday == INT_MIN && tp->tm_wday == INT_MIN)
|
||||
{
|
||||
tp->tm_year = tm.tm_year;
|
||||
tp->tm_mon = tm.tm_mon;
|
||||
tp->tm_mday = tm.tm_mday + ((tp->tm_hour - tm.tm_hour) < 0 ? 1 : 0);
|
||||
mday_ok = 1;
|
||||
}
|
||||
|
||||
/* Fill in the gaps. */
|
||||
if (tp->tm_year == INT_MIN)
|
||||
tp->tm_year = tm.tm_year;
|
||||
if (tp->tm_hour == INT_MIN)
|
||||
tp->tm_hour = 0;
|
||||
if (tp->tm_min == INT_MIN)
|
||||
@ -235,6 +220,24 @@ __getdate_r (const char *string, struct tm *tp)
|
||||
if (tp->tm_sec == INT_MIN)
|
||||
tp->tm_sec = 0;
|
||||
|
||||
/* If no date is given, today is assumed if the given hour is
|
||||
greater than the current hour and tomorrow is assumed if
|
||||
it is less. */
|
||||
if (tp->tm_hour >= 0 && tp->tm_hour <= 23
|
||||
&& tp->tm_mon == INT_MIN
|
||||
&& tp->tm_mday == INT_MIN && tp->tm_wday == INT_MIN)
|
||||
{
|
||||
tp->tm_mon = tm.tm_mon;
|
||||
tp->tm_mday = tm.tm_mday + ((tp->tm_hour - tm.tm_hour) < 0 ? 1 : 0);
|
||||
mday_ok = 1;
|
||||
}
|
||||
|
||||
/* More fillers. */
|
||||
if (tp->tm_year == INT_MIN)
|
||||
tp->tm_year = tm.tm_year;
|
||||
if (tp->tm_mon == INT_MIN)
|
||||
tp->tm_mon = tm.tm_mon;
|
||||
|
||||
/* Check if the day of month is within range, and if the time can be
|
||||
represented in a time_t. We make use of the fact that the mktime
|
||||
call normalizes the struct tm. */
|
||||
|
Reference in New Issue
Block a user