Implicit function declaration was removed in C99. GCC and CLang
have kept supporting it in C99 mode until GCC 14 and CLang 15.
There's little reason for enabling the relative -Werror.
This also fixes a warning when compiling C++ code:
Compiling C++ object src/libcairo-2.dll.p/win32_cairo-dwrite-font.cpp.obj
cc1plus.exe: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++
References:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91092#c21
Fixes the following warning:
../cairo/src/win32/cairo-dwrite-font.cpp:519:1: warning: no previous declaration for 'void _cairo_dwrite_glyph_run_from_glyphs(...)' [-Wmissing-declarations]
519 | _cairo_dwrite_glyph_run_from_glyphs(cairo_glyph_t *glyphs,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../cairo/boilerplate/cairo-boilerplate-win32.c:128:28: warning: comparison is always true due to limited range of data type [-Wtype-limits]
128 | for (BYTE i = 0; i <= 255; i++) {
| ^~
Fixes the following warnings on GCC:
../cairo/src/cairo-base64-stream.c:52:1: warning: initializer-string for array of 'char' truncates N
UL terminator but destination lacks 'nonstring' attribute (65 chars into 64 available) [-Wunterminat
ed-string-initialization]
52 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
References:
https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Common-Variable-Attributes.html
Fixes the following warning:
Compiling C object src/libcairo-2.dll.p/win32_cairo-win32-font.c.obj
../cairo/src/win32/cairo-win32-font.c:1322:1: warning: no previous declaration for '_cairo_compute_glyph_mask' [-Wmissing-declarations]
1322 | _cairo_compute_glyph_mask (cairo_surface_t *surface,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
Fixes the following warning on CLangCL:
..\cairo\src\cairoint.h(178,5): warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
Make sure surface->object_stream.stream is cleaned up even if things
failed
In poppler oss-fuzz tests we are getting this leak reported
Direct leak of 64 byte(s) in 1 object(s) allocated from:
#0 0x5747417eabd9 in __interceptor_calloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:74:3
#1 0x574742706f5b in _cairo_memory_stream_create cairo/src/cairo-output-stream.c:741:14
#2 0x5747426757b8 in _cairo_pdf_surface_open_object_stream cairo/src/cairo-pdf-surface.c:2307:34
#3 0x57474266b880 in _cairo_pdf_surface_finish cairo/src/cairo-pdf-surface.c:2700:14
#4 0x57474261afc6 in _cairo_surface_finish cairo/src/cairo-surface.c:1043:11
#5 0x57474261afc6 in cairo_surface_finish cairo/src/cairo-surface.c:1092:5
#6 0x57474270808a in _cairo_paginated_surface_finish cairo/src/cairo-paginated-surface.c:215:2
#7 0x5747426175c2 in _cairo_surface_finish cairo/src/cairo-surface.c:1043:11
#8 0x5747426175c2 in cairo_surface_destroy cairo/src/cairo-surface.c:978:2
This fixes it.
_cairo_pdf_surface_finish was succeeding past
_cairo_pdf_surface_open_object_stream that allocates surface->object_stream.stream,
failing when calling _cairo_pdf_surface_emit_font_subsets
and that memory was never freed
Otherwise gitlab-runner prints a few warnings:
> Uploading artifacts...
> WARNING: Part of .git directory is on the list of files to archive
> WARNING: This may introduce unexpected problems
Both system() and popen() invoke the shell. Which shell is
invoked depends on the COMSPEC environment variable, but
usually it's CMD.exe.
CMD.exe doesn't quite like paths with forward slashes in its
command-line. Most of the times, the forward slash is mistaken
for a command line switch (the start of an option). For example:
cmd /c "dir C:\Windows" works
cmd /c "dir C:/Windows" doesn't work
Open the pipe in binary mode on Windows to get the expected
byte counts. Note that the 'b' mode for popen is not portable
and so is used only on Windows:
> The behavior of popen() is specified for values of mode of "r",
> "w", "re", and "we". Other modes such as "rb" and "wb" might be
> supported by specific implementations, but these would not be
> portable features.
https://pubs.opengroup.org/onlinepubs/9799919799/functions/popen.html