summaryrefslogtreecommitdiff
path: root/source/fitz/stream-prog.c
AgeCommit message (Collapse)Author
2018-03-22Clean up windows ifdefs.Tor Andersson
_WIN32 is always defined on windows (it means the WinAPI is available). _WIN64 is also defined on 64-bit targets. This means the test for defined(_WIN32) || defined(_WIN64) is redundant, since if _WIN64 is defined, then _WIN32 is always also defined. MSC_VER is only defined for MSVC, so split the ifdef sections in include/fitz/system.h into separate MSVC and WIN32 parts so that we can build with MinGW and other non-MSVC compilers on windows.
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-05-31Avoid double literals causing casts to float.Sebastian Rasmussen
2017-04-27Include required system headers.Tor Andersson
2017-03-10Fix potential double frees in error cases.Robin Watts
fz_new_stream cleans up the passed in state if the allocation fails, so don't free it in the caller too.
2017-01-17Fix 697476: Rename header files.Tor Andersson
Xcode has an idiotic default configuration where it gets confused by include search paths and file names in projects, so that it will load our "mupdf/fitz/math.h" instead of the system <math.h>. Work around this by renaming header files that have the same base name as a system header (even though they live in a subdirectory, and should never be available directly on the compiler's include path).
2016-11-03Fix signed/unsigned and size_t/int/fz_off_t warnings.Robin Watts
All seen in MSVC, mostly in 64bit builds.
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.
2015-08-20Remove a few debug functions left behind.Sebastian Rasmussen
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-05-14Move away from file descriptors to FILE *'s.Robin Watts
2015-02-25Add 64 bit windows builds to MSVC solution.Robin Watts
A few casts are required within the code, along with a few #ifdef changes. Some tweaks to curl are required too.
2015-02-17Add ctx parameter and remove embedded contexts for API regularity.Tor Andersson
Purge several embedded contexts: Remove embedded context in fz_output. Remove embedded context in fz_stream. Remove embedded context in fz_device. Remove fz_rebind_stream (since it is no longer necessary). Remove embedded context in svg_device. Remove embedded context in XML parser. Add ctx argument to fz_document functions. Remove embedded context in fz_document. Remove embedded context in pdf_document. Remove embedded context in pdf_obj. Make fz_page independent of fz_document in the interface. We shouldn't need to pass the document to all functions handling a page. If a page is tied to the source document, it's redundant; otherwise it's just pointless. Fix reference counting oddity in fz_new_image_from_pixmap.
2014-03-17Rework fz_streams.Robin Watts
Currently fz_streams have a 4K buffer within their header. The call to read from a stream fills this buffer, resulting in more data being pulled from any underlying stream than we might like. This causes problems with the forthcoming 'leech' filter. Here we simplify the fields available in the public stream header. No specific buffer is given; simply the read and write pointers. The underlying 'read' function is replaced by a 'next' function that makes the next block of data available and returns the first character of it (or EOF). A caller to the 'next' function should supply the maximum number of bytes that it knows it will need (possibly not now, but eventually). This enables the underlying stream to efficiently decode just enough. The underlying stream is free to return fewer, or a greater number if it wants to. The exact size of the 'block' of data returned will depend on the filter in use and (possibly) the data therein. Callers can get the currently available amount of data by calling fz_available (but again should pass the maximum amount of data they know they will need). The only time this will ever return 0 is if we have hit EOF.
2014-01-02Add rebinding for fz_streams.Robin Watts
2013-07-19Initial work on progressive loadingRobin Watts
We are testing this using a new -p flag to mupdf that sets a bitrate at which data will appear to arrive progressively as time goes on. For example: mupdf -p 102400 pdf_reference17.pdf Details of the scheme used here are presented in docs/progressive.txt