Commit Graph

22632 Commits

Author SHA1 Message Date
Emmanuel Fleury
d29270db60 Fix signedness warning in glib/tests/markup-collect.c
glib/tests/markup-collect.c: In function ‘main’:
glib/tests/markup-collect.c:227:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  227 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
a7fdca46e7 Fix signedness warning in glib/tests/scannerapi.c
glib/tests/scannerapi.c: In function ‘test_scanner_tokens’:
glib/tests/scannerapi.c:124:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘const int’}
  124 |   for (i = 1; i < tokbuflen; i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
cc041eb742 Fix signedness warning in glib/tests/regex.c
glib/tests/regex.c: In function ‘test_match_all’:
glib/tests/regex.c:1317:19: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 1317 |   if (match_count != g_slist_length (data->expected))
      |                   ^~
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
101a604330 Fix signedness warnings in glib/tests/rcbox.c
glib/tests/rcbox.c: In function ‘test_rcbox_alignment’:
glib/tests/rcbox.c:246:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  246 |   for (i = 0; i < G_N_ELEMENTS (block_sizes); i++)
      |                 ^
glib/tests/rcbox.c: In function ‘test_atomic_rcbox_alignment’:
glib/tests/rcbox.c:270:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  270 |   for (i = 0; i < G_N_ELEMENTS (block_sizes); i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
a1758820d7 Fix signedness warnings in glib/tests/queue.c
glib/tests/queue.c: In function ‘check_integrity’:
glib/tests/queue.c:36:15: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
   36 |   g_assert (n == queue->length);
      |               ^~
glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’
  939 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/tests/queue.c:36:3: note: in expansion of macro ‘g_assert’
   36 |   g_assert (n == queue->length);
      |   ^~~~~~~~
glib/tests/queue.c:47:15: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
   47 |   g_assert (n == queue->length);
      |               ^~
glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’
  939 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/tests/queue.c:47:3: note: in expansion of macro ‘g_assert’
   47 |   g_assert (n == queue->length);
      |   ^~~~~~~~
glib/tests/queue.c: In function ‘random_test’:
glib/tests/queue.c:274:36: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
  274 |             g_assert (qinf->length == l);
      |                                    ^~
glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’
  939 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/tests/queue.c:274:13: note: in expansion of macro ‘g_assert’
  274 |             g_assert (qinf->length == l);
      |             ^~~~~~~~
glib/tests/queue.c:419:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  419 |               if (n == q->length - 1)
      |                     ^~
glib/tests/queue.c:425:31: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  425 |               if (n >= 0 && n < q->length)
      |                               ^
glib/tests/queue.c:453:30: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  453 |               if (n < 0 || n >= q->length)
      |                              ^~
glib/tests/queue.c:640:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  640 |               if (n == g_queue_get_length (q) - 1)
      |                     ^~
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
9464721324 Fix signedness warning in glib/tests/protocol.c
glib/tests/protocol.c: In function ‘test_error’:
glib/tests/protocol.c:252:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  252 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
76b84c5f66 Fix signedness warnings in glib/tests/pattern.c
glib/tests/pattern.c: In function ‘main’:
glib/tests/pattern.c:218:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  218 |   for (i = 0; i < G_N_ELEMENTS (compile_tests); i++)
      |                 ^
glib/tests/pattern.c:225:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  225 |   for (i = 0; i < G_N_ELEMENTS (match_tests); i++)
      |                 ^
glib/tests/pattern.c:232:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  232 |   for (i = 0; i < G_N_ELEMENTS (equal_tests); i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
be5d48fe77 Fix various warnings in glib/tests/gvariant.c
glib/tests/gvariant.c: In function ‘append_tuple_type_string’:
glib/tests/gvariant.c:206:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
  206 |   for (i = 0; i < size; i++)
      |                 ^
glib/tests/gvariant.c:210:13: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
  210 |       if (i < size - 1)
      |             ^
glib/tests/gvariant.c:223:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
  223 |   for (i = 0; i < size; i++)
      |                 ^
glib/tests/gvariant.c: In function ‘describe_type’:
glib/tests/gvariant.c:386:29: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
  386 |               for (i = 0; i < length; i++)
      |                             ^
glib/tests/gvariant.c: In function ‘describe_info’:
glib/tests/gvariant.c:882:23: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
  882 |         for (i = 0; i < length; i++)
      |                       ^
glib/tests/gvariant.c: In function ‘check_offsets’:
glib/tests/gvariant.c:962:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
  962 |       for (i = 0; i < length; i++)
      |                     ^
glib/tests/gvariant.c: In function ‘tree_instance_check_gvariant’:
glib/tests/gvariant.c:2636:44: error: comparison of integer expressions of different signedness: ‘gboolean’ {aka ‘int’} and ‘guint64’ {aka ‘long unsigned int’}
 2636 |       return g_variant_get_boolean (value) == tree->data.integer;
      |                                            ^~
glib/tests/gvariant.c: In function ‘test_varargs’:
glib/tests/gvariant.c:3090:26: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 3090 |       g_assert_true (val == i++ || val == 0);
      |                          ^~
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
700a9d4042 Fix signedness warnings in glib/tests/once.c
glib/tests/once.c: In function ‘test_once_init_multi_threaded’:
glib/tests/once.c:183:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  183 |   for (i = 0; i < G_N_ELEMENTS (threads); i++)
      |                 ^
glib/tests/once.c:186:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  186 |   for (i = 0; i < G_N_ELEMENTS (threads); i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
d15260ee69 Fix signedness warnings in glib/tests/markup-escape.c
glib/tests/markup-escape.c: In function ‘main’:
glib/tests/markup-escape.c:152:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  152 |   for (i = 0; i < G_N_ELEMENTS (escape_tests); i++)
      |                 ^
../glib.git/glib/tests/markup-escape.c:159:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  159 |   for (i = 0; i < G_N_ELEMENTS (unichar_tests); i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
fbb492b3eb Fix signedness warning in glib/tests/node.c
glib/tests/node.c: In function ‘traversal_test’:
glib/tests/node.c:214:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  214 |   for (i = 0; i < G_N_ELEMENTS (orders); i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
8fc0080b5e Fix signedness warnings in glib/tests/logging.c
glib/tests/logging.c: In function ‘compare_fields’:
glib/tests/logging.c:403:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  403 |   for (i = 0; i < n1; i++)
      |                 ^
glib/tests/logging.c:405:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  405 |       for (j = 0; j < n2; j++)
      |                     ^
glib/tests/logging.c:410:13: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  410 |       if (j == n2)
      |             ^~
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
b3244bee0c Fix signedness warning in glib/tests/hash.c
glib/tests/hash.c: In function ‘test_hash_misc’:
glib/tests/hash.c:616:43: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  616 |   if (values_len != keys_len &&  keys_len != g_hash_table_size (hash_table))
      |                                           ^~
2020-11-13 10:12:16 +01:00
Emmanuel Fleury
e801143110 Fix signedness warning in glib/test/tree.c
glib/tests/tree.c: In function ‘test_tree_traverse’:
glib/tests/tree.c:394:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  394 |   for (i = 0; i < G_N_ELEMENTS (orders); i++)
      |                 ^
2020-11-13 10:12:16 +01:00
Philip Withnall
a8bc604988 Merge branch 'string-precision-missing-link' into 'master'
Fix broken link syntax in g_vasprintf docs

See merge request GNOME/glib!1747
2020-11-12 17:01:01 +00:00
Michael McClurg
234a8cdea0 Fix broken link syntax in g_vasprintf 2020-11-12 03:25:58 +00:00
Sebastian Dröge
e2fbb74301 Assert that GFileIcon::file is always set after construction 2020-11-11 13:15:24 +02:00
Sebastian Dröge
705a59a315 gio: Add missing nullable annotations 2020-11-11 13:15:21 +02:00
Philip Withnall
b8927cc6ad Merge branch 'wip/tingping/guri-normalize' into 'master'
guri: Normalize uri segments if they are encoded and add a flag to do scheme-based normalization

See merge request GNOME/glib!1716
2020-11-09 11:43:42 +00:00
Patrick Griffis
9da213ea34 docs: Add note about uri normalization for equality 2020-11-06 15:32:17 -06:00
Patrick Griffis
64f478dca3 guri: Add G_URI_FLAGS_SCHEME_NORMALIZE
This flag enables optional scheme-defined normalization
during parsing of a URI.
2020-11-06 15:32:17 -06:00
Philip Withnall
c1a11c02e5 Merge branch 'master' into 'master'
Add file handle support for gdbus call

Closes #961

See merge request GNOME/glib!1729
2020-11-06 17:19:28 +00:00
Norbert Pocs
a879c46a39 gdbus: Add FD support for gdbus call
Gdbus call could not take file handle (parameter 'h') as a parameter.

Original patch from Tim Waugh <twaugh@redhat.com>.

Fixes: #961
2020-11-06 17:19:27 +00:00
Patrick Griffis
482e10d3bb guri: Normalize uri segments if they are encoded
This changes it so when a segment is encoded it will be
normalized at parse time which ensures its valid and
it can more easily be compared with other uris.
2020-11-04 10:55:04 -06:00
Emmanuele Bassi
63dfceedd2 Merge branch 'scanner-undefined-behaviour' into 'master'
gscanner: Avoid undefined behaviour copying between union members

See merge request GNOME/glib!1737
2020-11-03 17:25:04 +00:00
Philip Withnall
add3be2086 gscanner: Avoid undefined behaviour copying between union members
It’s technically undefined behaviour in C to copy between two
potentially-overlapping regions of memory (just like it is when calling
`memcpy()`). This can easily happen with union members; and the ones in
`GScanner` in particular.

Fix that by copying through an intermediate variable.

Coverity CID: #1427317, 1427340

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-03 16:59:36 +00:00
Philip Withnall
e1e32e9b0b Merge branch 'wip/carlosg/shared-hidden-cache-timeout' into 'master'
glocalfileinfo: Use a single timeout source at a time for hidden file cache

See merge request GNOME/glib!1734
2020-11-03 15:09:44 +00:00
Carlos Garnacho
c1e0e6a055 glocalfileinfo: Use a single timeout source at a time for hidden file cache
As hidden file caches currently work, every look up on a directory caches
its .hidden file contents, and sets a 5s timeout to prune the directory
from the cache.

This creates a problem for usecases like Tracker Miners, which is in the
business of inspecting as many files as possible from as many directories
as possible in the shortest time possible. One timeout is created for each
directory, which possibly means gobbling thousands of entries in the hidden
file cache. This adds as many GSources to the glib worker thread, with the
involved CPU overhead in iterating those in its main context.

To fix this, use a unique timeout that will keep running until the cache
is empty. This will keep the overhead constant with many files/folders
being queried.
2020-11-03 14:16:36 +01:00
Philip Withnall
5719d2cde6 Merge branch 'wip/otte/interface-types' into 'master'
Improve support for interface types

See merge request GNOME/glib!1251
2020-11-02 18:07:29 +00:00
Matthias Clasen
0b1f909691 Add a test for signals returning interface types
Add a test for a signal returning interface types, using
the generic marshaller. This will hopefully exercise newly
added code in value_from_ffi_type().
2020-11-02 17:36:18 +00:00
Matthias Clasen
52357aac44 Add a binding test involving interfaces
This tests the new functionality that
g_type_interface_instantiable_prerequisite
was added for.

Before the changes, this fails with
GObject-WARNING **: Unable to convert a value of type \
                    GObject to a value of type Foo

We do the same test with g_object_bind_property_with_closures
as well, to exercise g_cclosure_marshal_generic.
2020-11-02 17:36:18 +00:00
Benjamin Otte
458e3b7a84 value: Allow automatic transforms to/from interfaces
Use the new g_type_interface_instantiable_prerequisite() to check
compatibility for transform functions.

In particular, this allows interfaces (in my case GDK_TYPE_PAINTABLE) to
be transformed to/from any GObject type (in my case G_TYPE_OBJECT) using
the transform function registered to transform between any 2 objects
(g_value_object_transform_value() does a type check and uses NULL if the
types don't match).

And this in turn allows be to g_object_bind_property() a gobject-typed
generic property (GtkListItem::item) to a GtkImage::paintable.

Tests for the new functionality are included.
2020-11-02 17:36:18 +00:00
Benjamin Otte
3f2a8d53f0 closure: Support generic marshals for interface returns
Use the newly added g_type_interface_instantiable_prerequisite() to
allow closure return values being interfaces by looking up the
instantiable type for the interface and using its GValue accessors.
2020-11-02 17:36:18 +00:00
Benjamin Otte
98f0a5a7da gtype: Add g_type_interface_instantiatable_prerequisite()
This function returns the most specific instantiatable type
that is a prerequisite for a given interface.

This type is necessary in particular when dealing with GValues
because a GValue contains an instance of a type.

This commit includes tests for the new API.
2020-11-02 17:36:18 +00:00
Benjamin Otte
e1b5afb7c0 gtype: Fix typo in API comment 2020-11-02 17:36:18 +00:00
Benjamin Otte
1f6c73747e Suggest braces around empty body in ‘if’ statements 2020-11-02 17:36:18 +00:00
Philip Withnall
4f2b1e250d gobject: Standardise on the term ‘instantiatable’
Rather than using a mixture of ‘instantiable’ and ‘instantiatable’
everywhere, standardise on the term which is already in the public API.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-02 17:22:01 +00:00
Philip Withnall
4f7c6e1ec8 gdbusauthmechanismsha1: Don’t create keyring dir when running as setuid
Continue to allow overriding the keyring dir, but don’t automatically
create it when running as root.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Coverity CID: #1432485
2020-11-02 12:23:50 +00:00
Philip Withnall
86b910e6b1 Merge branch 'issue-2236' into 'master'
Include generated files and documentation in the GIO reference

Closes #2236

See merge request GNOME/glib!1730
2020-11-02 11:45:26 +00:00
Philip Withnall
f2e347d93a Merge branch 'wip/smcv/fileutils-test-as-root' into 'master'
glib/tests/fileutils: Fix expectations when running as root

See merge request GNOME/glib!1724
2020-11-02 11:18:49 +00:00
Philip Withnall
7fd0d1c762 Merge branch 'wip/smcv/assert-no-errno' into 'master'
Make more use of g_assert_no_errno()

See merge request GNOME/glib!1731
2020-11-02 11:16:25 +00:00
Simon McVittie
087fdf86a6 glib/tests/fileutils: Fix expectations when running as root
This test asserts that g_file_set_contents_full() will fail when used
on a read-only file, but processes with CAP_DAC_OVERRIDE on Linux or
uid 0 on traditional Unix can and do ignore DAC permissions.
See also #2027, #2028.

Bug-Debian: https://bugs.debian.org/973271
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-31 12:26:44 +00:00
Simon McVittie
f53aaeac9f gio/tests/gsettings: Assert that temporary directory ends up empty
If there are stray files left over, g_rmdir() will fail with ENOTEMPTY.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-31 12:26:01 +00:00
Simon McVittie
782c1b424e gio/tests/gsettings: Assert that g_chmod succeeds
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-31 12:24:59 +00:00
Simon McVittie
3f9f7da0f1 gio/tests/gsettings: Use g_assert_no_errno()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-31 12:24:22 +00:00
Simon McVittie
3468369625 gio/tests/appmonitor: Use g_assert_no_errno()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-31 12:24:05 +00:00
Simon McVittie
b3b4ad4f94 gio/tests/live-g-file: Use g_assert_no_errno()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-31 12:20:53 +00:00
Simon McVittie
c63da52bec glib/tests/fileutils: Make more use of g_assert_no_errno()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-31 12:20:32 +00:00
Emmanuele Bassi
e1744603d8 Build gdbus-objectmanager-example docs unconditionally
The GIO reference documentation links to that documentation, so we
cannot only build it when the installed tests are enabled.
2020-10-30 16:42:53 +00:00
Emmanuele Bassi
2993bb8275 docs: Fix xinclude directives
For legacy reasons, Meson's gtk-doc helper script launches the
gtkdoc-mkhtml tool in the `html` directory under the build root. This
means that all paths must be relative to that location.
2020-10-30 16:41:07 +00:00