Mercurial > hg > octave-kai > gnulib-hg
changeset 2993:9231fb44e77d
(my_strftime): Do not invoke mbrlen with a
size of (size_t) -1; it's not portable.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Thu, 23 Nov 2000 07:24:51 +0000 |
parents | 9f7a77b1a2f4 |
children | 606360269c23 |
files | lib/strftime.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/strftime.c +++ b/lib/strftime.c @@ -515,6 +515,9 @@ size_t i = 0; CHAR_T *p = s; const CHAR_T *f; +#if DO_MULTIBYTE && !defined COMPILE_WIDE + const char *format_end = NULL; +#endif zone = NULL; #if HAVE_TM_ZONE @@ -607,10 +610,15 @@ { mbstate_t mbstate = mbstate_zero; size_t len = 0; + size_t fsize; + + if (! format_end) + format_end = f + strlen (f) + 1; + fsize = format_end - f; do { - size_t bytes = mbrlen (f + len, (size_t) -1, &mbstate); + size_t bytes = mbrlen (f + len, fsize - len, &mbstate); if (bytes == 0) break;