about summary refs log tree commit diff
path: root/src/stdio/vfwprintf.c
Commit message (Collapse)AuthorAgeFilesLines
* fix idiom for setting stdio stream orientation to wideRich Felker2015-06-131-1/+1
| | | | | | | | | | | | the old idiom, f->mode |= f->mode+1, was adapted from the idiom for setting byte orientation, f->mode |= f->mode-1, but the adaptation was incorrect. unless the stream was alreasdy set byte-oriented, this code incremented f->mode each time it was executed, which would eventually lead to overflow. it could be fixed by changing it to f->mode |= 1, but upcoming changes will require slightly more work at the time of wide orientation, so it makes sense to just call fwide. as an optimization in the single-character functions, fwide is only called if the stream is not already wide-oriented.
* add printing of null %s arguments as "(null)" in wide printfRich Felker2015-06-131-0/+1
| | | | | this is undefined, but supported in our implementation of the normal printf, so for consistency the wide variant should support it too.
* add %m support to wide printfRich Felker2015-06-131-0/+2
|
* correctly handle write errors encountered by printf-family functionsRich Felker2014-12-171-1/+6
| | | | | | | | | | | | | | | | | | previously, write errors neither stopped further output attempts nor caused the function to return an error to the caller. this could result in silent loss of output, possibly in the middle of output in the event of a non-permanent error. the simplest solution is temporarily clearing the error flag for the target stream, then suppressing further output when the error flag is set and checking/restoring it at the end of the operation to determine the correct return value. since the wide version of the code internally calls the narrow fprintf to perform some of its underlying operations, initial clearing of the error flag is suppressed when performing a narrow vfprintf on a wide-oriented stream. this is not a problem since the behavior of narrow operations on wide-oriented streams is undefined.
* fix failure of wide printf/scanf functions to set wide orientationRich Felker2014-07-021-0/+1
| | | | | | in some cases, these functions internally call a byte-based input or output function before calling getwc/putwc, so they cannot rely on the latter to set the orientation.
* minor vfprintf and vfwprintf changes to please static code analyzersSzabolcs Nagy2013-10-071-4/+6
| | | | add missing va_end and remove some unnecessary code.
* removed unused variable in vfwprintfRich Felker2013-10-041-2/+1
|
* clean up stdio_impl.hRich Felker2012-11-081-0/+7
| | | | | | | | | | | this header evolved to facilitate the extremely lazy practice of omitting explicit includes of the necessary headers in individual stdio source files; not only was this sloppy, but it also increased build time. now, stdio_impl.h is only including the headers it needs for its own use; any further headers needed by source files are included directly where needed.
* use restrict everywhere it's required by c99 and/or posix 2008Rich Felker2012-09-061-1/+1
| | | | | | | | to deal with the fact that the public headers may be used with pre-c99 compilers, __restrict is used in place of restrict, and defined appropriately for any supported compiler. we also avoid the form [restrict] since older versions of gcc rejected it due to a bug in the original c99 standard, and instead use the form *restrict.
* fix uninitialized var in vfwprintf printing 0-prec stringRich Felker2012-05-041-1/+1
| | | | this could lead to spurious failures of wide printf functions
* implement wprintf family of functionsRich Felker2011-03-171-0/+354
this implementation is extremely ugly and inefficient, but it avoids a good deal of code duplication and bloat. it may be cleaned up later to eliminate the remaining code duplication and some of the warts, but i don't really care about its performance. note that swprintf is not yet implemented.