summaryrefslogtreecommitdiff
path: root/source/fitz/memory.c
AgeCommit message (Collapse)Author
2018-02-06Workaround for Android: include limits.h where SIZE_MAX is used.Sebastian Rasmussen
SIZE_MAX is surprisingly supposed to be in stdint.h, but Android headers for API levels < 21 accidentally put SIZE_MAX in limits.h. Headers for API levels >= 21 correctly moved SIZE_MAX to stdint.h. This is the situation for Android NDK r14 and earlier. Android NDK r15 and later implement a header unification strategy: all sets of headers for each API level are combined into a single set of headers covering all API levels. Any differences are expressed by #ifdeffing on __ANDROID_API__. When this was done the moving of SIZE_MAX from limits.h to stdint.h was kept and, importantly, no #ifdefs were used in limits.h/stdint.h concerning SIZE_MAX. This means that the move of SIZE_MAX was retroactively introduced for API levels < 21 in Android NDK r15 and later. For this reason whenever mupdf uses SIZE_MAX it must include both: * stdint.h (not just in order to follow the POSIX specification, but also to compile successfully using Android NDK r15 and later) * and limits.h (in order to compile successfully using Android NDK r14 and earlier) Hence these need to include both stdint.h and limits.h, because: * source/fitz/memory.c uses SIZE_MAX * source/fitz/store.c uses SIZE_MAX The mupdf header include/mupdf/fitz/system.h includes stdint.h so any file that includes system.h will automatically have stdint.h This is true for both files. limits.h on the other hand needs to be explicitly included by whomever uses SIZE_MAX. This was already done by source/fitz/store.c but not by source/fitz/memory.c, but has now been added.
2018-01-11Only do lock checking if using custom locks.Sebastian Rasmussen
The lock checking functions are always enabled in debug mode, but since they are not thread safe they may not be used in a multi-threaded application. Multi-threaded applications are required to set their own locking functions so the lock checking functions should only be run if the default locking functions are in use.
2018-01-02Fix thread debugging code to always use ms_clock()Robin Watts
2017-11-09Bug 698353: Avoid having our API depend on DEBUG/NDEBUG.Robin Watts
Currently, our API uses static inlines for fz_lock and fz_unlock, the definitions for which depend on whether we build NDEBUG or not. This isn't ideal as it causes problems when people link a release binary with a debug lib (or vice versa). We really want to continue to use static inlines for the locking functions as used from MuPDF, as we hit them hard in the keep/drop functions. We therefore remove fz_lock/fz_unlock from the public API entirely. Accordingly, we move the fz_lock/fz_unlock static inlines into fitz-imp.h (an internal header), together with the fz_keep_.../fz_drop_... functions. We then have public fz_lock/fz_unlock functions for any external callers to use that are free of compilications. At the same time, to avoid another indirection, we change from holding the locking functions as a pointer to a struct to a struct itself.
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-07Avoid scavenging 0 bytes from store when allocating 0 bytes.Sebastian Rasmussen
2017-05-31Avoid double literals causing casts to float.Sebastian Rasmussen
2017-04-27Include required system headers.Tor Andersson
2017-04-27Rename FMT_zu to FZ_FMT_zu.Tor Andersson
Don't use FMT_zu macro for fz_throw/fz_warn, since we can portably handle '%zu' in our own printf formatting.
2017-01-17pdf: Rename FZ_ERROR_OOM to FZ_ERROR_MEMORY.Tor Andersson
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-06-08Move to using size_t for all mallocs.Robin Watts
This has knock on effects in the store. fix
2016-04-28Add FZ_ERROR_OOM, and make fz_malloc & co call it.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.
2013-06-20Rearrange source files.Tor Andersson