Commit graph

402 commits

Author SHA1 Message Date
Adrian Johnson
9fbf427548 Use uintptr_t for all casts between pointer and integer
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
2021-07-25 11:01:20 +09:30
Uli Schlachter
1e34651420 Fix meson build without zlib
Trying to build with meson with -Dzlib=disabled failed with the
following error message:

cairo/test/meson.build:599:2: ERROR: Unknown variable
"libcairoscript_dep".

This commit fixes that problem by adding a not-found dependency if
cairo-script is not built.

Additionally, follow-up problems are fixed:

- any2ppm.c still tried to include cairo-script-interpreter.h, which was
  not found
- Building cairo-test-trace was attempted, but that also failed because
  of missing script support.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/475
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-22 08:16:47 +02:00
Uli Schlachter
1981fb6dfb meson: Use more dependency objects
For example, to depend on cairo-script, inccairoscript was added to
"include_directories:" and libcairoscript was added to "link_with:".
This commit instead uses the libcairoscript_dep dependency everywhere.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-22 07:59:52 +02:00
Uli Schlachter
45cca0c984 meson: Move CAIRO_HAS_INTERPRETER to config.h
This is what autoconf does and hopefully that means this is the correct
thing to do.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-02 21:25:48 +02:00
Emmanuele Bassi
bd13841257 Drop the conditional inclusion of config.h
We *always* generate this file, and we depend on its existence.

The idea behind HAVE_CONFIG_H was being able to include random files
from different projects, back in a time where "libraries" were literally
just random files instead of actual shared objects.

Since we're not in the '80s any more, and our build system(s) define
HAVE_CONFIG_H *and* generate the config.h header file, we don't need a
conditional guard around its inclusion.
2021-05-01 17:05:29 +01:00
Emmanuele Bassi
bfd1602db9 Remove stray _GNU_SOURCE definitions
We define _GNU_SOURCE globally in both the Autotools build, through the
use of the AC_USE_SYSTEM_EXTENSIONS macro; and in the Meson build, with
add_project_arguments().
2021-05-01 16:58:15 +01:00
Emmanuele Bassi
8336309794 meson: Define HAVE_CONFIG_H as a project flag
Precisely what Autotools does, instead of adding it as per-target C
argument.

Once we remove HAVE_CONFIG_H checks in every source file, we'll be able
to drop it.
2021-05-01 16:55:38 +01:00
Uli Schlachter
64e1fd70ec Merge branch 'ebassi/warnings-fixes' into 'master'
Avoid a bunch of compiler warnings

See merge request cairo/cairo!166
2021-04-27 16:30:44 +00:00
Emmanuele Bassi
efab74f5a1 Drop volatile from the GType registration
The `volatile` is unnecessary, and newer versions of GLib and GCC will
complain if you use it.
2021-04-27 16:59:35 +01:00
Emmanuele Bassi
b7d38e048f Use g_memdup2() with newer versions of GLib
The g_memdup() function has been deprecated, as it takes the size of the
memory area as an unsigned integer. The g_memdup2() replacement uses the
more appropriate size_t type, instead.
2021-04-27 16:54:22 +01:00
Tim-Philipp Müller
ca478e0327 meson: make cairo-trace executable
Install with exec flag set and make sure tool is
executable in build directory as well (by making
the input file in the source directory executable).

Fixes #462
2021-03-09 10:59:57 +00:00
Tim-Philipp Müller
0ed1053d8f utils: remove hacky replacement for backtrace_symbols in glibc
Doesn't build any more, is very much non-essential, and hasn't
been touched in any meaningful way since it was added 13 years
ago, so just remove it for now until someone steps up. Chances
are the glibc version has improved since then.
2021-02-23 12:29:58 +00:00
Tim-Philipp Müller
e30259f623 cairo-trace: fix build with newer versions of bfd
And update configure/meson checks to check for the new function.

Drop libiberty.h check since it's only needed by backtrace-symbols.c
which we're about to remove.

