Add a _cairo_tag_error(fmt, ...) function that is used liked _cairo_error()
but allows an error message to be specified. When CAIRO_DEBUG_TAG is defined
the error is printed.
This allows all objects that were previously emitted uncompressed to
be compressed into a an object stream.
Currently only /Page, /Pages, and /Catalog have been converted to use
object streams.
On 64-bit windows, long is 32-bit. When compiling there are a large
number of warnings about mismatched sizes when casting long to/from a
pointer.
Use the (u)intptr_t type for any integer that will have a pointer stored
in it. Use a (u)intptr_t cast when integers are stored in pointers to
silence warnings.
Fixes#263
Commit 2fbd53 added another test to create-for-stream that failed for
cairo-pdf. Manual testing shows that this test also fails for cairo-svg.
However, this was not noticed because even before this addition to the
test, create-for-stream already failed for cairo-svg. Since the
introduction on CI was done based on "let's ignore all current
failures", this hid the error.
This commit applies the trivial fix for cairo-svg to make this test
pass. It is basically the same error that cairo-pdf had.
Additionally, this removes the hack to ignore create-for-stream failures
in CI since it is now no longer necessary.
Thanks to Knut Peterson for reporting this [0].
[0]:
https://lists.cairographics.org/archives/cairo/2021-July/029291.html
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, forward references were required to use named destinations.
This patch is based on the patch in #336 by Guillaume Ayoub <guillaume.ayoub@kozea.fr>
that converted all links to indirect objects written at the end of the document.
I have reworked the patch so that only forward references to future page numbers are
written as indirect objects. Backward references and named destinations remain as they
are. This is to minimize the number of objects written to the PDF file.
Fixes#336
cairo-pdf was silently ignoring write errors in
_cairo_pdf_surface_finish(). Any write errors that happened here ended
up setting a "status" variable, but the value in this variable was then
unused.
This commit fixes this bug by passing this error on to the caller.
Additionally, this also adds a test case for this behaviour based on
writing to /dev/full. This file is non-standard and thus the test first
checks that this file exists and is writable before trying to write to
it.
This bug was found based on a report from Knut Petersen [0].
[0]: https://lists.cairographics.org/archives/cairo/2021-July/029281.html
Signed-off-by: Uli Schlachter <psychon@znc.in>
This changes most instances of malloc() calls to use Cairo's safer
_cairo_malloc(). The malloc() call in the implementation of
boilerplate's xmalloc() is not changed since it already includes a
size=0 check.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
When strtod cannot do anything, it returns zero and sets the end pointer
to the beginning of the string. This commit changes the code in
parse_float() to treat this case as an error.
Without the fix from commit b7d67433b7, this commit turns the error
from an endless loop into a parse error, which is a lot better error
behaviour.
Signed-off-by: Uli Schlachter <psychon@znc.in>