Commit Graph

24250 Commits

Author SHA1 Message Date
Marc-André Lureau
b26855579c gio: fix GFile doc indentation and nullable annotations
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>
2021-10-25 12:57:13 +01:00
Marc-André Lureau
3a6e8bc887 gio: check the given child name is not an absolute path
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>
2021-10-25 12:57:13 +01:00
Marc-André Lureau
1df7c2ea80 gio: document g_file_get_relative_path() with absolute path
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-10-25 12:57:13 +01:00
Philip Withnall
ac26e9d780 tests: Fix a typo in a test message in gdatetime.c
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-10-25 12:56:16 +01:00
Goran Vidović
8f417138bb Update Croatian translation 2021-10-24 19:38:43 +00:00
Philip Withnall
ceb23e9f00 Merge branch 'XDG_RUNTIME_DIR_mkdir' into 'main'
mkdir path specified by XDG_RUNTIME_DIR

See merge request GNOME/glib!2290
2021-10-22 11:23:46 +00:00
Egor Bychin
5484bf1cef gutils: Add a comment specifying reason of omitting g_mkdir 2021-10-22 12:04:13 +01:00
Philip Withnall
464470dd8f Merge branch '2507-file-enumerator-docs' into 'main'
gfileenumerator: Warn if name is not available for get_child()

Closes #2507

See merge request GNOME/glib!2307
2021-10-21 11:58:32 +00:00
Philip Withnall
2602e0f1aa Merge branch 'drop-pamconsole' into 'main'
gunixmounts: Drop references to pamconsole mount option

