summaryrefslogtreecommitdiff
path: root/src/stdio/vfwprintf.c
AgeCommit message (Collapse)AuthorLines
2015-06-13fix idiom for setting stdio stream orientation to wideRich Felker-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.
2015-06-13add printing of null %s arguments as "(null)" in wide printfRich Felker-0/+1
this is undefined, but supported in our implementation of the normal printf, so for consistency the wide variant should support it too.
2015-06-13add %m support to wide printfRich Felker-0/+2
2014-12-17correctly handle write errors encountered by printf-family functionsRich Felker-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.
2014-07-02fix failure of wide printf/scanf functions to set wide orientationRich Felker-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.
2013-10-07minor vfprintf and vfwprintf changes to please static code analyzersSzabolcs Nagy-4/+6
add missing va_end and remove some unnecessary code.
2013-10-04removed unused variable in vfwprintfRich Felker-2/+1
2012-11-08clean up stdio_impl.hRich Felker-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.
2012-09-06use restrict everywhere it's required by c99 and/or posix 2008Rich Felker-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.
2012-05-04fix uninitialized var in vfwprintf printing 0-prec stringRich Felker-1/+1
this could lead to spurious failures of wide printf functions
2011-03-17implement wprintf family of functionsRich Felker-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.