To avoid any possibility of uninitialized memory.
The exceptions are:
- where the allocation is immediately overwritten by a memcpy or struct copy.
- arrays of structs to avoid any performance impact (except when the
array is returned by the public API).
There are two check-link.c files which were "tests" in the autotools
build and are unused ever since the autotools build was removed.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Not all platforms handle a zero sized allocation in calloc the
same. This macro ensures that _cairo_calloc(0) always returns NULL
similar to _cairo_malloc(0).
Pixman 0.42.3 added PIXMAN_r8g8b8_sRGB to pixman_format_code_t. CI
fails if it is missing from switch statements. Building with pixman <
0.42.3 will fail if the enum is used. So put it in a versioned #if.
Without this, building with
CFLAGS="-DDEBUG_SVG_RENDER" meson setup path/to/source
simply does not work for me:
test/svg/svg-render.c:74:(.text+0x40): undefined reference to `_cairo_debug_svg_render'
collect2: error: ld returned 1 exit status
After marking this symbol as exported, this just works.
Signed-off-by: Uli Schlachter <psychon@znc.in>
- If a link has both 'dest' and 'uri', the 'dest' will be used if it
exists, otherwise it will fallback to using the 'uri'.
- Ensure that a missing 'dest' does not result in an error. Instead a
warning is printed if CAIRO_DEBUG_TAG is set, and a link to the
current location is embedded in the PDF. ie the link does
nothing. Cairo needs to embed a link even if no destination is
available because when links are embedded at the end of the
document, the content stream already contains link tags.
- Remove cairo_pdf_interchange_write_forward_links. This code was
originally used prior to !463 when cairo wrote the links at the end
of each page. Now the links are written at the end of the document
so there are no longer any forward links with an unknown
destination, unless the destination does not exist.
- When 'internal' is not used, use the 'dest' name to reference the
link. Ensure non ASCII names are correctly encoded.
Solaris defines alloca in the <alloca.h> header
../src/cairo-colr-glyph-render.c: In function ‘add_sweep_gradient_patches’:
../src/cairo-colr-glyph-render.c:661:14: error: implicit declaration of
function ‘alloca’ [-Werror=implicit-function-declaration]
661 | angles = alloca (sizeof (double) * cl->n_stops);
| ^~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
In particular, with bitmap fonts, a floating-point error was affecting
y_bearing, yielding a value close to an integer instead of the integer
exactly. The change consists in replacing some operations of the form
A * (1/B) by A/B. Details of the issue in #503.
This new code will not always avoid rounding errors in final values
when these values could be exact, but it makes some of these errors
disappear.
The changes in the src/cairo-ft-font.c code consists of:
* Define the SCALE() macro (with some explanations in a comment).
* Remove the declarations and definitions of x_factor and y_factor.
* Update the code to use SCALE() instead of x_factor and y_factor.
perl -pi -e 's{(DOUBLE_\w+) ?(\(.*\)) \* ([xy])_factor}
{SCALE (\1 \2, unscaled->\3_scale)}' \
src/cairo-ft-font.c
* Replace the remaining 0 * x_factor and 0 * y_factor by 0.
Commit cf351a8a attempted to convert the font generation in
'_cairo_quartz_font_create_for_toy' to use CTFontCreateWithName and that uses
only Postscript Names, meaning with the hyphens.
Commit c6dc5df6 converted back to CGFont. CGFontCreateWithFontName is supposed
to work with Postscript Names, but it seems sometimes it does not.
In case a CGFont cannot be created using Postscript Names, attempt unhyphenated
version of font family name.
Specially important for font variations, which before did not
work in PDF, etc, output.
Script surface is not updated. It seems out of date with all
recent additions to cairo_font_options_t, so it loses the
variations :(.
Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/819