summaryrefslogtreecommitdiff
path: root/source/fitz/printf.c
AgeCommit message (Collapse)Author
2018-02-13Bug 699018: Null terminate buffer in fz_snprintf() even if too short.Sebastian Rasmussen
Previously the trailing null terminator would not be written if the formatted string ended up longer than the buffer.
2017-11-01Use int64_t for public file API offsets.Tor Andersson
Don't mess with conditional compilation with LARGEFILE -- always expose 64-bit file offsets in our public API.
2017-08-15Place space/zero padding correctly before/after sign.Sebastian Rasmussen
2017-08-15Move sign printing into inner formatting functions.Sebastian Rasmussen
2017-08-15Support printing flags in any order.Sebastian Rasmussen
2017-08-15Do not try to print sign for unsigned values.Sebastian Rasmussen
2017-08-15Remove unused octal value printing support.Sebastian Rasmussen
2017-04-27Include required system headers.Tor Andersson
2017-04-11Add fz_asprintf function to allocate a string and format output.Tor Andersson
2017-03-23Fix bug with printing integer zero in printf.Tor Andersson
2017-03-22Extend our printf formatting to take width and precision.Tor Andersson
2017-03-22Simplify string formatter API.Tor Andersson
Emit characters with callbacks so we don't need to do two passes using vsnprintf to count, format, and copy the result.
2016-11-23Add ptrdiff_t formatting support to fz_vsnprintf().Sebastian Rasmussen
2016-11-23fz_vsnprintf() can simply use bitwidth of given types.Sebastian Rasmussen
2016-09-19Make fz_printf() handle %lu.Sebastian Rasmussen
2016-09-18Make fz_printf() support %p.Sebastian Rasmussen
This is used at several places in mupdf.
2016-08-07Fix fz_vsnprintf() so it prints %zu.Sebastian Rasmussen
Previously we might and up with prints such as: error: malloc of array (%zu x %zu bytes) failed because %zu was never interpreted on 32-bit platforms where sizeof(size_t) < 8. After this fix we now get: error: malloc of array (14445 x 118800 bytes) failed
2016-06-17Use 'size_t' instead of int as appropriate.Robin Watts
This silences the many warnings we get when building for x64 in windows. This does not address any of the warnings we get in thirdparty libraries - in particular harfbuzz. These look (at a quick glance) harmless though.
2016-01-05Change fz_ftoa to fz_grisu to remove one extra layer of function calls.Tor Andersson
2015-12-11Use fz_output instead of FILE* for most of our output needs.Tor Andersson
Use fz_output in debug printing functions. Use fz_output in pdfshow. Use fz_output in fz_trace_device instead of stdout. Use fz_output in pdf-write.c. Rename fz_new_output_to_filename to fz_new_output_with_path. Add seek and tell to fz_output. Remove unused functions like fz_fprintf. Fix typo in pdf_print_obj.
2015-05-15Support pdf files larger than 2Gig.Robin Watts
If FZ_LARGEFILE is defined when building, MuPDF uses 64bit offsets for files; this allows us to open streams larger than 2Gig. The downsides to this are that: * The xref entries are larger. * All PDF ints are held as 64bit things rather than 32bit things (to cope with /Prev entries, hint stream offsets etc). * All file positions are stored as 64bits rather than 32. The implementation works by detecting FZ_LARGEFILE. Some #ifdeffery in fitz/system.h sets fz_off_t to either int or int64_t as appropriate, and sets defines for fz_fopen, fz_fseek, fz_ftell etc as required. These call the fseeko64 etc functions on linux (and so define _LARGEFILE64_SOURCE) and the explicit 64bit functions on windows.
2015-03-25Fix problems with fz_printf.Robin Watts
My recent changes to support %010Zd were broken in many interesting ways. Fixed here.
2015-03-24Update our printf to cope with various useful extensions.Robin Watts
Ensure that %010d works. Ensure that we can output 64 bit values (%ll{d,u,x}). Ensure that we can output size_t and fz_off_t (%z{d,u,x} and %Z{d,u,x}). fz_off_t isn't defined yet (it will be introduced by a commit that depends on this one), so for now, we put a stub definition in printf.c that we will remove later.
2015-03-20Add fz_fprintf function.Tor Andersson
2014-09-22Fix 695467: Add and use fz_ftoa function (like dtoa but with floats).Tor Andersson
The dtoa function is for doubles (which is what MuJS uses) but for MuPDF we only need and want float precision in our output formatting.
2014-09-02Add fz_snprintf and use it for formatting floating point numbers.Tor Andersson
2014-09-02Add locale-independent number formatting and parsing functions.Tor Andersson
2014-05-10Fix stack overflow in fz_vfprintf.Tor Andersson
Thanks to Triet Lai.
2014-03-25Add va_copy/va_copy_end macros to support both C89 and C99.Tor Andersson
2014-03-25fix warnings in fitz/printf.cSimon Bünzli
This fixes three instances of warning C4706, allows compilation with VS2013 and prevents an accidental va_end for when va_end is defined (which is the case for debug builds).
2014-03-19Fix MSVC compiles of printf.cRobin Watts
Stupid MSVC has no strtof.
2014-03-19Add %q and %( formatting to fz_printf to print escaped strings.Tor Andersson
%q escapes using C syntax and wraps the string in double quotes. %( escapes using PS/PDF syntax and wraps the string in parens.
2014-03-19Implement our own vsnprintf variant.Tor Andersson
The primary motivator for this is so that we can print floating point values and get the full accuracy out, without having to print 1.5 as 1.5000000, and without getting 23e24 etc. We only support %c, %f, %d, %o, %x and %s currently. We only support the zero padding qualifier, for integers. We do support some extensions: %C turns values >=128 into UTF-8. %M prints a fz_matrix. %R prints a fz_rect. %P prints a fz_point. We also implement a fprintf variant on top of this to allow for consistent results when using fz_output. a