Closes #391, #460
2021-02-23 12:29:58 +00:00
Tim-Philipp Müller
51d50621be meson: only build cairo-boilerplate and cairo-missing helper libs if needed
Used by tests and the sphinx utility, which may or may not be built,
and if they're not built we don't need to build those libs either.
2021-01-15 18:47:08 +00:00
Xavier Claessens
ebbaebdec1 meson: Generate cairo-script-interpreter.pc needed by GTK+ 2020-12-22 13:16:05 -05:00
Tim-Philipp Müller
e9ccb1d8d0 meson: fix library versioning
Fixes #442
2020-12-15 00:22:37 +00:00
George Matsumura
08c76f4cbf cairo-trace: Fix escape character encoding in string literals
This fixes a typo wherein both a return character and a tab character
were encoded when only a return character was specified for encoding.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-11-20 16:07:53 +00:00
George Matsumura
ed98414686 build: Fix various compiler warnings
This fixes a few compiler warnings that were encountered with gcc 9.3.0.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-11-07 06:45:01 -07:00
Xavier Claessens
70c01fb9d1 cairo-gobject: Missing cairo include directories
When cairo is a subproject and application uses libcairogobject_dep, it
was missing include directories set in libcairo_dep.
2020-10-07 11:50:07 -04:00
Xavier Claessens
084404cd15 meson: Use pkgmod.generate() for all cairo pc files
Also override each dependency so they can be used when cairo is used as
subproject.
2020-10-06 10:58:04 -04:00
Xavier Claessens
e2c1b76d71 meson: Fix build when libpng is not found
trace-to-xml.c needs cairo-xml.h which is only available when
CAIRO_HAS_XML_SURFACE feature is built which is only available when both
zlib and png are found. CAIRO_HAS_INTERPRETER only requires zlib.
2020-10-03 22:42:56 -04:00
Xavier Claessens
6a6ab24759 meson: Fix cross build with Android NDK
Android NDK does not contain execinfo.h so malloc-stats.c cannot be
built.
2020-10-02 17:29:07 -04:00
George Matsumura
9a3ad1df1c build: Include correct poll.h
Including sys/poll.h when poll.h is available produces a compile
warning on some systems, but only sys/poll.h is present on others
such as AIX. This makes sure the most suitable poll.h is included
in each situation.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-09-05 12:15:57 +00:00
George Matsumura
f2cb9ba49a meson: Fix musl build
This constitutes few fixes that are necessary to compile correctly
and reduce errors when using musl libc.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-09-02 10:29:04 +00:00
Ting-Wei Lan
b87e53dc1c meson: Fix undefined reference when bfd library is installed
Add the missing file which is necessary when symbol lookup is enabled.
2020-08-31 23:20:49 +08:00
Tim-Philipp Müller
7cb362d586 meson: fix cairo-script-interpreter library name
Fixes #418
2020-08-07 00:18:17 +01:00
Mathieu Duponchelle
596a82f2d1 Add meson build definitions
Co-Authored by:
Nirbheek Chauhan <nirbheek@centricular.com>
lb90 <luca.bacci982@gmail.com>
Tim-Philipp Müller <tim@centricular.com>
2020-07-31 12:21:50 +01:00
luz.paz
6d93bddbd6 Misc. typos
Found via `codespell -i 3 -w -I ../cairo-word-whitelist.txt -L tim,ned,uint`
Follow up of 12cb59be7d

Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
2019-01-31 17:37:15 -08:00
Maarten Lankhorst
a34cb719cd Add support for RGBA128F and RGB96F formats.
IGT wants to add support for planes with a bit depth >10, which
requires a higher precision format than we have currently.

I'm using RGBA as format, because of its existence in OpenGL.
With the new formats we can directly convert our bytes to half float,
or multiply a colro vector with a matrix to go to the Y'CbCr colorspace.

