summaryrefslogtreecommitdiff
path: root/src/stdio/vfprintf.c
AgeCommit message (Collapse)AuthorLines
2011-05-11fix the last known rounding bug in floating point printingRich Felker-3/+4
the observed symptom was that the code was incorrectly rounding up 1.0625 to 1.063 despite the rounding mode being round-to-nearest with ties broken by rounding to even last place. however, the code was just not right in many respects, and i'm surprised it worked as well as it did. this time i tested the values that end up in the variables round, small, and the expression round+small, and all look good.
2011-04-12fix printf("%.9g", 1.1) and similar not dropping trailing zerosRich Felker-1/+3
2011-04-05fix overflow in printf %N$ argument handlingRich Felker-2/+2
2011-04-05fix various floating point rounding and formatting errors in *printfRich Felker-17/+25
2011-04-04use a local temp buffer for unbuffered streams in vfprintfRich Felker-0/+13
this change makes it so most calls to fprintf(stderr, ...) will result in a single writev syscall, as opposed to roughly 2*N syscalls (and possibly more) where N is the number of format specifiers. in principle we could use a much larger buffer, but it's best not to increase the stack requirements too much. most messages are under 80 chars.
2011-03-28major stdio overhaul, using readv/writev, plus other changesRich Felker-1/+1
the biggest change in this commit is that stdio now uses readv to fill the caller's buffer and the FILE buffer with a single syscall, and likewise writev to flush the FILE buffer and write out the caller's buffer in a single syscall. making this change required fundamental architectural changes to stdio, so i also made a number of other improvements in the process: - the implementation no longer assumes that further io will fail following errors, and no longer blocks io when the error flag is set (though the latter could easily be changed back if desired) - unbuffered mode is no longer implemented as a one-byte buffer. as a consequence, scanf unreading has to use ungetc, to the unget buffer has been enlarged to hold at least 2 wide characters. - the FILE structure has been rearranged to maintain the locations of the fields that might be used in glibc getc/putc type macros, while shrinking the structure to save some space. - error cases for fflush, fseek, etc. should be more correct. - library-internal macros are used for getc_unlocked and putc_unlocked now, eliminating some ugly code duplication. __uflow and __overflow are no longer used anywhere but these macros. switch to read or write mode is also separated so the code can be better shared, e.g. with ungetc. - lots of other small things.
2011-03-25fix all implicit conversion between signed/unsigned pointersRich Felker-1/+1
sadly the C language does not specify any such implicit conversion, so this is not a matter of just fixing warnings (as gcc treats it) but actual errors. i would like to revisit a number of these changes and possibly revise the types used to reduce the number of casts required.
2011-02-20fix %n specifier, again. this time it was storing the wrong value.Rich Felker-7/+7
2011-02-16fix printf %n specifier - missing breaks had it clobbering memoryRich Felker-7/+7
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker-0/+640