Philip Withnall
3bca6ee2e4
Merge branch 'fix_more_warnings' into 'master'
...
Fix more warnings
See merge request GNOME/glib!2101
2021-05-13 20:16:46 +00:00
Emmanuel Fleury
e952248dc2
Use G_OPTION_ENTRY_NULL to avoid missing initializer warnings
2021-05-13 20:16:46 +00:00
Philip Withnall
82e2517257
Merge branch 'carlosgc/remove-dot-segments' into 'master'
...
guri: always apply the remove dot segments algorithm
Closes #2342
See merge request GNOME/glib!2084
2021-05-13 13:13:34 +00:00
Philip Withnall
53834ee319
Merge branch 'fix_more_warnings' into 'master'
...
Fix more warnings (clang)
See merge request GNOME/glib!2091
2021-05-13 12:04:42 +00:00
Philip Withnall
56ddba7c34
Merge branch 'serializ' into 'master'
...
docs: Standardize spelling of serializ*
Closes #2399
See merge request GNOME/glib!2096
2021-05-13 11:37:11 +00:00
Emmanuel Fleury
82fc86dcd4
Fix missing initializer warning in gio/gio-tool-info.c
...
gio/gio-tool-info.c:41:10: warning: missing field 'short_name' initializer
{ NULL }
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
8a3e184db9
Fix missing initializer warning in gio/gio-tool-copy.c
...
gio/gio-tool-copy.c:50:10: warning: missing field 'short_name' initializer
{ NULL }
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
c395e865bf
Fix missing initializer warning in gio/gio-tool-cat.c
...
gio/gio-tool-cat.c:42:10: warning: missing field 'short_name' initializer
{ NULL }
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
27454ed557
Fix missing initializer warning in gio/glib-compile-schemas.c
...
gio/glib-compile-schemas.c:2181:12: warning: missing field 'short_name' initializer
{ NULL }
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
4301110174
Fix missing initializer warning in gio/tests/socket-client.c
...
gio/tests/socket-client.c:37:8: warning: missing field 'short_name' initializer
{NULL}
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
689b9b545f
Fix missing initializer warning in gio/tests/socket-server.c
...
gio/tests/socket-server.c:43:8: warning: missing field 'short_name' initializer
{NULL}
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
66af256621
Fix missing initializer warning in glib/tests/spawn-path-search-helper.c
...
glib/tests/spawn-path-search-helper.c:82:12: warning: missing field 'short_name' initializer
{ NULL }
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
f9904fe7ae
Fix missing initializers warnings in glib/tests/utf8-validate.c
...
glib/tests/utf8-validate.c:271:11: warning: missing field 'max_len' initializer
{ NULL, }
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
c65ec0bfbf
Fix many missing initializers warnings in glib/tests/option-context.c
...
glib/tests/option-context.c:36:10: warning: missing field 'short_name' initializer
{ NULL }
^
glib/tests/option-context.c:43:10: warning: missing field 'short_name' initializer
{ NULL }
^
glib/tests/option-context.c:319:14: warning: missing field 'short_name' initializer
{ NULL } };
^
...
^
glib/tests/option-context.c:2538:12: warning: missing field 'short_name' initializer
{ NULL }
^
glib/tests/option-context.c:2576:14: warning: missing field 'short_name' initializer
{ NULL } };
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
f2d14a8770
Fix missing field initializer warning in glib/tests/option-argv0.c
...
glib/tests/option-argv0.c:38:14: warning: missing field 'short_name' initializer
{ NULL } };
^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
2e4524cd36
Add the G_OPTION_ENTRY_NULL macro to properly initialize GOptionEntry arrays
2021-05-13 12:57:06 +02:00
Philip Withnall
c0b339372c
Merge branch 'mcatanzaro/string-test' into 'master'
...
tests: Add missing return value check in string test
See merge request GNOME/glib!2100
2021-05-11 22:27:44 +00:00
Philip Withnall
940613e598
Merge branch 'gmacros-gnoreturn-cleanup' into 'master'
...
gmacros.h: G_NORETURN: remove useless checks
See merge request GNOME/glib!2099
2021-05-11 22:26:44 +00:00
Michael Catanzaro
82d162da83
tests: Add missing return value check in string test
...
Coverity noticed that we were not testing the return value here. Good
Coverity!
2021-05-11 16:24:39 -05:00
Aleksandr Mezin
55f13da1f5
gmacros.h: G_NORETURN: remove useless checks
...
GCC >= 2.8 and MSVC >= 1200 are already handled by `#if` branches above. So:
- `(__GNUC__ == 4 && __GNUC_MINOR__ >= 7)` is always false here
- `!(__GNUC__ == 4 && __GNUC_MINOR__ == 7)` is always true
- `(_MSC_VER >= 1900)` is always false
2021-05-11 22:27:40 +06:00
Philip Withnall
4cd1a1c03d
Merge branch 'optimise_g_atomic_ref_count_dec' into 'master'
...
grefcount: Optimise g_atomic_ref_count_dec
See merge request GNOME/glib!2098
2021-05-11 11:00:26 +00:00
Nishal Kulkarni
8cba1f4c17
grefcount: Optimise g_atomic_ref_count_dec
...
Currently, `g_atomic_ref_count_dec ()` does two operations.
We try to get this down to one operation.
Replace `g_atomic_int_dec_and_test ()` with `g_atomic_int_add ()`
Passing -1 as value.
Note: changes current behaviour, checks are now done after decrement.
2021-05-11 15:08:20 +05:30
Sebastian Dröge
ea4721422f
Merge branch 'optimise_gatomicrefcount' into 'master'
...
grefcount: Optimise g_atomic_ref_count_inc
Closes #1583
See merge request GNOME/glib!2086
2021-05-11 07:27:24 +00:00
Geyslan G. Bem
6b867cd474
docs: Standardize spelling of serializ*
...
Changes serialis* to serializ*.
Fixes : #2399
Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-10 15:28:12 -03:00
Philip Withnall
e8329b5219
Merge branch 'mywork' into 'master'
...
glib: Improved documentation of GSourceFuncs
Closes #1864
See merge request GNOME/glib!2095
2021-05-10 15:15:58 +00:00
nitinosiris
15e3b9e219
glib: documentation of GSourceFuncs
...
Only finalize has a comment to indicate that it can be NULL
However, prepare and check can both be NULL too.
Fixes: 1864
2021-05-10 20:03:12 +05:30
Philip Withnall
2549187b18
Merge branch 'windows-known-folders' into 'master'
...
Use SHGetKnownFolderPath() on Windows
Closes #2397
See merge request GNOME/glib!2089
2021-05-10 14:13:01 +00:00
Thomas Haller
bdd6b753ca
main: document notify function gets called during g_source_destroy()
...
This seems non-obvious to me. Document it.
It also seems important to know, because it means that the data pointer
might already be destroyed, before the source is unreferenced for good.
For example, if the data pointer keeps a reference to the GSource,
and it might seem sensible to call:
g_source_destroy(data->source);
g_source_unref(data->source); /* <<< data is already destroyed? */
This leads to a crash, if the source was attached to a context.
2021-05-10 13:16:05 +02:00
Thomas Haller
b0157af9a6
gdbus: document completion after idle action for g_dbus_connection_signal_unsubscribe()
...
Since commit ab285899a6
('gdbusconnection: Document main context
iteration for unsubscript'), we document when the user is guaranteed
that all resources are gone after g_dbus_connection_signal_unsubscribe().
This is not merely an implementation detail, it's something that the
user needs to be able to rely on. It is good that this is documented.
However, libnm does something different ([1]). It registers to several D-Bus
signals without providing a GDestroyNotify. After unsubscription, it schedules
another idle action with lower priority and uses that to know when
cleanup is complete. I think this is a useful alternative and should
also be guaranteed and documented to work.
Also note that this isn't just some implementation detail that currently
happens to work. GDBusConnection tightly integrates with GMainContext and it
works by scheduling idle sources with G_PRIORITY_DEFAULT priority. It needs to
schedule all events with this same priority, otherwise the ordering is not
preserved. At this point, with GDBusConnection working this way, this is no longer
something that can reasonably be any different. It's how GDBusConnection fundamentally
works, and a user must be able to rely on that. As such, this new promise isn't
something that we would want to break in the future.
Thus document it.
[1] a55c10c6cb/src/libnm-client-impl/nm-client.c (L7918)
2021-05-10 13:16:05 +02:00
Nishal Kulkarni
827b4ec855
grefcount: Optimise g_atomic_ref_count_inc
...
Currently, `g_atomic_ref_count_inc ()` does three operations.
We try to get this down to one operation.
Fixed by replacing `g_atomic_int_inc ()` with `g_atomic_int_add ()`
which increments by 1 and returns old value
Note: changes current behaviour, checks are now done after increment.
Closes : #1583
2021-05-10 15:45:00 +05:30
Philip Withnall
66fe1da95a
Merge branch 'serializ' into 'master'
...
docs: Standardize spelling of serializ*
See merge request GNOME/glib!2090
Helps: #2399
2021-05-10 09:50:07 +00:00
Руслан Ижбулатов
d270d5b615
Use SHGetKnownFolderPath() on Windows
...
SHGetSpecialFolderLocation() can cause 200ms delays when getting some
folder locations.
Also, use SHGetKnownFolderPath() normally, without loading it at runtime,
since GLib is Windows 7-or-later now.
Fixes #2397
2021-05-07 12:33:51 +00:00
Geyslan G. Bem
8cc03f8cd8
docs: Standardize spelling of serializ*
...
Changes serialis* to serializ* as proposed in #2399 .
Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-07 08:51:22 -03:00
Sebastian Dröge
0c259e9fbb
Merge branch 'fix_more_warnings' into 'master'
...
Fix more warnings
See merge request GNOME/glib!2088
2021-05-07 06:49:26 +00:00
Emmanuel Fleury
9656e606d2
Fix cast to smaller integer type warning in glib/gscanner.c
...
glib/gscanner.c:1681:13: warning: cast to smaller integer type 'GTokenType' from 'gpointer' (aka 'void *')
*token_p = (GTokenType) value_p->v_symbol;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-05-06 23:07:04 +02:00
Emmanuel Fleury
83d46f6a0a
Fix missing field initializer in glib/deprecated/gthread.h
...
glib/deprecated/gthread-deprecated.c:473:42: warning: missing field 'unused' initializer
static const GStaticMutex init_mutex = G_STATIC_MUTEX_INIT;
^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
^
glib/deprecated/gthread-deprecated.c:659:45: warning: missing field 'unused' initializer
static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
^
glib/deprecated/gthread.h:170:35: note: expanded from macro 'G_STATIC_REC_MUTEX_INIT'
^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
^
glib/deprecated/gthread-deprecated.c:959:42: warning: missing field 'unused' initializer
static const GStaticRWLock init_lock = G_STATIC_RW_LOCK_INIT;
^
glib/deprecated/gthread.h:206:33: note: expanded from macro 'G_STATIC_RW_LOCK_INIT'
^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
^
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
e3453f39dd
Fix missing initializer in gio/tests/fake-service-name.c
...
gio/tests/fake-service-name.c:55:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
55 | };
| ^
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
00a15152f3
Fix signedness warning in tests/memchunks.c
...
tests/memchunks.c: In function ‘old_mem_chunk_new’:
tests/memchunks.c:140:35: error: comparison of integer expressions of different signedness: ‘gulong’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
140 | g_return_val_if_fail (area_size >= atom_size, NULL);
| ^~
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
53157f32b9
Fix several signedness warnings in tests/unicode-encoding.c
...
tests/unicode-encoding.c: In function ‘process’:
tests/unicode-encoding.c:140:38: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
140 | if (!ucs4_result || items_read == strlen (utf8))
| ^~
tests/unicode-encoding.c:161:15: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
161 | items_read != strlen (utf8) ||
| ^~
tests/unicode-encoding.c:198:18: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
198 | items_written != strlen (utf8))
| ^~
tests/unicode-encoding.c:260:22: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
260 | if (items_read != strlen (utf8) ||
| ^~
tests/unicode-encoding.c:294:18: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
294 | items_written != strlen (utf8))
| ^~
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
951105fae5
Fix several signedness warnings in tests/threadpool-test.c
...
tests/threadpool-test.c: In function ‘test_thread_sort’:
tests/threadpool-test.c:283:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
283 | for (i = 0; i < limit; i++) {
| ^
tests/threadpool-test.c:296:50: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
296 | g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/threadpool-test.c:296:3: note: in expansion of macro ‘g_assert’
296 | g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
| ^~~~~~~~
tests/threadpool-test.c:297:50: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
297 | g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/threadpool-test.c:297:3: note: in expansion of macro ‘g_assert’
297 | g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
| ^~~~~~~~
tests/threadpool-test.c: In function ‘test_thread_idle_time’:
tests/threadpool-test.c:355:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
355 | for (i = 0; i < limit; i++) {
| ^
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
3951ccffae
Fix signedness warning in tests/thread-test.c
...
tests/thread-test.c: In function ‘test_g_static_private’:
tests/thread-test.c:214:60: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
214 | g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i * 3);
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/thread-test.c:214:5: note: in expansion of macro ‘g_assert’
214 | g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i * 3);
| ^~~~~~~~
2021-05-06 22:54:53 +02:00
Philip Withnall
45cc35c5cc
Merge branch 'fix_more_warnings' into 'master'
...
Fix more warnings
See merge request GNOME/glib!2081
2021-05-06 16:43:21 +00:00
Sebastian Dröge
730cc864ef
Merge branch 'jomccambridge-master-patch-47329' into 'master'
...
Update signal accumulator docs.
Closes #2352
See merge request GNOME/glib!2058
2021-05-06 14:00:19 +00:00
Emmanuel Fleury
5299ee541a
Fix signedness warning in tests/unicode-collate.c
...
tests/unicode-collate.c: In function ‘main’:
tests/unicode-collate.c:77:11: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
77 | if (argc > i)
| ^
2021-05-06 14:35:46 +02:00
Emmanuel Fleury
1d02b96655
Fix signedness warnings in tests/gio-test.c
...
tests/gio-test.c: In function ‘recv_message’:
tests/gio-test.c:172:24: error: comparison of unsigned expression in ‘>= 0’ is always true
172 | g_assert (nbytes >= 0 && nbytes < BUFSIZE);
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/gio-test.c:172:7: note: in expansion of macro ‘g_assert’
172 | g_assert (nbytes >= 0 && nbytes < BUFSIZE);
| ^~~~~~~~
tests/gio-test.c:188:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
188 | for (j = 0; j < nbytes; j++)
| ^
tests/gio-test.c:189:30: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’}
189 | g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/gio-test.c:189:13: note: in expansion of macro ‘g_assert’
189 | g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
| ^~~~~~~~
2021-05-06 14:35:20 +02:00
Emmanuel Fleury
4d3c741ddb
Fix several signedness warnings in tests/testglib.c
...
tests/testglib.c: In function ‘gnode_test’:
tests/testglib.c:302:34: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’}
302 | g_assert (P2C (node->data) == ('C' + i));
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/testglib.c:302:7: note: in expansion of macro ‘g_assert’
302 | g_assert (P2C (node->data) == ('C' + i));
| ^~~~~~~~
tests/testglib.c:306:76: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
306 | g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/testglib.c:306:5: note: in expansion of macro ‘g_assert’
306 | g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
| ^~~~~~~~
tests/testglib.c: In function ‘test_arrays’:
tests/testglib.c:1316:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
1316 | if (g_array_index (garray, gint, i) != i)
| ^~
tests/testglib.c:1324:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
1324 | if (g_array_index (garray, gint, i) != (100 - i - 1))
| ^~
2021-05-06 14:21:40 +02:00
Sebastian Dröge
7bfda46cc3
Merge branch 'wi24rd-master-patch-30504' into 'master'
...
gcredentials.h: Fix comment typo
See merge request GNOME/glib!2085
2021-05-06 07:04:43 +00:00
王滋涵 Zephyr Wang
940f9b497d
gcredentials.h: Fix comment typo
2021-05-06 02:42:21 +00:00
Carlos Garcia Campos
7e428aa4e5
guri: always apply the remove dot segments algorithm
...
And not only when g_uri_parse_relative() is called with a base uri. This
follows the spec and it's compatible with SoupURI.
Fixes #2342
2021-05-05 15:13:16 +02:00
Emmanuel Fleury
65d93a16ab
Fix several signedness warnings in tests/testglib.c
...
tests/testglib.c: In function ‘glist_test’:
tests/testglib.c:90:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
90 | if (*((gint*) t->data) != (9 - i))
| ^~
tests/testglib.c:95:54: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
95 | if (g_list_position (list, g_list_nth (list, i)) != i)
| ^~
tests/testglib.c:112:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
112 | if (*((gint*) t->data) != i)
| ^~
tests/testglib.c:130:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
130 | if (*((gint*) t->data) != (9 - i))
| ^~
tests/testglib.c:150:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
150 | if (*((gint*) t->data) != (9 - i))
| ^~
tests/testglib.c: In function ‘gslist_test’:
tests/testglib.c:170:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
170 | if (*((gint*) st->data) != (9 - i))
| ^~
tests/testglib.c:188:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
188 | if (*((gint*) st->data) != i)
| ^~
tests/testglib.c:206:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
206 | if (*((gint*) st->data) != (9 - i))
| ^~
tests/testglib.c:226:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
226 | if (*((gint*) st->data) != (9 - i))
| ^~
2021-05-04 16:13:41 +02:00