2000-11-22  Paul Eggert  <eggert@twinsun.com>

	* time/strftime.c (my_strftime): Do not invoke mbrlen with a
	size of (size_t) -1; it's not portable.
This commit is contained in:
Ulrich Drepper 2000-11-28 21:12:43 +00:00
parent aea6353acf
commit bffef76ec2
3 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2000-11-22 Paul Eggert <eggert@twinsun.com>
* time/strftime.c (my_strftime): Do not invoke mbrlen with a
size of (size_t) -1; it's not portable.
2000-11-28 Ulrich Drepper <drepper@redhat.com>
* sysdeps/i386/fpu/libm-test-ulps: Adjust some values for the

View File

@ -1,5 +1,5 @@
/* BSD `setjmp' entry point to `sigsetjmp (..., 0)'. Stub version.
Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc.
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. Stub version.
Copyright (C) 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -20,7 +20,7 @@
#include <sysdep.h>
#include <setjmp.h>
#undef setjmp
#undef _setjmp
/* This implementation in C will not usually work, because the call
really needs to be a tail-call so __sigsetjmp saves the state of

View File

@ -513,6 +513,9 @@ my_strftime (s, maxsize, format, tp ut_argument)
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
@ -605,10 +608,15 @@ my_strftime (s, maxsize, format, tp ut_argument)
{
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;