summaryrefslogtreecommitdiff
path: root/fitz/base_error.c
AgeCommit message (Collapse)Author
2013-03-20Add noreturn attribute to throw/rethrow to help improve compiler warnings.Tor Andersson
2013-02-20Bug 693639: Avoid heap overflow and leaks in error cases.Robin Watts
Avoid heap overflow in the error case in fz_end_tile. Avoid leaking all previously loaded annotations from pdf_load_annots if pdf_is_dict throws an exception. Various whitespace fixes. Many thanks to zeniko.
2012-12-18Protect against draw device stack confusion due to errors while pushing.Robin Watts
Whenever we have an error while pushing a gstate, we run the risk of getting confused over how many pops we need etc. With this commit we introduce some checking at the dev_null level that attempts to make this behaviour consistent. Any caller may now assume that calling an operation that pushes a clip will always succeed. This means the only error cleanup they need to do is to ensure that if they have pushed a clip (or begun a group, or a mask etc) is to pop it too. Any callee may now assume that if it throws an error during the call to a device entrypoint that would create a group/clip/mask then no more calls will be forthcoming until after the caller has completely finished with that group. This is achieved by the dev_null layer (the layer that indirects from device calls through the device structure to the function pointers) swallowing errors and regurgitating them later as required. A count is kept of the number of pushes that have happened since an error occurred during a push (including that initial one). When this count reaches zero, the original error is regurgitated. This allows the caller to keep the cookie correctly updated.
2012-12-12Fix fz_try/fz_catch in overflow case.Robin Watts
Thanks to zeniko for pointing out that the recent changes to the fz_try/fz_catch macros to allow for throws in the fz_always block had broken the exception stack overflow case. Thanks also for the example file (nesting stack overflow.pdf), which has now been added to the regression suite.
2012-12-03Tweak fz_try/fz_always/fz_catch to handle throws from within always.Robin Watts
Throwing from within the always block is bad practice, but attempt to cope with it gracefully.
2012-08-23Silence some warnings.Robin Watts
Mountian Lion causes various different warnings to be given, possibly because a change to clang by default. Fix them here.
2012-08-07Remove fz_too_deeply_nested.Robin Watts
Rather than specifically checking for the nesting getting too deep and hence throwing an error, the error handling should do this for itself. Make it so that we spot the depth being too great in the fz_try() and throw to the fz_catch().
2012-08-06Throw exception on too deeply nested arrays/dictsSebastian Rasmussen
Previously we would run out of error stacks in the context and fail abruptly. Now, throw an exception and hope for the best. At least this plugs any memory leaks.
2012-03-06Split fitz.h/mupdf.h into internal/external headers.Robin Watts
Attempt to separate public API from internal functions.
2012-02-29On MacOS/iOS use _setjmp/_longjmp rather than setjmp/longjmp.Robin Watts
On Apple OSs setjmp/longjmp also mess with the signal handlers; we don't use signals, so we don't need the slowdown this causes. CLUSTER_UNTESTED as not tested on cluster.
2012-01-11Flush warnings before printing an error message in fz_throw.Tor Andersson
2012-01-09Update fz_try/fz_catch to be fz_try/{fz_always}/fz_catch.Robin Watts
Add explanations of how to use the macros in fitz.h. Also included are 2 different formulations, with different strengths/ weaknesses for reference. Will remove these shortly, but I want a reference to them in git. Workaround bug in Mac OS Lion gcc (clang works fine).
2012-01-09Fix Android logging bug; cut and paste error.Robin Watts
Thanks to Zeniko for pointing this out.
2012-01-06Android tweaks.Robin Watts
Include android headers in fitz.h so we can debug. Arrange for error throwing to output to android error stream as well as stderr. Change jpeg library to not use backing store. Solves bug 692473.
2011-12-08Stylistic changes when testing pointer values for NULL.Tor Andersson
Also: use 'cannot' instead of 'failed to' in error messages.
2011-12-08Remove deprecated error handling code.Tor Andersson
2011-12-08Move from volatile to fz_var.Robin Watts
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.
2011-11-14Simplify fz_try/fz_catch by removing failed flag.Robin Watts
The failed flag can be removed by having the fz_throw (and fz_rethrow) functions do the popping of the stack.
2011-09-21Add warning context.Tor Andersson
2011-09-20Reshuffle exception context code to fit Tor's aesthetic sense.Tor Andersson
2011-09-14Initial import of exception handling codeRobin Watts
Import exception handling code from WSS, modified to fit into the fitz world. With this code we have 'real' fz_try/fz_catch/fz_rethrow functions, handling a fz_except type. We therefore rename the existing fz_throw/ fz_catch/fz_rethrow to be fz_error_make/fz_error_handle/fz_error_note. We don't actually use fz_try/fz_catch/fz_rethrow yet...
2011-04-04Le Roi est mort, vive le Roi!Tor Andersson
The run-together words are dead! Long live the underscores! The postscript inspired naming convention of using all run-together words has served us well, but it is now time for more readable code. In this commit I have also added the sed script, rename.sed, that I used to convert the source. Use it on your patches and application code.
2011-03-06Add error message buffer for GUI applications to display the latest error ↵Tor Andersson
stack trace.
2011-03-06Inhibit warning message spam by introducing a repeat counter.Tor Andersson
2010-07-08Simplify #ifdef labyrinth and make some source more c89 compatible.Tor Andersson
2010-05-14Remove prefix ascii art from error messages stored in the error text buffer.Tor Andersson
2009-12-03Consolidate include lines to a single fitz.h.Tor Andersson
2009-11-29Fix up indentation.Tor Andersson
2009-08-23Print the newline at the end of error messages separately from the snprintf, ↵Tor Andersson
since it may be trimmed off if the message is too long to fit the buffer.
2009-08-22Append newline to end of error messages.Sebastian Rasmussen
2009-08-21Save error messages in a static buffer so that the windows viewer can show ↵Tor Andersson
them in a dialog box.
2009-03-11Change fz_error* struct into an integer error type fz_error.Tor Andersson
2009-03-11Add fz_catch function, and cause the throw/rethrow/catch functions to print ↵Tor Andersson
the errors immediately.
2009-02-28Merge and move header files into the source directories.Tor Andersson
2009-02-28Moved Fitz files into one directory.Tor Andersson
2005-06-04new world orderTor Andersson
2005-03-30rename and shuffle -- part 2Tor Andersson