mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Update.
1998-09-24 Ulrich Drepper <drepper@cygnus.com> * debug/catchsegv.sh: Also produce output if cloned process died. 1998-09-24 Paul Eggert <eggert@twinsun.com> * strftime.c (f_wkday): Remove duplicate definition. (f_wkday, f_month, a_wkday, a_month, ampm): Define as macros when !defined _NL_CURRENT && !HAVE_STRFTIME; this propagates the 1998-09-11 fix to this case. (wkday_len, month_len): Remove these macros; they're no longer needed. 1998-09-24 Paul Eggert <eggert@twinsun.com> * strftime.c (my_strftime): Don't store past the end of a zero-sized buffer. * time/strftime.c (underlying_strftime): * time/strftime.c (INT_STRLEN_BOUND): Fix typo by changing 100 to 1000.
This commit is contained in:
@@ -416,15 +416,14 @@ my_strftime (s, maxsize, format, tp)
|
||||
{
|
||||
int hour12 = tp->tm_hour;
|
||||
#ifdef _NL_CURRENT
|
||||
/* We cannot make the following values variables since we must dealy
|
||||
/* We cannot make the following values variables since we must delay
|
||||
the evaluation of these values until really needed since some
|
||||
expressions might not be valid in every situation. The `struct tm'
|
||||
might be generated by a strptime() call and therefore initialized
|
||||
might be generated by a strptime() call that initialized
|
||||
only a few elements. Dereference the pointers only if the format
|
||||
requires this. Then it is ok to fail if the pointers are invalid. */
|
||||
# define a_wkday _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday)
|
||||
# define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday)
|
||||
# define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday)
|
||||
# define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon)
|
||||
# define f_month _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon)
|
||||
# define ampm _NL_CURRENT (LC_TIME, tp->tm_hour > 11 ? PM_STR : AM_STR)
|
||||
@@ -432,22 +431,17 @@ my_strftime (s, maxsize, format, tp)
|
||||
# define aw_len strlen (a_wkday)
|
||||
# define am_len strlen (a_month)
|
||||
# define ap_len strlen (ampm)
|
||||
|
||||
# define wkday_len strlen (f_wkday)
|
||||
# define month_len strlen (f_month)
|
||||
#else
|
||||
# if !HAVE_STRFTIME
|
||||
const char *const f_wkday = weekday_name[tp->tm_wday];
|
||||
const char *const f_month = month_name[tp->tm_mon];
|
||||
const char *const a_wkday = f_wkday;
|
||||
const char *const a_month = f_month;
|
||||
const char *const ampm = "AMPM" + 2 * (hour12 > 11);
|
||||
# define f_wkday (weekday_name[tp->tm_wday])
|
||||
# define f_month (month_name[tp->tm_mon])
|
||||
# define a_wkday f_wkday
|
||||
# define a_month f_month
|
||||
# define ampm ("AMPM" + 2 * (tp->tm_hour > 11))
|
||||
|
||||
size_t aw_len = 3;
|
||||
size_t am_len = 3;
|
||||
size_t ap_len = 2;
|
||||
|
||||
size_t wkday_len = strlen (f_wkday);
|
||||
size_t month_len = strlen (f_month);
|
||||
# endif
|
||||
#endif
|
||||
const char *zone;
|
||||
@@ -669,7 +663,7 @@ my_strftime (s, maxsize, format, tp)
|
||||
to_lowcase = 0;
|
||||
}
|
||||
#if defined _NL_CURRENT || !HAVE_STRFTIME
|
||||
cpy (wkday_len, f_wkday);
|
||||
cpy (strlen (f_wkday), f_wkday);
|
||||
break;
|
||||
#else
|
||||
goto underlying_strftime;
|
||||
@@ -695,7 +689,7 @@ my_strftime (s, maxsize, format, tp)
|
||||
to_lowcase = 0;
|
||||
}
|
||||
#if defined _NL_CURRENT || !HAVE_STRFTIME
|
||||
cpy (month_len, f_month);
|
||||
cpy (strlen (f_month), f_month);
|
||||
break;
|
||||
#else
|
||||
goto underlying_strftime;
|
||||
@@ -1227,7 +1221,7 @@ my_strftime (s, maxsize, format, tp)
|
||||
}
|
||||
}
|
||||
|
||||
if (p)
|
||||
if (p && i < maxsize)
|
||||
*p = '\0';
|
||||
return i;
|
||||
}
|
||||
|
Reference in New Issue
Block a user