summary refs log tree commit diff
path: root/debug/mbstowcs_chk.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-08-22 15:13:39 +0000
committerUlrich Drepper <drepper@redhat.com>2005-08-22 15:13:39 +0000
commitf9a906e786fbca1b0bdfe7d3842610ca87035958 (patch)
treea68c15c17410eaf300f0d841f89e16765c1af4ea /debug/mbstowcs_chk.c
parente2a99d8e1fb78ea428641ffa51ae68188cc77b6a (diff)
downloadglibc-f9a906e786fbca1b0bdfe7d3842610ca87035958.tar.gz
glibc-f9a906e786fbca1b0bdfe7d3842610ca87035958.tar.xz
glibc-f9a906e786fbca1b0bdfe7d3842610ca87035958.zip
* stdlib/bits/stdlib.h (mbstowcs): Divide __bos (__dst) by
	sizeof (wchar_t) rather than multiplying __len by sizeof (wchar_t).
	Pass __bos (__dst) / sizeof (wchar_t) to the *_chk routine.
	* wcsmbs/bits/wchar2.h (mbsrtowcs, mbsnrtowcs): Likewise.
	* debug/mbsnrtowcs_chk.c (__mbsnrtowcs_chk): Don't multiply
	len by sizeof (wchar_t).
	* debug/mbsrtowcs_chk.c (__mbsrtowcs_chk): Likewise.
	* debug/mbstowcs_chk.c (__mbstowcs_chk): Likewise.
	Fix type of SRC argument.  Pass &SRC rather than SRC to
	__mbsrtowcs.
	* debug/wcstombs_chk.c (__wcstombs_chk): Pass &SRC rather than SRC
	to __wcsrtombs.
	* debug/tst-chk1.c: Include assert.h.
	(do_test): Change enough array from VLA into a fixed size array.
	Assert that MB_CUR_MAX is <= sizeof (enough).  Use FAIL () macro
	instead of print error details.  Add several new tests.
	Kill some unused variable warnings.
Diffstat (limited to 'debug/mbstowcs_chk.c')
-rw-r--r--debug/mbstowcs_chk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/debug/mbstowcs_chk.c b/debug/mbstowcs_chk.c
index 2c1c3bb2c1..d1403c5d2b 100644
--- a/debug/mbstowcs_chk.c
+++ b/debug/mbstowcs_chk.c
@@ -22,14 +22,14 @@
 
 
 size_t
-__mbstowcs_chk (wchar_t *dst, const char **src, size_t len, size_t dstlen)
+__mbstowcs_chk (wchar_t *dst, const char *src, size_t len, size_t dstlen)
 {
-  if (__builtin_expect (dstlen < len * sizeof (wchar_t), 0))
+  if (__builtin_expect (dstlen < len, 0))
     __chk_fail ();
 
   mbstate_t state;
 
   memset (&state, '\0', sizeof state);
   /* Return how many we wrote (or maybe an error).  */
-  return __mbsrtowcs (dst, src, len, &state);
+  return __mbsrtowcs (dst, &src, len, &state);
 }