aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdio/swprintf.c
AgeCommit message (Collapse)AuthorFilesLines
2023-11-20stdio: Fix bugs in commit 3d94e07c49b5Takashi Yano1-0/+2
The commit 3d94e07c49b5 has a few bugs which cause testsuite failure in libstdc++. This is due to excess orientation check in __srefill_r() and _ungetc_r(). Further, sscanf() family also calls ssvfscanf() family with fp->_file == -1. This causes undesired orientation set/check for sscanf() family. This patch fixes these problems. Also, as in GLibC, do not set orientation in ungetc, and only set, but do not check orientation in ungetwc. Fixes: 3d94e07c49b5 ("newlib: libc: Fix crash on fprintf to a wide-oriented stream.") Reported-by: Christophe Lyon <christophe.lyon@linaro.org> Reported-by: Joel Sherrill <joel@rtems.org> Co-developed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-13Add _REENT_ERRNO(ptr)Matt Joyce1-4/+4
Add a _REENT_ERRNO() macro to encapsulate the access to the _errno member of struct reent. This will help to replace the structure member with a thread-local storage object in a follow up patch. Replace uses of __errno_r() with _REENT_ERRNO(). Keep __errno_r() macro for potential users outside of Newlib.
2020-01-29Use remove-advertising-clause script to edit BSD licensesKeith Packard1-1/+1
This edits licenses held by Berkeley and NetBSD, both of which have removed the advertising requirement from their licenses. Signed-off-by: Keith Packard <keithp@keithp.com>
2018-01-17ansification: remove _DEFUNYaakov Selkowitz1-4/+2
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _DOTSYaakov Selkowitz1-2/+2
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _CONSTYaakov Selkowitz1-2/+2
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _ANDYaakov Selkowitz1-5/+5
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-12-01stdio: remove TRAD_SYNOPSISYaakov Selkowitz1-1/+1
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2015-11-19Simplify the markup for sprintf and swprintf documentationJon Turney1-32/+36
- move the description of the alternative form produced with the # flag from a nested table to an additional table 2015-11-12 Jon Turney <jon.turney@dronecode.org.uk> * libc/stdio/sprintf.c: Simplify documentation markup. * libc/stdio/swprintf.c: Ditto. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2013-11-262013-11-26 Julio Gutierrez <jgutleyva@gmail.com>Joel Sherrill1-7/+8
*libc/include/wchar.h: Add restrict keyword. *libc/stdio/fgetws.c (fgetws): ditto. *libc/stdio/fputws.c (fputws): ditto. *libc/stdio/fwprintf.c (fwprintf): ditto. *libc/stdio/fwscanf.c (fwscanf): ditto. *libc/stdio/swprintf.c (swprintf): ditto. *libc/stdio/swscanf.c (swscanf): ditto. *libc/stdio/vfwprintf.c (vfwprintf): ditto. *libc/stdio/vfwscanf.c (vfwscanf): ditto. *libc/stdio/vswprintf.c (vswprintf): ditto. *libc/stdio/vswscanf.c (vswscanf): ditto. *libc/stdio/vwprintf.c (vwprintf): ditto. *libc/stdio/vwscanf.c (vwscanf): ditto. *libc/stdio/wprintf.c (wprintf): ditto. *libc/stdio/wscanf.c (wscanf): ditto. *libc/stdlib/mbrlen.c (mbrlen): ditto. *libc/stdlib/mbrtowc.c (mbrtowc): ditto. *libc/stdlib/mbsnrtowcs.c (mbsnrtowcs): ditto. *libc/stdlib/mbsrtowcs.c (mbsrtowcs): ditto. *libc/stdlib/wcrtomb.c (wcrtomb): ditto. *libc/stdlib/wcsnrtombs.c (wcsnrtombs): ditto. *libc/stdlib/wcsrtombs.c (wcsrtombs): ditto. *libc/stdlib/wcstod.c (wcstod): ditto. *libc/stdlib/wcstol.c (wcstol): ditto. *libc/stdlib/wcstold.c (wcstold): ditto. *libc/stdlib/wcstoll.c (wcstoll): ditto. *libc/stdlib/wcstoul.c (wcstoul): ditto. *libc/stdlib/wcstoull.c (cstoull): ditto. *libc/string/wcpcpy.c (wcpcpy): ditto. *libc/string/wcpncpy.c (wcpncpy): ditto. *libc/string/wcscat.c (wcscat): ditto. *libc/string/wcscpy.c (wcscpy): ditto. *libc/string/wcsncat.c (wcsncat): ditto. *libc/string/wcsncpy.c (wcsncpy): ditto. *libc/string/wcsstr.c (wcsstr): ditto. *libc/string/wcstok.c (wcstok): ditto. *libc/string/wcsxfrm.c (wcsxfrm): ditto. *libc/string/wmemcpy.c (wmemcpy): ditto.
2012-01-13 * libc/stdio/sprintf.c: Document 'm' conversion specifier.Yaakov Selkowitz1-0/+4
* libc/stdio/swprintf.c: Ditto. * libc/stdio/vfprintf.c (_VFPRINTF_R) [_GLIBC_EXTENSION]: Handle 'm' conversion specifier. * libc/stdio/vfwprintf.c (_VFWPRINTF_R) [_GLIBC_EXTENSION]: Ditto.
2009-03-12 * libc/stdio/swprintf.c (_swprintf_r, swprintf):Corinna Vinschen1-44/+78
correct how terminating L'\0' is added; change return to match standard for when output does not fit; some corrections and enhancements to the docs. * libc/stdio/vswprintf.c (_vswprintf_r): ditto, except for docs. * libc/stdio/vfwprintf.c: some corrections to the docs and some enhancements to comments. (No code changes.) * libc/time/strftime.c: Correct some problems that made wcsftime() not work correctly: work properly with swprintf returns that are different from snprintf returns, correct test vector lengths for when sizeof(wchar_t) > 1. * libc/stdio/sprintf.c: Some documentation and comment corrections and enhancements to match those done to swprintf.c.
2009-03-06 * libc/include/stdio.h (__VALIST): Guard against multiple definition.Corinna Vinschen1-0/+592
* libc/include/wchar.h: Include stdarg.h. (__VALIST): Define conditionally. (fwprintf, swprintf, vfwprintf, vswprintf, vwprintf, wprintf: Declare. (_fwprintf_r, _swprintf_r, _vfwprintf_r, _vswprintf_r, _vwprintf_r, _wprintf_r): Declare. * libc/stdio/Makefile.am: Add new files. * libc/stdio/Makefile.in: Regenerate. * libc/stdio/fwprintf.c: New file. * libc/stdio/local.h (_svfwprintf_r, _svfiwprintf_r): Declare. (__CH_CLASS, __STATE, __ACTION): Move definition from vfprintf.c here and move to the __ namespace. (__chclass, __state_table, __action_table): Declare. * libc/stdio/stdio.tex: Add new documentation references. * libc/stdio/swprintf.c: New file. * libc/stdio/vfprintf.c (__SPRINT): New macro to call the right __sprint_r function according to compilation unit. Use throughout. (__ssprint_r): Rename STRING_ONLY variant from __sprint_r. Make externaly available. Only define if INTEGER_ONLY is defined. (__sprint_r): Make externaly available. Only define if INTEGER_ONLY is defined. Handle stream orientation. (__sbprintf): Copy FILE's _flags2 member as well. (__chclass, __state_table, __action_table): Prepend __ to name and make externally available. * libc/stdio/vfwprintf.c: New file. * libc/stdio/vswprintf.c: New file. * libc/stdio/vwprintf.c: New file. * libc/stdio/wprintf.c: New file.