See merge request GNOME/glib!2306
2021-10-21 11:49:06 +00:00
Philip Withnall
b6424b5ce1 gfileenumerator: Warn if name is not available for get_child()
`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
2021-10-21 12:23:06 +01:00
Philip Withnall
e508a0a8df gfileenumerator: Upgrade existing warning to critical warning
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
2021-10-21 12:23:06 +01:00
Philip Withnall
0630272388 gfileenumerator: Add missing precondition to get_child()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2507
2021-10-21 12:23:06 +01:00
Philip Withnall
9b1b04587c gunixmounts: Drop references to pamconsole mount option
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>
2021-10-21 12:22:54 +01:00
Emmanuele Bassi
422f744367 Merge branch 'fix-win32-warnings' into 'main'
gthread-win32: Remove an unnecessary volatile qualifier

See merge request GNOME/glib!2308
2021-10-21 11:17:40 +00:00
Philip Withnall
ee867a3c63 gthread-win32: Remove an unnecessary volatile qualifier
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-10-21 12:01:33 +01:00
Philip Withnall
9784f31527 Merge branch 'fix_more_windows_warnings' into 'main'
Fix more windows warnings

See merge request GNOME/glib!2303
2021-10-20 15:30:50 +00:00
Emmanuel Fleury
db5a9d8397 Fix signedness warning in gio/gsocket.c
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;
                                                                            ^~
2021-10-20 17:09:50 +02:00
Emmanuel Fleury
23e9017aff Fix signedness warning in gio/win32/gwinhttpfile.c
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))
             ^~
2021-10-19 18:44:38 +02:00
Emmanuel Fleury
a16d6398d7 Fix signedness warning in gio/win32/gwin32fsmonitorutils.c
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)
           ^~
2021-10-19 18:44:38 +02:00
Emmanuel Fleury
059dc76ae1 Fix signedness warnings in gio/win32/gwinhttpvfs.c
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++)
                 ^
2021-10-19 18:44:38 +02:00
Emmanuel Fleury
2f2e021a56 Fix signedness warnings in glib/gwin32.c
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)
                                         ^~
2021-10-19 18:44:38 +02:00
Emmanuel Fleury
6971f4f264 Fix signedness warnings in glib/gtimezone.c
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 (&regtzi_prev, &regtzi, 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++)
                         ^
2021-10-19 18:44:20 +02:00
Philip Withnall
85969ce3da Merge branch 'main' into 'main'
#1331: buffer overflow fix

Closes #1331

See merge request GNOME/glib!2189
2021-10-19 15:38:13 +00:00
Mark Weaver
995823b9d9 #1331: buffer overflow fix 2021-10-19 15:38:13 +00:00
Emmanuel Fleury
c9b4b0e765 Fix signedness warning in glib/gthread-win32.c
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)
                                     ^~
2021-10-19 00:30:50 +02:00
Philip Withnall
e212c5a28d Merge branch 'fix_more_windows_warnings' into 'main'
Fix windows warnings

See merge request GNOME/glib!2294
2021-10-18 14:48:18 +00:00
Emmanuel Fleury
928be8b8bc Fix signedness warnings in glib/gstdio.c
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)
               ^
2021-10-18 14:23:31 +02:00
Emmanuel Fleury
b89967a14d Fix signedness warnings in glib/gpoll.c
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;
                                 ^~
2021-10-18 14:23:26 +02:00
Philip Withnall
aa729f0bbf Merge branch 'modern-nm-properties-changed' into 'main'
gio: Stop using deprecated NM PropertiesChanged signal

Closes #2505

See merge request GNOME/glib!2291
2021-10-18 12:15:51 +00:00
Philip Withnall
6e2de8fcb5 Merge branch 'msvc-asan-build' into 'main'
glib-private: Fix MSVC build with AddressSanitizer

See merge request GNOME/glib!2293
2021-10-18 12:09:44 +00:00
Philip Withnall
68295cb2fb Merge branch 'utf16-to-utf8-docs' into 'main'
gutf8: Document that out args from g_utf16_to_utf8() are non-negative

See merge request GNOME/glib!2295
2021-10-18 11:58:54 +00:00
Philip Withnall
c8e78f395b Merge branch 'fatal-meson-warnings' into 'main'
meson: fix warnings for extract_all_objects function

See merge request GNOME/glib!2286
2021-10-18 11:57:50 +00:00
Philip Withnall
2423419a29 Merge branch 'static-analysis' into 'main'
fix issues found by svace static code analyzer

See merge request GNOME/glib!2285
2021-10-18 11:03:33 +00:00
Eli Schwartz
abb8e1c3a0 meson: fix warnings for extract_all_objects function
The "recursive:" kwarg is available in the targeted minimum version of
meson, and is basically required if you want to not emit warnings and
maybe error with --fatal-meson-warnings.

There are two basic solutions to this problem:

- The current default behavior is false, so explicitly opt in to that
  value. None of these internal libraries use recursive objects anyway.

- Use link_with to link to the static library directly, rather than the
  extracted objects.

Option 2 is what used to be done before commit
62af03bda8, but it only works with meson
>=0.52 and previously had buggy behavior.

Since the minimum version of meson is now 0.52, it is safe to revert
that commit and go back to using link_with, and therefore option 2 is
chosen.
2021-10-18 11:50:49 +01:00
Philip Withnall
6163c2c3fe Merge branch 'update-ci' into 'main'
ci: Update CI images to latest stable Debian and Fedora, bump Meson dependency to 0.52

See merge request GNOME/glib!2287
2021-10-18 10:48:31 +00:00
Egor Bychin
9f1c59eef2 add OOM handling in mimemagic 2021-10-15 14:15:43 +03:00
Egor Bychin
5419228f63 gtype: Fix pointer being dereferenced despite NULL check 2021-10-15 14:15:43 +03:00
Egor Bychin
7f6ce4d8d2 gvariant: Fix pointers being dereferenced despite NULL checks 2021-10-15 14:15:43 +03:00
Egor Bychin
05dffc1a7f gvariant: Fix memory leak on a TYPE_CHECK failure 2021-10-15 14:15:43 +03:00
Egor Bychin
0abf51e0de gslice: Fix page size being limited to int instead of gsize 2021-10-15 14:15:43 +03:00
Egor Bychin
5a61f8b922 gmessages: Add check for a localtime function return value 2021-10-15 14:15:43 +03:00
Egor Bychin
a3f81a2ef5 gkeyfile: Remove unreachable code 2021-10-15 14:15:43 +03:00
Egor Bychin
e9adcd8f7f gbacktrace: Fix fcntl command arguments not being checked 2021-10-15 14:15:43 +03:00
Egor Bychin
b32727d43d gsocks5proxy: Fix buffer overflow on a really long domain name 2021-10-15 14:15:43 +03:00
Egor Bychin
328bd31631 gsocket: Add ignorant of an fcntl return value 2021-10-15 14:15:43 +03:00
Egor Bychin
cdb9762072 gsettings-mapping: Fix HANDLE being treated as unsigned 2021-10-15 14:15:43 +03:00
Egor Bychin
a50e605d52 gproxyaddressenumerator: Fix string leakage on an invalid input 2021-10-15 14:15:43 +03:00
Egor Bychin
9dc7475f93 gopenuriportal: Fix GVariantBuilder and string leakage on g_open failure 2021-10-15 14:15:38 +03:00
Emmanuel Fleury
d16d780bf4 Fix signedness warning in glib/win_iconv.c
glib/win_iconv.c: In function 'iso2022jp_mbtowc':
glib/win_iconv.c:1818:18: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int'
     if (cv->mode != ISO2022_MODE(cs, shift))
                  ^~
glib/win_iconv.c: In function 'iso2022jp_wctomb':
glib/win_iconv.c:1889:18: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int'
     if (cv->mode == ISO2022_MODE(cs, shift))
                  ^~
2021-10-14 18:48:02 +02:00
Emmanuel Fleury
78af147721 Fix signedness warning in glib/gfileutils.c
glib/gfileutils.c: In function 'g_file_test':
glib/gfileutils.c:375:18: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int'
   if (attributes == INVALID_FILE_ATTRIBUTES)
                  ^~
glib/gfileutils.c: In function 'g_get_current_dir':
glib/gfileutils.c:2882:40: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int'
   if (GetCurrentDirectoryW (len, wdir) == len - 1)
                                        ^~
2021-10-14 18:42:07 +02:00