Age | Commit message (Collapse) | Author |
|
The new fz_malloc_struct(A,B) macro allocates sizeof(B) bytes using
fz_malloc, and then passes the resultant pointer to Memento_label
to label it with "B".
This costs nothing in non-memento builds, but gives much nicer
listings of leaked blocks when memento is enabled.
|
|
|
|
|
|
|
|
Fixes for leaks (and SEGVs, division by zeros etc) seen when
Memsqueezing.
|
|
Fix warnings/errors thrown up by the last few commits (which were
only tested on windows).
|
|
The substitute fonts used in a fontdesc are held in ROM, and as such
should not count towards the size of a fontdesc. Simple fix; remove
the lines that adds that in.
|
|
|
|
Change the fz_store to be limited to 256 Megs. Remove the soft limit
for pixmaps; the store will automatically throw old resources away
to stay below the limit.
|
|
Firstly, we rename pdf_store to fz_store, reflecting the fact that
there are no pdf specific dependencies on it.
Next, we rework it so that all the objects that can be stored in
the store start with an fz_storable structure. This consists of
a reference count, and a function used to free the object when
the reference count reaches zero.
All the keep/drop functions are then reimplemented by calling
fz_keep_sharable/fz_drop_sharable. The 'drop' functions as supplied
by the callers are thus now 'free' functions, only called if
the reference count drops to 0.
The store changes to keep all the items in the store in the linked
list (which becomes a doubly linked one). We still make use of
the hashtable to index into this list quickly, but we now have
the objects in an LRU ordering within the list.
Every object is put into the store, with a size record; this is
an estimate of how much memory would be freed by freeing that
object.
The store is moved into the context and given a maximum size;
when new things are inserted into the store, care is taken to
ensure that we do not expand beyond this size. We evict any
stored items (that are not in use) starting from the least
recently used.
Finding an object in the store now takes a reference to it already.
LOCK and UNLOCK comments are used to indicate where locks need to
be taken and released to ensure thread safety.
|
|
|
|
When adding the exception handling in, I'd mis-indented some code.
This caused all the file to be read.
|
|
|
|
Also: use 'cannot' instead of 'failed to' in error messages.
|
|
|
|
|
|
|
|
When using exceptions (which are implemented using setjmp/longjmp), we
need to be careful to ensure that variable values get written back
before any exception happens.
Previously we've done that using volatile, but that produces nasty
warnings (and unduly limits the compilers freedom to optimise). Here
we introduce a new macro fz_var that passes the address of the variable
out of scope. This means that the compiler has to ensure that any
changes to its value are written back to memory before calling any
out of scope function.
|
|
In converting from error return to exception throwing I was over
enthusiatic and removed more than I should. Add missing code back
in. Problem was seen with "0 - password password (crypt level 5).pdf"
|
|
Another missed fz_rethrow. Also, ensure that fz_drop_buffer copes
with NULL input.
|
|
When converting to exception handling I'd messed up an error handling
case; when failing to pdf_lex in pdf_repair_xref I had allowed the
error to just carry on being thrown rather than catching it and
cleaning up. This was resulting in not getting any output for the
above file, rather than outputting as much as we could.
Simple fix.
|
|
The code was dereferencing xref to get ctx before checking whether it
was NULL or not. Simple fix to move the test up a bit.
|
|
An error while parsing pdf_parse_array could result in double
dropping of an object. Simple fix.
|
|
|
|
|
|
The code attempts to spot cases where a pattern tile is so large that
only 1 repeat is visible. Due to rounding errors, this test could
sometimes fail, and (on badly formed files) we'd attempt to allocate
huge pixmaps.
The fix is to allow for rounding errors.
|
|
The code attempts to spot cases where a pattern tile is so large that
only 1 repeat is visible. Due to rounding errors, this test could
sometimes fail, and (on badly formed files) we'd attempt to allocate
huge pixmaps.
The fix is to allow for rounding errors.
|
|
2 if clauses were (harmlessly) duplicated in pdf_find_builtin_font,
probably due to an automated code merge (or other cut/paste error).
|
|
2 if clauses were (harmlessly) duplicated in pdf_find_builtin_font,
probably due to an automated code merge (or other cut/paste error).
|
|
|
|
When opening a file, create a pdf_ocg_descriptor that lists the OCGs
in a file. Add a new function to allow us to set the configuration
in use (currently just the default one).
This sets the states of the OCGs as appropriate. When decoding the
file respect the states of the OCGs.
This results in Invite.pdf rendering correctly.
There is more to be done in this area (with automatic setting of
OCGs by language/zoom level etc), but this is a good start.
|
|
Once we've applied the clipping path, don't clip again on every
subsequent path.
|
|
Adopt Zenikos patch from bug 692506; if a dict fails to parse, then
create an empty one and continue. The repaired document will be
incomplete, but we may well get something useful out of it.
|
|
Previously when parsing an object with a missing endobj, the
code would consume the header of the following object. Here
we amend the code to give up searching for an endobj if it
finds an integer (presumed to be the start of the next object).
We backtrack over that integer and carry on.
|
|
Add simple code to read decode array and apply it to a jpx image
after loading. Solves bug.
|
|
Do not emit a warning if AES strings are 0 bytes long.
|
|
When reverting the clip path handling, I made a mistake. We need to
set up the clip before starting any local group to ensure correct
nesting.
|
|
When reverting the clip path handling, I made a mistake. We need to
set up the clip before starting any local group to ensure correct
nesting.
|
|
Mostly redoing the xps_context to xps_document change and adding
contexts to newly written code.
Conflicts:
apps/pdfapp.c
apps/pdfapp.h
apps/x11_main.c
apps/xpsdraw.c
draw/draw_device.c
draw/draw_scale.c
fitz/base_object.c
fitz/fitz.h
pdf/mupdf.h
pdf/pdf_interpret.c
pdf/pdf_outline.c
pdf/pdf_page.c
xps/muxps.h
xps/xps_doc.c
xps/xps_xml.c
|
|
In commit 2f8acb0, we tweaked mupdf's clip path handling so that
clip paths were resolved as soon as the operator for them was
called; this protected against subsequent changes to the path
happening before something else was drawn ready for clipping.
Unfortunately, various PDF files out there seem to rely on the
fact that they can call the 'W' operator before fully defining
the path, and that the region that will be clipped is given by
the final path, not the one that was in place when the operator
was called.
We therefore revert back to the old behaviour.
|
|
|
|
|
|
|
|
It is vital that no one returns from within fz_try. As such it's often
necessary to jump out of an fz_try. This can mean using a label at the
end of the fz_try section to goto.
By introducing a "do { } while (0)" around the contents of the fz_try
we allow people to 'break' (or 'continue') to get out neatly.
|
|
This frees us from passing errors back everywhere, and hence enables us
to pass results back as return values.
Rather than having to explicitly check for errors everywhere and bubble
them, we now allow exception handling to do the work for us; the
downside to this is that we no longer emit as much debugging information
as we did before (though this could be put back in). For now, the
debugging information we have lost has been retained in comments
with 'RJW:' at the start.
This code needs fuller testing, but is being committed as a work in
progress.
|
|
|
|
|
|
|
|
|
|
Huge pervasive change to lots of files, adding a context for exception
handling and allocation.
In time we'll move more statics into there.
Also fix some for(i = 0; i < function(...); i++) calls.
|