Move it further up the file, but make no changes to it. This will help
with a subsequent commit.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2400
This should ensure that all editors which support
https://editorconfig.org/ use 2-space indentation with spaces (not tabs)
by default.
This isn’t a full specification of the GLib coding style (see
https://gitlab.gnome.org/GNOME/gtk/blob/HEAD/docs/CODING-STYLE.md for
that), but is a correct subset of it.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This introduces no functional changes; it only simplifies the code.
Instead of maintaining a separate pointer to the backend iff it’s a
`GDelayedSettingsBackend`, just test the `backend` pointer’s type.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2426
Previously, the delay-apply status of the parent `GSettings` object
would be partially inherited: `settings->priv->backend` in the child
`GSettings` object would point to a `GDelayedSettingsBackend`, but
`settings->priv->delayed` would be `NULL`.
The expectation from https://bugzilla.gnome.org/show_bug.cgi?id=720891
was that `get_child()` would fully inherit delay-apply status.
So, ensure that `settings->priv->delayed` is correctly set to point to
the delayed backend when constructing any `GSettings`. Update the tests
to work again (presumably the inverted test was an oversight in the
original changes).
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2426
`g_settings_reset()` changes the value of the setting to `NULL`;
`add_to_tree()` was not handling that correctly.
Add a unit test.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2426
Add missing (nullable), and use 2-space indentation to avoid markdown
pre-formatted blocks when unwanted.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
As this would have undesirable consequence.
Quoting Philip Withnall:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2305#note_1294729:
The documentation never said anything about accepting absolute paths,
so any code which is relying on that is relying on undocumented
behaviour. We’re allowed to change that.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
`standard::name` must be available for `g_file_enumerator_get_child()`
to work. Emit a critical warning and return if it’s not. This is similar
to the existing behaviour in `g_file_enumerator_iterate()`.
Improve the documentation to mention this.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2507
The code cannot function correctly if the `standard::name` attribute is
not present, so upgrade the existing warning to a critical warning and
return if it fails in `g_file_enumerator_iterate()`.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2507
It was Red Hat specific when it was introduced in 2004, was never
supported by mount(8) upstream, and was removed entirely in 2008.
It’s confusing for GLib to keep references to it around.
Thanks to Karel Zak for digging up the history of it:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2298#note_1294519
And thanks to Xidorn Quan for looking into it in the first place (see
!2298).
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
gio/gsocket.c: In function 'g_socket_get_available_bytes':
gio/gsocket.c:3141:17: warning: comparison of integer expressions of different signedness: 'u_long' {aka 'long unsigned int'} and 'int'
if (avail == -1)
^~
gio/gsocket.c: In function 'g_socket_send_messages_with_timeout':
gio/gsocket.c:5283:19: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
for (i = 0; i < num_messages; ++i)
^
gio/gsocket.c:5308:76: warning: operand of ?: changes signedness from 'int' to 'gsize' {aka 'long long unsigned int'} due to unsignedness of other operand
result = pollable_result == G_POLLABLE_RETURN_OK ? bytes_written : -1;
^~
gio/win32/gwinhttpfile.c: In function 'g_winhttp_file_query_info':
gio/win32/gwinhttpfile.c:554:13: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long long unsigned int'}
n == wcslen (content_length))
^~
gio/win32/gwin32fsmonitorutils.c: In function 'g_win32_fs_monitor_handle_event':
gio/win32/gwin32fsmonitorutils.c:107:11: warning: comparison of integer expressions of different signedness: 'GFileMonitorEvent' {aka 'enum <anonymous>'} and 'int'
if (fme != -1)
^~
gio/win32/gwinhttpvfs.c: In function 'g_winhttp_vfs_get_file_for_uri':
gio/win32/gwinhttpvfs.c:172:17: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int'
for (i = 0; i < G_N_ELEMENTS (winhttp_uri_schemes); i++)
^
gio/win32/gwinhttpvfs.c: In function 'g_winhttp_vfs_get_supported_uri_schemes':
gio/win32/gwinhttpvfs.c:210:17: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int'
for (i = 0; i < G_N_ELEMENTS (winhttp_uri_schemes); i++)
^
glib/gwin32.c: In function 'g_win32_check_windows_version':
glib/gwin32.c:556:32: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'gint' {aka 'const int'}
if (osverinfo.dwMajorVersion > major)
^
glib/gwin32.c:558:37: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'gint' {aka 'const int'}
else if (osverinfo.dwMajorVersion == major)
^~
glib/gwin32.c:560:36: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'gint' {aka 'const int'}
if (osverinfo.dwMinorVersion > minor)
^
glib/gwin32.c:562:41: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'gint' {aka 'const int'}
else if (osverinfo.dwMinorVersion == minor)
^~
glib/gtimezone.c: In function 'rules_from_windows_time_zone':
glib/gtimezone.c:926:56: warning: comparison of integer expressions of different signedness: 'int' and 'DWORD' {aka 'long unsigned int'}
for (year = first, i = 0; *rules != NULL && year <= last; year++)
^~
glib/gtimezone.c:946:20: warning: comparison of integer expressions of different signedness: 'int' and 'DWORD' {aka 'long unsigned int'}
if (year > first && memcmp (®tzi_prev, ®tzi, sizeof regtzi) == 0)
^
glib/gtimezone.c: In function 'set_tz_name':
glib/gtimezone.c:1481:25: error: comparison of integer expressions of different signedness: 'int' and 'guint' {aka 'unsigned int'}
1481 | len = *pos - name_pos > size - 1 ? size - 1 : *pos - name_pos;
| ^
glib/gtimezone.c:1481:49: error: operand of '?:' changes signedness from 'int' to 'guint' {aka 'unsigned int'} due to unsignedness of other operand
1481 | len = *pos - name_pos > size - 1 ? size - 1 : *pos - name_pos;
| ^~~~~~~~~~~~~~~
glib/gtimezone.c: In function 'rules_from_identifier':
glib/gtimezone.c:1553:25: warning: comparison of integer expressions of different signedness: 'int' and 'guint' {aka 'unsigned int'}
for (i = 0; i < rules_num - 1; i++)
^
glib/gthread-win32.c: In function 'g_system_thread_new':
glib/gthread-win32.c:507:37: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int'
if (ResumeThread (thread->handle) == -1)
^~
glib/gstdio.c: In function '_g_win32_stat_utf8':
glib/gstdio.c:763:45: warning: comparison of integer expressions of different signedness: 'gsize' {aka 'long long unsigned int'} and 'long long int'
(g_path_is_absolute (filename) && len <= g_path_skip_root (filename) - filename))
^~
glib/gstdio.c: In function 'g_win32_readlink_utf8':
glib/gstdio.c:896:15: warning: comparison of integer expressions of different signedness: 'glong' {aka 'long int'} and 'gsize' {aka 'long long unsigned int'}
if (tmp_len > buf_size)
^
glib/gpoll.c: In function 'poll_rest':
../glib/gpoll.c:165:22: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'unsigned int'
if (timeout_ms == INFINITE)
^~
glib/gpoll.c:219:18: warning: comparison of unsigned expression >= 0 is always true
else if (ready >= WAIT_OBJECT_0 && ready < WAIT_OBJECT_0 + nhandles)
^~
glib/gpoll.c: In function 'poll_single_thread':
glib/gpoll.c:281:44: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'unsigned int'
if (retval == 0 && (data->timeout_ms == INFINITE || data->timeout_ms > 0))
^~
glib/gpoll.c: In function 'g_poll':
glib/gpoll.c:477:52: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int'
retval = retval == -1 ? -1 : thread_retval == -1 ? -1 : retval + thread_retval;
^~
glib/gpoll.c:477:60: warning: operand of ?: changes signedness from 'int' to 'long unsigned int' due to unsignedness of other operand
retval = retval == -1 ? -1 : thread_retval == -1 ? -1 : retval + thread_retval;
^~
glib/gpoll.c:477:33: warning: operand of ?: changes signedness from 'int' to 'long unsigned int' due to unsignedness of other operand
retval = retval == -1 ? -1 : thread_retval == -1 ? -1 : retval + thread_retval;
^~