diff options
-rw-r--r-- | ChangeLog | 29 | ||||
-rwxr-xr-x | configure | 179 | ||||
-rw-r--r-- | elf/dl-support.c | 21 | ||||
-rw-r--r-- | iconv/gconv_simple.c | 9 | ||||
-rw-r--r-- | libio/fileops.c | 2 | ||||
-rw-r--r-- | stdio-common/vfprintf.c | 6 | ||||
-rw-r--r-- | stdlib/strtod.c | 8 | ||||
-rw-r--r-- | wcsmbs/btowc.c | 3 | ||||
-rw-r--r-- | wcsmbs/mbrtowc.c | 12 | ||||
-rw-r--r-- | wcsmbs/mbsnrtowcs.c | 12 | ||||
-rw-r--r-- | wcsmbs/mbsrtowcs.c | 12 | ||||
-rw-r--r-- | wcsmbs/wcrtomb.c | 11 | ||||
-rw-r--r-- | wcsmbs/wcsnrtombs.c | 14 | ||||
-rw-r--r-- | wcsmbs/wcsrtombs.c | 18 | ||||
-rw-r--r-- | wcsmbs/wctob.c | 5 |
15 files changed, 222 insertions, 119 deletions
@@ -1,3 +1,32 @@ +1998-04-07 20:32 Ulrich Drepper <drepper@cygnus.com> + + * wcsmbs/btowc.c: Fix dozends of bugs in untested code. + * wcsmbs/mbrtowc.c: Likewise. + * wcsmbs/mbsnrtowcs.c: Likewise. + * wcsmbs/mbsrtowcs.c: Likewise. + * wcsmbs/wcrtomb.c: Likewise. + * wcsmbs/wcsnrtombs.c: Likewise. + * wcsmbs/wcsrtombs.c: Likewise. + * wcsmbs/wctob.c: Likewise. + + * iconv/gconv-simple.c (__gconv_transform_ascii_ucs4): Compute + position of next output character correctly. + (__gconv_transform_ucs4_ascii): Count used input bytes correctly. + + * stdio-common/vfprintf.c (vfprintf): Clear state before used. + + * stdlib/strtod.c: Don't use mbtowc. + +1998-04-07 19:07 H.J. Lu <hjl@gnu.org> + + * libio/fileops.c (_IO_file_xsgetn): Call __underflow () when + what we want is smaller than a buffer. + +1998-04-07 18:14 Ulrich Drepper <drepper@cygnus.com> + + * elf/dl-support.c (_dl_important_hwcaps): Define dummy version of + this function. + 1998-04-07 Ulrich Drepper <drepper@cygnus.com> * configure.in: Recognize --with-headers flag and determine @@ -35,6 +35,10 @@ ac_help="$ac_help ac_help="$ac_help --without-cvs if CVS should not be used" ac_help="$ac_help + --with-headers=PATH location of system headers to use + [e.g. /usr/src/linux/include] + [default=compiler default]" +ac_help="$ac_help --enable-libio build in GNU libio instead of GNU stdio" ac_help="$ac_help --disable-sanity-checks really do not use threads (should not be used @@ -640,6 +644,15 @@ fi +# Check whether --with-headers or --without-headers was given. +if test "${with_headers+set}" = set; then + withval="$with_headers" + sysheaders=$withval +else + sysheaders='' +fi + + # Check whether --enable-libio or --disable-libio was given. if test "${enable_libio+set}" = set; then enableval="$enable_libio" @@ -783,7 +796,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:787: checking host system type" >&5 +echo "configure:800: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -906,7 +919,7 @@ fi # This can take a while to compute. sysdep_dir=$srcdir/sysdeps echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6 -echo "configure:910: checking sysdep dirs" >&5 +echo "configure:923: checking sysdep dirs" >&5 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1. os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`" @@ -1111,7 +1124,7 @@ echo "$ac_t""sysdeps/generic" 1>&6 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1115: checking for a BSD compatible install" >&5 +echo "configure:1128: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1165,7 +1178,7 @@ if test "$INSTALL" = "${srcdir}/install-sh -c"; then INSTALL='\$(..)./install-sh -c' fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1169: checking whether ln -s works" >&5 +echo "configure:1182: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1188,7 +1201,7 @@ fi # These programs are version sensitive. echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1192: checking build system type" >&5 +echo "configure:1205: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1216,7 +1229,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1220: checking for $ac_word" >&5 +echo "configure:1233: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1249,7 +1262,7 @@ if test -z "$CC"; then else # Found it, now check the version. echo $ac_n "checking version of $CC""... $ac_c" 1>&6 -echo "configure:1253: checking version of $CC" >&5 +echo "configure:1266: checking version of $CC" >&5 ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcst0-9.-]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1269,7 +1282,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1273: checking for $ac_word" >&5 +echo "configure:1286: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1302,7 +1315,7 @@ if test -z "$MAKE"; then else # Found it, now check the version. echo $ac_n "checking version of $MAKE""... $ac_c" 1>&6 -echo "configure:1306: checking version of $MAKE" >&5 +echo "configure:1319: checking version of $MAKE" >&5 ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*version \([0-9][0-9.]*\), by.*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1323,7 +1336,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1327: checking for $ac_word" >&5 +echo "configure:1340: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1356,7 +1369,7 @@ if test -z "$MSGFMT"; then else # Found it, now check the version. echo $ac_n "checking version of $MSGFMT""... $ac_c" 1>&6 -echo "configure:1360: checking version of $MSGFMT" >&5 +echo "configure:1373: checking version of $MSGFMT" >&5 ac_prog_version=`$MSGFMT --version 2>&1 | sed -n 's/^.*GNU gettext.*\([0-9][0-9]*\.[0-9]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1376,7 +1389,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1380: checking for $ac_word" >&5 +echo "configure:1393: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1409,7 +1422,7 @@ if test -z "$MAKEINFO"; then else # Found it, now check the version. echo $ac_n "checking version of $MAKEINFO""... $ac_c" 1>&6 -echo "configure:1413: checking version of $MAKEINFO" >&5 +echo "configure:1426: checking version of $MAKEINFO" >&5 ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo \([0-9][0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -1438,7 +1451,7 @@ test -n "$aux_missing" && echo "configure: warning: echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1442: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1455: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1451,11 +1464,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 1455 "configure" +#line 1468 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1480,7 +1493,7 @@ else cross_linkable=yes fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1484: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1497: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_cross'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1492,7 +1505,7 @@ echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1496: checking whether we are using GNU C" >&5 +echo "configure:1509: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1501,7 +1514,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1505: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1514,7 +1527,7 @@ if test $ac_cv_prog_gcc != yes; then fi echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1518: checking build system type" >&5 +echo "configure:1531: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1537,7 +1550,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1541: checking for $ac_word" >&5 +echo "configure:1554: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1568,7 +1581,7 @@ done fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1572: checking how to run the C preprocessor" >&5 +echo "configure:1585: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1583,13 +1596,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1587 "configure" +#line 1600 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1600,13 +1613,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1604 "configure" +#line 1617 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1639,7 +1652,7 @@ LD=`$CC -print-prog-name=ld` # Determine whether we are using GNU binutils. echo $ac_n "checking whether $AS is GNU as""... $ac_c" 1>&6 -echo "configure:1643: checking whether $AS is GNU as" >&5 +echo "configure:1656: checking whether $AS is GNU as" >&5 if eval "test \"`echo '$''{'libc_cv_prog_as_gnu'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1657,7 +1670,7 @@ rm -f a.out gnu_as=$libc_cv_prog_as_gnu echo $ac_n "checking whether $LD is GNU ld""... $ac_c" 1>&6 -echo "configure:1661: checking whether $LD is GNU ld" >&5 +echo "configure:1674: checking whether $LD is GNU ld" >&5 if eval "test \"`echo '$''{'libc_cv_prog_ld_gnu'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1676,7 +1689,7 @@ gnu_ld=$libc_cv_prog_ld_gnu # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1680: checking for $ac_word" >&5 +echo "configure:1693: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1707,7 +1720,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1711: checking for $ac_word" >&5 +echo "configure:1724: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1738,7 +1751,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1742: checking for $ac_word" >&5 +echo "configure:1755: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1772,7 +1785,7 @@ fi # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args. set dummy ${ac_tool_prefix}mig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1776: checking for $ac_word" >&5 +echo "configure:1789: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1801,9 +1814,18 @@ fi +# if using special system headers, find out the compiler's sekrit +# header directory and add that to the list. NOTE: Only does the right +# thing on a system that doesn't need fixincludes. (Not presently a problem.) +if test -n "$sysheaders"; then + ccheaders=`$CC -print-file-name=include` + SYSINCLUDES="-nostdinc -isystem $ccheaders -isystem $sysheaders" +fi + + # check if ar takes S echo $ac_n "checking for ar S""... $ac_c" 1>&6 -echo "configure:1807: checking for ar S" >&5 +echo "configure:1829: checking for ar S" >&5 if eval "test \"`echo '$''{'libc_cv_ar_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1811,7 +1833,7 @@ else tmplib=lib$$.a rm -f $tmpo $tmplib touch $tmpo -if { ac_try='${AR-ar} rcuS $tmplib $tmpo > /dev/null 2>&1'; { (eval echo configure:1815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then +if { ac_try='${AR-ar} rcuS $tmplib $tmpo > /dev/null 2>&1'; { (eval echo configure:1837: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_ar_S=yes else libc_cv_ar_S=no @@ -1829,7 +1851,7 @@ echo "$ac_t""$libc_cv_ar_S" 1>&6 # - two terminals occur directly after each other # - the path contains an element with a dot in it echo $ac_n "checking LD_LIBRARY_PATH variable""... $ac_c" 1>&6 -echo "configure:1833: checking LD_LIBRARY_PATH variable" >&5 +echo "configure:1855: checking LD_LIBRARY_PATH variable" >&5 case ${LD_LIBRARY_PATH} in [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) ld_library_path_setting="contains current directory" @@ -1849,7 +1871,7 @@ fi # Extract the first word of "bash", so it can be a program name with args. set dummy bash; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1853: checking for $ac_word" >&5 +echo "configure:1875: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1891,7 +1913,7 @@ if test "$BASH" = no; then # Extract the first word of "ksh", so it can be a program name with args. set dummy ksh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1895: checking for $ac_word" >&5 +echo "configure:1917: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1937,7 +1959,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1941: checking for $ac_word" >&5 +echo "configure:1963: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1972,7 +1994,7 @@ test -n "$PERL" || PERL="no" echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6 -echo "configure:1976: checking for signed size_t type" >&5 +echo "configure:1998: checking for signed size_t type" >&5 if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1996,12 +2018,12 @@ EOF fi echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6 -echo "configure:2000: checking for libc-friendly stddef.h" >&5 +echo "configure:2022: checking for libc-friendly stddef.h" >&5 if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2005 "configure" +#line 2027 "configure" #include "confdefs.h" #define __need_size_t #define __need_wchar_t @@ -2016,7 +2038,7 @@ size_t size; wchar_t wchar; if (&size == NULL || &wchar == NULL) abort (); ; return 0; } EOF -if { (eval echo configure:2020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_friendly_stddef=yes else @@ -2035,7 +2057,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly." fi echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6 -echo "configure:2039: checking whether we need to use -P to assemble .S files" >&5 +echo "configure:2061: checking whether we need to use -P to assemble .S files" >&5 if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2058,7 +2080,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives." fi echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6 -echo "configure:2062: checking for assembler global-symbol directive" >&5 +echo "configure:2084: checking for assembler global-symbol directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2088,7 +2110,7 @@ EOF fi echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6 -echo "configure:2092: checking for .set assembler directive" >&5 +echo "configure:2114: checking for .set assembler directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2122,7 +2144,7 @@ EOF fi echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6 -echo "configure:2126: checking for .symver assembler directive" >&5 +echo "configure:2148: checking for .symver assembler directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2141,7 +2163,7 @@ fi echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6 echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6 -echo "configure:2145: checking for ld --version-script" >&5 +echo "configure:2167: checking for ld --version-script" >&5 if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2164,7 +2186,7 @@ EOF if { ac_try='${CC-cc} $CFLAGS -shared -o conftest.so conftest.o -nostartfiles -nostdlib -Wl,--version-script,conftest.map - 1>&5'; { (eval echo configure:2168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; + 1>&5'; { (eval echo configure:2190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_ld_version_script_option=yes else @@ -2202,7 +2224,7 @@ if test $VERSIONING = no; then fi if test $elf = yes; then echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6 -echo "configure:2206: checking for .previous assembler directive" >&5 +echo "configure:2228: checking for .previous assembler directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2210,7 +2232,7 @@ else .section foo_section .previous EOF - if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_previous_directive=yes else libc_cv_asm_previous_directive=no @@ -2226,7 +2248,7 @@ EOF else echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6 -echo "configure:2230: checking for .popsection assembler directive" >&5 +echo "configure:2252: checking for .popsection assembler directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2234,7 +2256,7 @@ else .pushsection foo_section .popsection EOF - if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2238: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_asm_popsection_directive=yes else libc_cv_asm_popsection_directive=no @@ -2254,12 +2276,12 @@ fi if test $elf != yes; then echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6 -echo "configure:2258: checking for .init and .fini sections" >&5 +echo "configure:2280: checking for .init and .fini sections" >&5 if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2263 "configure" +#line 2285 "configure" #include "confdefs.h" int main() { @@ -2268,7 +2290,7 @@ asm (".section .init"); asm (".text"); ; return 0; } EOF -if { (eval echo configure:2272: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_have_initfini=yes else @@ -2296,19 +2318,19 @@ if test $elf = yes; then else if test $ac_cv_prog_cc_works = yes; then echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6 -echo "configure:2300: checking for _ prefix on C symbol names" >&5 +echo "configure:2322: checking for _ prefix on C symbol names" >&5 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2305 "configure" +#line 2327 "configure" #include "confdefs.h" asm ("_glibc_foobar:"); int main() { glibc_foobar (); ; return 0; } EOF -if { (eval echo configure:2312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* libc_cv_asm_underscores=yes else @@ -2323,17 +2345,17 @@ fi echo "$ac_t""$libc_cv_asm_underscores" 1>&6 else echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6 -echo "configure:2327: checking for _ prefix on C symbol names" >&5 +echo "configure:2349: checking for _ prefix on C symbol names" >&5 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2332 "configure" +#line 2354 "configure" #include "confdefs.h" void underscore_test(void) { return; } EOF -if { (eval echo configure:2337: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2359: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if grep _underscore_test conftest* >/dev/null; then rm -f conftest* libc_cv_asm_underscores=yes @@ -2365,7 +2387,7 @@ if test $elf = yes; then fi echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6 -echo "configure:2369: checking for assembler .weak directive" >&5 +echo "configure:2391: checking for assembler .weak directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2388,7 +2410,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6 if test $libc_cv_asm_weak_directive = no; then echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6 -echo "configure:2392: checking for assembler .weakext directive" >&5 +echo "configure:2414: checking for assembler .weakext directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2426,7 +2448,7 @@ EOF fi echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6 -echo "configure:2430: checking for ld --no-whole-archive" >&5 +echo "configure:2452: checking for ld --no-whole-archive" >&5 if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2437,7 +2459,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -Wl,--no-whole-archive - -o conftest conftest.c 1>&5'; { (eval echo configure:2441: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:2463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_ld_no_whole_archive=yes else libc_cv_ld_no_whole_archive=no @@ -2448,7 +2470,7 @@ fi echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6 echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6 -echo "configure:2452: checking for gcc -fno-exceptions" >&5 +echo "configure:2474: checking for gcc -fno-exceptions" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2459,7 +2481,7 @@ __throw () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -fno-exceptions - -o conftest conftest.c 1>&5'; { (eval echo configure:2463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c 1>&5'; { (eval echo configure:2485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_no_exceptions=yes else libc_cv_gcc_no_exceptions=no @@ -2471,14 +2493,14 @@ echo "$ac_t""$libc_cv_gcc_no_exceptions" 1>&6 if test "$base_machine" = alpha ; then echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6 -echo "configure:2475: checking for function ..ng prefix" >&5 +echo "configure:2497: checking for function ..ng prefix" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_alpha_ng_prefix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF foo () { } EOF -if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; +if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2504: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_alpha_ng_prefix=yes else @@ -2502,12 +2524,12 @@ fi fi echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6 -echo "configure:2506: checking for DWARF2 unwind info support" >&5 +echo "configure:2528: checking for DWARF2 unwind info support" >&5 if eval "test \"`echo '$''{'libc_cv_gcc_dwarf2_unwind_info'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<EOF -#line 2511 "configure" +#line 2533 "configure" static char __EH_FRAME_BEGIN__; _start () { @@ -2534,7 +2556,7 @@ __bzero () {} EOF if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2560: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_dwarf2_unwind_info=static else libc_cv_gcc_dwarf2_unwind_info=no @@ -2542,7 +2564,7 @@ fi if test $libc_cv_gcc_dwarf2_unwind_info = no; then if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame -nostdlib -nostartfiles - -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2546: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_gcc_dwarf2_unwind_info=yes else libc_cv_gcc_dwarf2_unwind_info=no @@ -2616,7 +2638,7 @@ if test "$uname" = "sysdeps/generic"; then fi echo $ac_n "checking OS release for uname""... $ac_c" 1>&6 -echo "configure:2620: checking OS release for uname" >&5 +echo "configure:2642: checking OS release for uname" >&5 if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2638,7 +2660,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6 uname_release="$libc_cv_uname_release" echo $ac_n "checking OS version for uname""... $ac_c" 1>&6 -echo "configure:2642: checking OS version for uname" >&5 +echo "configure:2664: checking OS version for uname" >&5 if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2660,7 +2682,7 @@ else fi echo $ac_n "checking stdio selection""... $ac_c" 1>&6 -echo "configure:2664: checking stdio selection" >&5 +echo "configure:2686: checking stdio selection" >&5 case $stdio in libio) cat >> confdefs.h <<\EOF @@ -2672,7 +2694,7 @@ esac echo "$ac_t""$stdio" 1>&6 echo $ac_n "checking ldap selection""... $ac_c" 1>&6 -echo "configure:2676: checking ldap selection" >&5 +echo "configure:2698: checking ldap selection" >&5 case $add_ons in *ldap*) @@ -2735,7 +2757,7 @@ if test $static = no && test $shared = yes; then fi echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6 -echo "configure:2739: checking whether -fPIC is default" >&5 +echo "configure:2761: checking whether -fPIC is default" >&5 if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2930,6 +2952,7 @@ s%@CPP@%$CPP%g s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g s%@MIG@%$MIG%g +s%@SYSINCLUDES@%$SYSINCLUDES%g s%@libc_cv_ar_S@%$libc_cv_ar_S%g s%@BASH@%$BASH%g s%@libc_cv_have_bash2@%$libc_cv_have_bash2%g diff --git a/elf/dl-support.c b/elf/dl-support.c index 36932bb..2702404 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -20,6 +20,7 @@ /* This file defines some things that for the dynamic linker are defined in rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */ +#include <errno.h> #include <stdlib.h> #include <unistd.h> #include <elf/ldsodefs.h> @@ -35,6 +36,7 @@ const char *_dl_rpath = DEFAULT_RPATH; /* Name of the architecture. */ const char *_dl_platform; size_t _dl_platformlen; + int _dl_debug_libs; int _dl_debug_impcalls; int _dl_debug_bindings; @@ -76,3 +78,22 @@ non_dynamic_init (void) _dl_platformlen = strlen (_dl_platform); } text_set_element (__libc_subinit, non_dynamic_init); + +const struct r_strlenpair * +internal_function +_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, + size_t *max_capstrlen) +{ + struct r_strlenpair *result; + + /* XXX We don't try to find the capabilities in this case. */ + result = (struct r_strlenpair *) malloc (sizeof (*result)); + if (result == NULL) + _dl_signal_error (ENOMEM, NULL, "cannot create capability list"); + + result[0].str = (char *) result; /* Does not really matter. */ + result[0].len = 0; + + *sz = 1; + return result; +} diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c index 478c0dc..6fe98a9 100644 --- a/iconv/gconv_simple.c +++ b/iconv/gconv_simple.c @@ -134,8 +134,9 @@ __gconv_transform_ascii_ucs4 (struct gconv_step *step, } /* It's an one byte sequence. */ - *(wchar_t *) &data->outbuf[data->outbufavail++] + *(wchar_t *) &data->outbuf[data->outbufavail] = (wchar_t) *newinbuf; + data->outbufavail += sizeof (wchar_t); ++actually; ++newinbuf; @@ -252,12 +253,12 @@ __gconv_transform_ucs4_ascii (struct gconv_step *step, ++actually; ++newinbuf; - ++cnt; + cnt += sizeof (wchar_t); } /* Remember how much we converted. */ - do_write += cnt; - *inlen -= cnt * sizeof (wchar_t); + do_write += cnt / sizeof (wchar_t); + *inlen -= cnt; /* Check whether an illegal character appeared. */ if (result != GCONV_OK) diff --git a/libio/fileops.c b/libio/fileops.c index 15e30a4..0a6d009 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -816,7 +816,7 @@ _IO_file_xsgetn (fp, data, n) /* If we now want less than a buffer, underflow and repeat the copy. Otherwise, _IO_SYSREAD directly to the user buffer. */ - if (fp->_IO_buf_base && want <= fp->_IO_buf_end - fp->_IO_buf_base) + if (fp->_IO_buf_base && want < fp->_IO_buf_end - fp->_IO_buf_base) { if (__underflow (fp) == EOF) break; diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index e6c2df2..e13785f 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -826,6 +826,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) mbstate_t mbstate; \ size_t len; \ \ + memset (&mbstate, '\0', sizeof (mbstate_t)); \ len = __wcrtomb (buf, (fspec == NULL ? va_arg (ap, wint_t) \ : args_value[fspec->data_arg].pa_wchar), \ &mbstate); \ @@ -880,6 +881,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) const wchar_t *s2 = (const wchar_t *) string; \ mbstate_t mbstate; \ \ + memset (&mbstate, '\0', sizeof (mbstate_t)); \ len = __wcsrtombs (NULL, &s2, 0, &mbstate); \ if (len == (size_t) -1) \ /* Illegal wide-character string. */ \ @@ -887,6 +889,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) \ s2 = (const wchar_t *) string; \ string = alloca (len + 1); \ + memset (&mbstate, '\0', sizeof (mbstate_t)); \ (void) __wcsrtombs (string, &s2, prec != -1 ? prec : UINT_MAX, \ &mbstate); \ } \ @@ -993,6 +996,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) #endif nspecs_done = 0; + /* Put state for processing format string in initial state. */ + memset (&mbstate, '\0', sizeof (mbstate_t)); + /* Find the first format specifier. */ f = lead_str_end = find_spec (format, &mbstate); diff --git a/stdlib/strtod.c b/stdlib/strtod.c index a06239d..226b16f 100644 --- a/stdlib/strtod.c +++ b/stdlib/strtod.c @@ -459,11 +459,9 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM) else { /* Figure out the thousands separator character. */ -#if defined _LIBC || defined _HAVE_BTOWC thousands = btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); if (thousands == WEOF) thousands = L'\0'; -#endif if (thousands == L'\0') grouping = NULL; } @@ -472,9 +470,9 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM) grouping = NULL; /* Find the locale's decimal point character. */ - if (mbtowc ((wchar_t *) &decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT), - strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0) - decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT); + decimal = btowc (*_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT)); + if (decimal == WEOF) + decimal = L'.'; assert (decimal != L'\0'); /* Prepare number representation. */ diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c index 268b1f2..b627324 100644 --- a/wcsmbs/btowc.c +++ b/wcsmbs/btowc.c @@ -61,7 +61,8 @@ btowc (c) &data, inbuf, &inbytes, &converted, 0); /* The conversion failed. */ - if (status != GCONV_OK && status != GCONV_FULL_OUTPUT) + if (status != GCONV_OK && status != GCONV_FULL_OUTPUT + && status != GCONV_EMPTY_INPUT) return WEOF; return *(wchar_t *)buf; diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c index 99bc5a4..5a52b1d 100644 --- a/wcsmbs/mbrtowc.c +++ b/wcsmbs/mbrtowc.c @@ -28,7 +28,6 @@ # define EILSEQ EINVAL #endif - /* This is the private state used if PS is NULL. */ static mbstate_t state; @@ -69,12 +68,15 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) characters. The output buffer must be large enough, otherwise the definition of MB_CUR_MAX is not correct. All the other possible errors also must not happen. */ - assert (status == GCONV_OK || status == GCONV_ILLEGAL_INPUT - || status == GCONV_INCOMPLETE_INPUT); + assert (status == GCONV_OK || status == GCONV_EMPTY_INPUT + || status == GCONV_ILLEGAL_INPUT + || status == GCONV_INCOMPLETE_INPUT + || status == GCONV_FULL_OUTPUT); - if (status == GCONV_OK) + if (status == GCONV_OK || status == GCONV_EMPTY_INPUT + || status == GCONV_FULL_OUTPUT) { - if (*(wchar_t *)data.outbuf == L'\0') + if (data.outbufavail > 0 && *(wchar_t *)data.outbuf == L'\0') { /* The converted character is the NUL character. */ assert (mbsinit (data.statep)); diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c index ded15e4..9787e97 100644 --- a/wcsmbs/mbsnrtowcs.c +++ b/wcsmbs/mbsnrtowcs.c @@ -84,7 +84,8 @@ __mbsnrtowcs (dst, src, nmc, len, ps) } while (status == GCONV_FULL_OUTPUT); - if (status == GCONV_OK && ((wchar_t *) dst)[written - 1] == L'\0') + if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT) + && buf[written - 1] == L'\0') /* Don't count the NUL character in. */ --result; } @@ -105,7 +106,8 @@ __mbsnrtowcs (dst, src, nmc, len, ps) /* We have to determine whether the last character converted is the NUL character. */ - if (status == GCONV_OK && ((wchar_t *) dst)[result - 1] == L'\0') + if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT) + && ((wchar_t *) dst)[result - 1] == L'\0') { assert (result > 0); assert (mbsinit (data.statep)); @@ -118,10 +120,12 @@ __mbsnrtowcs (dst, src, nmc, len, ps) /* There must not be any problems with the conversion but illegal input characters. */ - assert (status == GCONV_OK || status == GCONV_ILLEGAL_INPUT + assert (status == GCONV_OK || status != GCONV_EMPTY_INPUT + || status == GCONV_ILLEGAL_INPUT || status == GCONV_INCOMPLETE_INPUT || status == GCONV_FULL_OUTPUT); - if (status != GCONV_OK && status != GCONV_FULL_OUTPUT) + if (status != GCONV_OK && status != GCONV_FULL_OUTPUT + && status != GCONV_EMPTY_INPUT) { result = (size_t) -1; __set_errno (EILSEQ); diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c index d0af40f..0b5af9b 100644 --- a/wcsmbs/mbsrtowcs.c +++ b/wcsmbs/mbsrtowcs.c @@ -76,7 +76,8 @@ __mbsrtowcs (dst, src, len, ps) } while (status == GCONV_FULL_OUTPUT); - if (status == GCONV_OK && ((wchar_t *) dst)[written - 1] == L'\0') + if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT) + && buf[written - 1] == L'\0') /* Don't count the NUL character in. */ --result; } @@ -98,7 +99,8 @@ __mbsrtowcs (dst, src, len, ps) /* We have to determine whether the last character converted is the NUL character. */ - if (status == GCONV_OK && ((wchar_t *) dst)[result - 1] == L'\0') + if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT) + && ((wchar_t *) dst)[result - 1] == L'\0') { assert (result > 0); assert (mbsinit (data.statep)); @@ -111,10 +113,12 @@ __mbsrtowcs (dst, src, len, ps) /* There must not be any problems with the conversion but illegal input characters. */ - assert (status == GCONV_OK || status == GCONV_ILLEGAL_INPUT + assert (status == GCONV_OK || status == GCONV_EMPTY_INPUT + || status == GCONV_ILLEGAL_INPUT || status == GCONV_INCOMPLETE_INPUT || status == GCONV_FULL_OUTPUT); - if (status != GCONV_OK && status != GCONV_FULL_OUTPUT) + if (status != GCONV_OK && status != GCONV_FULL_OUTPUT + && status != GCONV_EMPTY_INPUT) { result = (size_t) -1; __set_errno (EILSEQ); diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c index d45ae44..dcc2ef6 100644 --- a/wcsmbs/wcrtomb.c +++ b/wcsmbs/wcrtomb.c @@ -70,7 +70,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps) &data, NULL, &inbytes, NULL, 1); - if (status == GCONV_OK) + if (status == GCONV_OK || status == GCONV_EMPTY_INPUT) data.outbuf[data.outbufavail++] = '\0'; } else @@ -87,10 +87,13 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps) characters. The output buffer must be large enough, otherwise the definition of MB_CUR_MAX is not correct. All the other possible errors also must not happen. */ - assert (status == GCONV_OK || status == GCONV_ILLEGAL_INPUT - || status == GCONV_INCOMPLETE_INPUT); + assert (status == GCONV_OK || status == GCONV_EMPTY_INPUT + || status == GCONV_ILLEGAL_INPUT + || status == GCONV_INCOMPLETE_INPUT + || status == GCONV_FULL_OUTPUT); - if (status == GCONV_OK) + if (status == GCONV_OK || status == GCONV_EMPTY_INPUT + || status == GCONV_FULL_OUTPUT) result = data.outbufavail; else { diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c index 2dd9f7c..02770ce 100644 --- a/wcsmbs/wcsnrtombs.c +++ b/wcsmbs/wcsnrtombs.c @@ -54,7 +54,7 @@ __wcsnrtombs (dst, src, nwc, len, ps) if (nwc == 0) return 0; - inbytes_in = __wcsnlen (*src, nwc - 1) + 1; + inbytes_in = (__wcsnlen (*src, nwc - 1) + 1) * sizeof (wchar_t); /* Make sure we use the correct function. */ update_conversion_ptrs (); @@ -85,7 +85,8 @@ __wcsnrtombs (dst, src, nwc, len, ps) } while (status == GCONV_FULL_OUTPUT); - if (status == GCONV_OK && dst[data.outbufavail - 1] == '\0') + if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT) + && buf[data.outbufavail - 1] == '\0') /* Don't count the NUL character in. */ --result; } @@ -106,7 +107,8 @@ __wcsnrtombs (dst, src, nwc, len, ps) /* We have to determine whether the last character converted is the NUL character. */ - if (status == GCONV_OK && dst[data.outbufavail - 1] == '\0') + if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT) + && dst[data.outbufavail - 1] == '\0') { assert (data.outbufavail > 0); assert (mbsinit (data.statep)); @@ -119,10 +121,12 @@ __wcsnrtombs (dst, src, nwc, len, ps) /* There must not be any problems with the conversion but illegal input characters. */ - assert (status == GCONV_OK || status == GCONV_ILLEGAL_INPUT + assert (status == GCONV_OK || status == GCONV_EMPTY_INPUT + || status == GCONV_ILLEGAL_INPUT || status == GCONV_INCOMPLETE_INPUT || status == GCONV_FULL_OUTPUT); - if (status != GCONV_OK && status != GCONV_FULL_OUTPUT) + if (status != GCONV_OK && status != GCONV_FULL_OUTPUT + && status != GCONV_EMPTY_INPUT) { result = (size_t) -1; __set_errno (EILSEQ); diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c index 35bb58e..904a003 100644 --- a/wcsmbs/wcsrtombs.c +++ b/wcsmbs/wcsrtombs.c @@ -55,7 +55,7 @@ __wcsrtombs (dst, src, len, ps) if (dst == NULL) { char buf[256]; /* Just an arbitrary value. */ - size_t inbytes_in = __wcslen (*src) + 1; + size_t inbytes_in = (__wcslen (*src) + 1) * sizeof (wchar_t); size_t inbytes = inbytes_in; const wchar_t *inbuf = *src; size_t written; @@ -78,7 +78,8 @@ __wcsrtombs (dst, src, len, ps) } while (status == GCONV_FULL_OUTPUT); - if (status == GCONV_OK && dst[data.outbufavail - 1] == '\0') + if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT) + && buf[data.outbufavail - 1] == '\0') /* Don't count the NUL character in. */ --result; } @@ -87,7 +88,8 @@ __wcsrtombs (dst, src, len, ps) /* This code is based on the safe assumption that all internal multi-byte encodings use the NUL byte only to mark the end of the string. */ - size_t inbytes_in = __wcsnlen (*src, len * MB_CUR_MAX) + 1; + size_t inbytes_in = ((__wcsnlen (*src, len * MB_CUR_MAX) + 1) + * sizeof (wchar_t)); size_t inbytes = inbytes_in; data.outbuf = dst; @@ -100,7 +102,9 @@ __wcsrtombs (dst, src, len, ps) /* We have to determine whether the last character converted is the NUL character. */ - if (status == GCONV_OK && dst[data.outbufavail - 1] == '\0') + if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT + || status == GCONV_FULL_OUTPUT) + && dst[data.outbufavail - 1] == '\0') { assert (data.outbufavail > 0); assert (mbsinit (data.statep)); @@ -113,10 +117,12 @@ __wcsrtombs (dst, src, len, ps) /* There must not be any problems with the conversion but illegal input characters. */ - assert (status == GCONV_OK || status == GCONV_ILLEGAL_INPUT + assert (status == GCONV_OK || status == GCONV_EMPTY_INPUT + || status == GCONV_ILLEGAL_INPUT || status == GCONV_INCOMPLETE_INPUT || status == GCONV_FULL_OUTPUT); - if (status != GCONV_OK && status != GCONV_FULL_OUTPUT) + if (status != GCONV_OK && status != GCONV_FULL_OUTPUT + && status != GCONV_EMPTY_INPUT) { result = (size_t) -1; __set_errno (EILSEQ); diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c index 0461877..e70b4e7 100644 --- a/wcsmbs/wctob.c +++ b/wcsmbs/wctob.c @@ -56,9 +56,10 @@ wctob (c) (const char *) inbuf, &inbytes, &converted, 0); /* The conversion failed or the output is too long. */ - if (status != GCONV_OK && status != GCONV_FULL_OUTPUT + if ((status != GCONV_OK && status != GCONV_FULL_OUTPUT + && status != GCONV_EMPTY_INPUT) || data.outbufavail != 1) - return WEOF; + return EOF; return buf[0]; } |