Commit Graph

23974 Commits

Author SHA1 Message Date
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
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
Emmanuel Fleury
5471c13f65 Fix signedness warning in glib/gdate.c
glib/gdate.c: In function 'win32_strftime_helper':
glib/gdate.c:2582:12: warning: comparison of integer expressions of different signedness: 'gsize' {aka 'long long unsigned int'} and 'glong' {aka 'long int'}
   if (slen <= convlen)
            ^~
2021-10-14 18:40:32 +02:00
Philip Withnall
90b2ad80ee gutf8: Document that out args from g_utf16_to_utf8() are non-negative
Despite their type, the values returned will always be ≥ 0. It’s
unfortunate they weren’t declared with an unsigned type, but we can’t
change that now without breaking API.

Spotted in !2294.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-10-14 12:45:30 +01:00
Emmanuel Fleury
4ec06aa0c1 Fix missing initializer warning in glib/giowin32.c
glib/giowin32.c:1027:1: warning: missing initializer for field 'closure_callback' of 'GSourceFuncs' {aka 'struct _GSourceFuncs'}
 };
 ^
2021-10-13 18:38:59 +02:00
Emmanuel Fleury
a8a4bbf652 Fix signedness warning in glib/gspawn-win32.c
glib/gspawn-win32.c: In function 'read_helper_report':
glib/gspawn-win32.c:329:16: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'long long unsigned int'
   while (bytes < sizeof(gintptr)*2)
                ^
glib/gspawn-win32.c:366:13: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'long long unsigned int'
   if (bytes < sizeof(gintptr)*2)
             ^
2021-10-13 18:38:59 +02:00
Philip Withnall
f432ebf7d5 ci: Add -fstack-protector to mingw64 cross file
See the comment in the code. As suggested by Nirbheek:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2287#note_1285058.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-10-13 10:44:23 +01:00
Seungha Yang
a2f2745035 glib-private: Fix MSVC build with AddressSanitizer
MSVC supports AddressSanitizer as well via "/fsanitize=address" option,
but __lsan_ignore_object() equivalent feature is not supported.
Note that there's __declspec(no_sanitize_address) specifier which
provides a similar feature but that's not runtime behavior
so it's not directly applicable to g_ignore_leak() family.

See also https://docs.microsoft.com/en-us/cpp/sanitizers/asan-building?view=msvc-160
2021-10-13 18:18:08 +09:00
Philip Withnall
02a94a4e7e Merge branch 'fix_more_warnings' into 'main'
Fix more (Windows) warnings

See merge request GNOME/glib!2273
2021-10-13 08:49:06 +00:00
Emmanuel Fleury
cd04e0b7a4 Fix signedness warning in glib/gslice.c
glib/gslice.c: In function 'slice_config_init':
glib/gslice.c:394:16: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int'
   else if (len >= G_N_ELEMENTS (wvalue))
                ^~
2021-10-12 18:05:48 +02:00
Emmanuel Fleury
574842a12e Fix signedness warning in glib/genviron.c
glib/genviron.c: In function 'g_getenv':
glib/genviron.c:490:52: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int'
   if (GetEnvironmentVariableW (wname, wvalue, len) != len - 1)
                                                    ^~
glib/genviron.c:507:60: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int'
           if (ExpandEnvironmentStringsW (tem, wvalue, len) != len)
                                                            ^~
2021-10-12 18:05:48 +02:00
Emmanuel Fleury
affa41179a Fix signedness warning in glib/ghostutils.c
glib/ghostutils.c: In function 'punycode_encode':
glib/ghostutils.c:141:35: warning: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'glong' {aka 'long int'}
   for (j = num_basic_chars = 0; j < input_length; j++)
                                   ^
glib/ghostutils.c:158:24: warning: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'glong' {aka 'long int'}
   while (handled_chars < input_length)
                        ^
glib/ghostutils.c:161:36: warning: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'glong' {aka 'long int'}
       for (m = G_MAXUINT, j = 0; j < input_length; j++)
                                    ^
glib/ghostutils.c:172:21: warning: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'glong' {aka 'long int'}
       for (j = 0; j < input_length; j++)
                     ^
2021-10-12 18:05:48 +02:00
Emmanuel Fleury
74c3c5b75d Fix signedness warning in glib/gcharset.c
glib/gcharset.c:380:35: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int'
           else if (modifier - dot < sizeof (buf))
                                   ^
2021-10-12 18:05:48 +02:00
Emmanuel Fleury
33c2968669 Fix always false statement warning in glib/gdatetime.c
glib/gdatetime.c:896:27: warning: comparison is always false due to limited range of data type
   if ((gint64) tv->tv_sec > G_MAXINT64 - 1 ||
                           ^
2021-10-12 18:03:58 +02:00
Julian Andres Klode
643fc7ea49 gnetworkmonitornm: Do not re-update cached property
GDBusProxy already takes care of updating the cached property
before emitting the signal, so there is no need to do this
a second time ourselves.
2021-10-12 17:31:42 +02:00
Julian Andres Klode
f419966808 gnetworkmonitornm: Stop using removed PropertiesChanged signal
Use the org.freedesktop.DBus.Properties interface to listen
to PropertiesChanged signals on /org/freedesktop/NetworkManager.

NetworkManager used to provide its own legacy PropertiesChanged
signal, but that was dropped in
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/853

This requires NetworkManager >= 1.2 (2016)

Fixes: #2505
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1946196
2021-10-12 17:22:55 +02:00
Egor Bychin
e90eaff490 gmarshal-internal: Fix string leakage due to misplaced check 2021-10-11 13:59:05 +03:00
Egor Bychin
5a032f32ea glocalfileinfo: Fix atime/mtime mix due to bad copy/paste 2021-10-11 13:56:43 +03:00
Egor Bychin
16ce10eb3c glocalfile: Fix g_stat return value not being checked 2021-10-11 13:55:17 +03:00
Egor Bychin
84affed056 gdbusauthmechanismsha1: Fix pointer being freed after being NULLed 2021-10-11 13:54:07 +03:00
Egor Bychin
36531f7015 gcontenttype: Fix strchr failure leading to a NULL dereference 2021-10-11 13:52:26 +03:00