This requires pixman 0.36.0, so bump the version requirement.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
2019-01-07 19:10:44 -08:00
Maarten Lankhorst
87c1c19197 cairo-trace: Simplify bigendian case in emit_image.
All the cases are the same, except len is different.
Use the already calculated len parameter to handle all
cases except RGB24 the same.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Suggested-by: Bryce Harrington <bryce@bryceharrington.org>
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
2019-01-07 19:10:30 -08:00
Paul Menzel
f246a2144f Use HTTPS URLs for gnome.org domains
Run the command below suggested by geirha in ##sed@irc.freenode.net.

    git grep -l 'http://.*gnome.org' | xargs sed -i 's|http\(://\([[:alnum:].-]*\.\)\{0,1\}gnome\.org\)|https\1|g'

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
2018-10-16 10:03:20 -07:00
Paul Menzel
1c9201721d Use HTTPS URLs for freedesktop.org domains
Run the command below suggested by geirha in ##sed@irc.freenode.net.

    git grep -l 'http://.*freedesktop.org' | xargs sed -i 's|http\(://\([[:alnum:].-]*\.\)\{0,1\}freedesktop\.org\)|https\1|g'

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
2018-10-16 10:03:07 -07:00
Bryce Harrington
9d2e3646fa script-surface: Check for invalid ids (CID #1159557, 1159558)
If the bitmap's min is non-zero, _bitmap_next_id() could break out of
its loop early, before initializing the prev variable.  prev would then
be dereferenced without a null ptr check.  This condition should never
occur in practice, so add an assert() to assure it doesn't.

Same issue is present in trace.c.

Coverity IDs: #1159557, #1159558
Reviewed-By: Uli Schlachter <psychon@znc.in>
Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
2018-06-13 15:21:50 -07:00
Unknown
12cb59be7d Cairo trivial typos
Found using `codespell -q 3 -I cairo-whitelist.txt`
whereby whitelist contained:
```
amin
iff
lod
writen
```

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2018-04-02 17:46:58 -07:00
suzuki toshiya
33a348d698 csi-trace does not show help
csi-trace does not show help string correctly, due to a bug in its
command line argument parsing.  strcmp returns 0 when there is an exact
match, which means it requires an inverted test.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2018-04-02 11:55:19 -07:00
Adrian Johnson
4ae7f411c8 util/font-view: fix build error 2017-10-21 20:05:56 +10:30
Adrian Johnson
9ffbf63d37 fix warning: inlining failed in call to '_csi_stack_push' 2017-10-21 13:08:39 +10:30
Guillermo Rodriguez
5ac7b3652d script: Fix misleading indentation warning.
Spotted by David Kastrup <dak@gnu.org>.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-08-21 16:05:16 -07:00
Adrian Johnson
55f8c6d9f4 fix compiler warnings 2016-10-04 12:00:30 +10:30
Behdad Esfahbod
0aad04a88b Bug 29319 - Modules are built as versioned shared objects
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29319
2016-09-02 15:54:01 -07:00
Adrian Johnson
747cab741c Add CAIRO_STATUS_WIN32_GDI_ERROR for GDI errors 2016-03-26 22:18:05 +10:30
Adrian Johnson
cdd5c92ced Add CAIRO_STATUS_FREETYPE_ERROR for errors returned by libfreetype 2016-03-26 21:45:59 +10:30
Adrian Johnson
8f6790123e Adding missing error status to utils 2016-03-26 19:06:03 +10:30
Bryce Harrington
b4a922f62d cairo-script: Rename struct member to avoid name collision on AIX
On AIX, the token jmpbuf is a pre-processor macro.
cairo-script-scanner.c includes a private struct with a member named
jmpbuf which gets renamed to __jmpbuf when AIX's sys/context.h has been
included.

While judicious ordering of includes might kludge around this problem
(by causing all references to .jmpbuf to become .__jmpbuf), it's better
to simply select a new name for the struct member that won't suffer the
collision.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=89339

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-18 12:38:59 -07:00
Bryce Harrington
714a77e3f1 cairo-script: Prefer cairo from local tree
Use quoted includes rather than bracketed, to prefer linking to the
in-tree cairo in preference to the system cairo.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-18 12:38:55 -07:00
Bryce Harrington
3ed581149f cairo-script: Cleanup boilerplate header for consistency
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-18 12:38:51 -07:00
Bryce Harrington
d31e2418d6 cairo-script: Add missing copyright and boilerplate
Chris wrote all of the cairo script stuff.  I'm making a guess about the
copyright date.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-18 12:38:47 -07:00
Bryce Harrington
a3b6afabf6 cairo-script: Always include config.h first thing
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-18 12:38:43 -07:00
Bryce Harrington
b9ada81995 cairo-script: Improve buffer length check
Quells the following warning:

cairo-script-scanner.c: In function ‘_translate_string’:
cairo-script-scanner.c:1623:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
      if (buf_len <= 8 + 2*string->len) {
                  ^
2015-06-04 14:24:31 -07:00
Bryce Harrington
c0458b4560 csi-trace: Add --version and --help args to utility 2015-03-06 23:35:34 -08:00