Commit Graph

22510 Commits

Author SHA1 Message Date
Руслан Ижбулатов
d33c3747dc GWin32AppInfo: invert verb comparison function
The list is sorted in ascending order, which means that to put
verbs alphabetically we need to sort ealier verbs with -1. Same for
the "open" verb and the preferred verb (if any).
2020-12-23 01:46:33 +00:00
Руслан Ижбулатов
48d96b21f9 GWin32AppInfo: enforce chosen handler on UWP apps, use URI verbs
* UWP apps that have low registry footprint might end up with chosen_handler == NULL.
Ensure that this doesn't happen.
* UWP apps don't need verbs for URIs, but we do need verbs to have a link to an app
(since handlers don't contain app fields). Work around this by adding an "open" verb
to each UWP URI handler.
* Duplicate the code that inserts extension handler verbs into the app to also insert
URI handler verbs. This allows URI-only apps to be used correctly later on (otherwise
GLib errors out, saying that the app has no verbs).
2020-12-23 01:46:11 +00:00
Руслан Ижбулатов
a2f823113c GWin32AppInfo: read UWP handler metadata (indirect strings)
Have to use of SHLoadIndirectString() from shell32.dll for this, no
way around that.
2020-12-23 01:46:10 +00:00
Руслан Ижбулатов
a2c287bf9f GWin32AppInfo: be less picky about names
Use pretty name as the result of _name(), if available. This is
more in line with what .desktop files return. Canonical name
may be completely unintelligible.
2020-12-23 01:45:20 +00:00
Руслан Ижбулатов
e7a738711b GWin32AppInfo: be more permissive about verbs in capable apps
MSDN doesn't say much on this subject, but i've seen apps in the wild
that have the "shell" subkey with verbs *either* in the root app key *or*
in the "Capabilities" subkey of the root key. Accommodate either case by trying both
(root key gets a priority, since this is how MS Address Book is registered -
assume that MS knows how to do this the right way).
2020-12-23 01:44:47 +00:00
Руслан Ижбулатов
10def41dc5 GWin32AppInfo: simplify appinfo wait condition 2020-12-23 01:44:34 +00:00
Руслан Ижбулатов
4c3a61e221 GWin32AppInfo: use g_new() instead of g_malloc() 2020-12-23 01:43:39 +00:00
Руслан Ижбулатов
f28b75e9ff GWin32AppInfo: Support launching UWP applications 2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
0ea2f34723 GWin32AppInfo: more checks for UWP apps
UWP apps have no exectuables or commandlines. Check for that.
2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
720b51032c GWin32AppInfo: Support getting information about UWP apps 2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
e9b09911f6 gio: Add g_win32_package_parser_enum_packages()
This function enumerates all user-accessible UWP packages
and calls the user-provided callback for each package.

This can be used to make GLib aware of the UWP applications
installed in the system.

The function works by using IPackageManager/IPackage UWP interfaces
and XmlLite COM library to parse package manifests.

The function requires COM, and initializes it to a single-thread
appartment model. To ensure this doesn't break anything, either
only use it in a separate thread (COM is initialized on a per-thread
basis), or make sure that the main thread also uses the same COM
model (it's OK to initialize COM multiple times, as long as the same
model is used and as long as init/uninit calls are paired correctly).
2020-12-23 01:43:38 +00:00
Philip Withnall
37ec6f1da7 docs: Ignore new win32 private headers
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-23 01:43:37 +00:00
Руслан Ижбулатов
2773c06bd4 gio: Add private headers with missing UWP/COM types
MinGW-w64 lacks the appropriate headers, so we have to add them
here. Note that these only have the C versions (normally these
things come in both C and C++ flavours), since that's what we use.

Also note that some of the functions that we don't use (but must
describe to maintain binary compatibility) were altered to use
IUnknown (basically, an untyped pointer) instead of the appropriate
object types, as adding these types would require other types,
which would pull even more types, forcing us to drag half of the
UWP headers in here. By replacing unused types with IUnknown we
can trim a lot of branches from the dependency graph.
2020-12-23 01:35:51 +00:00
Руслан Ижбулатов
895fc2eff2 gio: add GWin32FileSyncStream
This is a COM object that implements IStream by using a HANDLE
and WinAPI file functions to access the file (only a file; pipes
are not supported). Only supports synchronous access (this is
a feature - the APIs that read from this stream internally will
never return the COM equivalent of EWOULDBLOCK, which greatly
simplifies their use).
2020-12-23 01:35:39 +00:00
Руслан Ижбулатов
fdfa9236a2 GWin32AppInfo: Store UWP AppUserModelId for a handler
Could be used later on to launch UWP apps.

UWP apps need verbs, but we don't have any code to get UWP app
info yet.
2020-12-23 01:33:28 +00:00
Руслан Ижбулатов
e1bf1c2711 GWin32AppInfo: Recognize UWP applications 2020-11-18 15:21:03 +00:00
Руслан Ижбулатов
6931edc28f Plug a leak 2020-11-18 15:20:38 +00:00
Emmanuele Bassi
6e9ed964c3 Merge branch 'task-trace' into 'master'
Add some tracing to GTask

See merge request GNOME/glib!1629
2020-11-18 13:53:41 +00:00
Emmanuele Bassi
6fdc4fafa6 Merge branch '1833-buildtype-docs' into 'master'
docs: Clarify the meaning of --buildtype=plain a little

Closes #1833

See merge request GNOME/glib!1763
2020-11-18 13:42:37 +00:00
Philip Withnall
c33de0dc5f docs: Clarify the meaning of --buildtype=plain a little
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1833
2020-11-18 13:29:11 +00:00
Sebastian Dröge
56cbdb1a66 Merge branch 'fix_warnings' into 'master'
Fix warnings

See merge request GNOME/glib!1758
2020-11-18 11:53:59 +00:00
Emmanuel Fleury
40e70f5d94 Fix several signedness warnings in glib/tests/uri.c
In file included from glib/glib.h:86,
                 from glib/tests/uri.c:25:
glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GConvertError’
  134 |                                                if (!err || (err)->domain != dom || (err)->code != c) \
      |                                                                                                ^~
glib/tests/uri.c:182:9: note: in expansion of macro ‘g_assert_error’
  182 |         g_assert_error (error, G_CONVERT_ERROR, file_to_uri_tests[i].expected_error);
      |         ^~~~~~~~~~~~~~
glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GConvertError’
  134 |                                                if (!err || (err)->domain != dom || (err)->code != c) \
      |                                                                                                ^~
glib/tests/uri.c:220:9: note: in expansion of macro ‘g_assert_error’
  220 |         g_assert_error (error, G_CONVERT_ERROR, file_from_uri_tests[i].expected_error);
      |         ^~~~~~~~~~~~~~
glib/tests/uri.c: In function ‘test_uri_parsing_absolute’:
glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GUriError’
  134 |                                                if (!err || (err)->domain != dom || (err)->code != c) \
      |                                                                                                ^~
glib/tests/uri.c:790:11: note: in expansion of macro ‘g_assert_error’
  790 |           g_assert_error (error, G_URI_ERROR, test->expected_error_code);
      |           ^~~~~~~~~~~~~~
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/galloca.h:32,
                 from glib/glib.h:30,
                 from glib/tests/uri.c:25:
glib/tests/uri.c: In function ‘test_uri_iter_params’:
glib/tests/uri.c:1495:51: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘const long int’} and ‘long unsigned int’
 1495 |                 params_tests[i].expected_n_params <= G_N_ELEMENTS (params_tests[i].expected_param_key_values) / 2);
      |                                                   ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/tests/uri.c:1494:7: note: in expansion of macro ‘g_assert’
 1494 |       g_assert (params_tests[i].expected_n_params < 0 ||
      |       ^~~~~~~~
glib/tests/uri.c: In function ‘test_uri_parse_params’:
glib/tests/uri.c:1562:51: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘const long int’} and ‘long unsigned int’
 1562 |                 params_tests[i].expected_n_params <= G_N_ELEMENTS (params_tests[i].expected_param_key_values) / 2);
      |                                                   ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/tests/uri.c:1561:7: note: in expansion of macro ‘g_assert’
 1561 |       g_assert (params_tests[i].expected_n_params < 0 ||
      |       ^~~~~~~~
2020-11-18 12:30:44 +01:00
Philip Withnall
fe5217bc2b Merge branch 'master' into 'master'
add __APPLE__ to the list of operating systems that can use sysconf() to get open file limits

Closes #2253

See merge request GNOME/glib!1759
2020-11-18 11:02:01 +00:00
Philip Withnall
c16e1db576 Merge branch 'appinfo-shellany-thread-pool' into 'master'
GWin32AppInfo: Use a thread pool for async appinfo tree rebuilds

See merge request GNOME/glib!1754
2020-11-18 09:38:24 +00:00
Emmanuel Fleury
e457df8b8b Fix several signedness warnings in glib/tests/uri.c
glib/tests/uri.c: In function ‘run_file_to_uri_tests’:
glib/tests/uri.c:172:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  172 |   for (i = 0; i < G_N_ELEMENTS (file_to_uri_tests); i++)
      |                 ^
glib/tests/uri.c: In function ‘run_file_from_uri_tests’:
glib/tests/uri.c:197:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  197 |   for (i = 0; i < G_N_ELEMENTS (file_from_uri_tests); i++)
      |                 ^
glib/tests/uri.c: In function ‘run_file_roundtrip_tests’:
glib/tests/uri.c:276:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  276 |   for (i = 0; i < G_N_ELEMENTS (file_to_uri_tests); i++)
      |                 ^
glib/tests/uri.c: In function ‘test_uri_parse_params’:
glib/tests/uri.c:1594:25: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘const long int’}
 1594 |           for (j = 0; j < params_tests[i].expected_n_params; j += 2)
      |                         ^
2020-11-18 10:26:12 +01:00
Matt Rose
b23811a234 add __APPLE__ to the list of operating systems that can use sysconf() to get open file limits 2020-11-17 14:42:06 -05:00
Руслан Ижбулатов
427d4fad24 GWin32AppInfo: Use a thread for async appinfo tree rebuilds 2020-11-17 18:11:56 +00:00
Emmanuel Fleury
8aa6e39cc0 Fix several missing initializers in glib/tests/uri.c
glib/tests/uri.c:40:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   40 |   { "/etc", NULL, "file:///etc"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:41:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   41 |   { "/etc", "", "file:///etc"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:42:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   42 |   { "/etc", "otherhost", "file://otherhost/etc"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:51:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   51 |   { "/etc", "localhost", "file://localhost/etc"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:58:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   58 |   { "/etc/\xE5\xE4\xF6", NULL, "file:///etc/%E5%E4%F6" },
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:59:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   59 |   { "/etc/\xC3\xB6\xC3\xA4\xC3\xA5", NULL, "file:///etc/%C3%B6%C3%A4%C3%A5"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:63:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   63 |   { "/etc/file with #%", NULL, "file:///etc/file%20with%20%23%25"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:68:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   68 |   { "/0123456789", NULL, "file:///0123456789"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:69:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   69 |   { "/ABCDEFGHIJKLMNOPQRSTUVWXYZ", NULL, "file:///ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:70:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   70 |   { "/abcdefghijklmnopqrstuvwxyz", NULL, "file:///abcdefghijklmnopqrstuvwxyz"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:71:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   71 |   { "/-_.!~*'()", NULL, "file:///-_.!~*'()"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:77:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   77 |   { "/\"#%<>[\\]^`{|}\x7F", NULL, "file:///%22%23%25%3C%3E%5B%5C%5D%5E%60%7B%7C%7D%7F"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:79:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   79 |   { "/;@+$,", NULL, "file:///%3B@+$,"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:83:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   83 |   { "/:", NULL, "file:///:"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:84:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   84 |   { "/?&=", NULL, "file:///%3F&="},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:86:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   86 |   { "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:87:3: error: missing initializer for field ‘expected_error’ of ‘FileToUriTest’
   87 |   { "/", "abcdefghijklmnopqrstuvwxyz", "file://abcdefghijklmnopqrstuvwxyz/"},
      |   ^
glib/tests/uri.c:35:17: note: ‘expected_error’ declared here
   35 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:108:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’
  108 |   { "file:///etc", "/etc"},
      |   ^
glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here
  102 |   char *expected_hostname;
      |         ^~~~~~~~~~~~~~~~~
glib/tests/uri.c:109:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’
  109 |   { "file:/etc", "/etc"},
      |   ^
glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here
  102 |   char *expected_hostname;
      |         ^~~~~~~~~~~~~~~~~
glib/tests/uri.c:119:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  119 |   { "file://localhost/etc", "/etc", "localhost"},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:120:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  120 |   { "file://localhost/etc/%23%25%20file", "/etc/#% file", "localhost"},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:121:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  121 |   { "file://localhost/\xE5\xE4\xF6", "/\xe5\xe4\xf6", "localhost"},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:122:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  122 |   { "file://localhost/%E5%E4%F6", "/\xe5\xe4\xf6", "localhost"},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:124:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  124 |   { "file://otherhost/etc", "/etc", "otherhost"},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:125:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  125 |   { "file://otherhost/etc/%23%25%20file", "/etc/#% file", "otherhost"},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:127:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  127 |   { "file:////etc/%C3%B6%C3%C3%C3%A5", "//etc/\xc3\xb6\xc3\xc3\xc3\xa5", NULL},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:135:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’
  135 |   { "file:////etc", "//etc"},
      |   ^
glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here
  102 |   char *expected_hostname;
      |         ^~~~~~~~~~~~~~~~~
glib/tests/uri.c:136:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’
  136 |   { "file://///etc", "///etc"},
      |   ^
glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here
  102 |   char *expected_hostname;
      |         ^~~~~~~~~~~~~~~~~
glib/tests/uri.c:147:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’
  147 |   { "file:///c:\\foo", "/c:\\foo"},
      |   ^
glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here
  102 |   char *expected_hostname;
      |         ^~~~~~~~~~~~~~~~~
glib/tests/uri.c:148:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’
  148 |   { "file:///c:/foo", "/c:/foo"},
      |   ^
glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here
  102 |   char *expected_hostname;
      |         ^~~~~~~~~~~~~~~~~
glib/tests/uri.c:149:3: error: missing initializer for field ‘expected_hostname’ of ‘FileFromUriTest’
  149 |   { "file:////c:/foo", "//c:/foo"},
      |   ^
glib/tests/uri.c:102:9: note: ‘expected_hostname’ declared here
  102 |   char *expected_hostname;
      |         ^~~~~~~~~~~~~~~~~
glib/tests/uri.c:152:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  152 |   { "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/", "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
glib/tests/uri.c:153:3: error: missing initializer for field ‘expected_error’ of ‘FileFromUriTest’
  153 |   { "file://abcdefghijklmnopqrstuvwxyz/", "/", "abcdefghijklmnopqrstuvwxyz"},
      |   ^
glib/tests/uri.c:103:17: note: ‘expected_error’ declared here
  103 |   GConvertError expected_error; /* If failed */
      |                 ^~~~~~~~~~~~~~
2020-11-17 18:47:17 +01:00
Sebastian Dröge
1b7509c09b Merge branch 'fix_warnings' into 'master'
Fix warnings

See merge request GNOME/glib!1750
2020-11-17 17:20:01 +00:00
Emmanuel Fleury
766e6325ac Fix several signedness warnings in glib/tests/timer.c
glib/tests/timer.c: In function ‘test_timeval_from_iso8601’:
glib/tests/timer.c:220:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  220 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
glib/tests/timer.c: In function ‘test_timeval_to_iso8601’:
glib/tests/timer.c:260:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  260 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
2020-11-17 17:25:13 +01:00
Emmanuel Fleury
4c1b068657 Extend the documentation of g_sequence_get_length()
The return value of g_sequence_get_length() is always a
positive number.
2020-11-17 17:25:13 +01:00
Emmanuel Fleury
89729bcd28 Fix several signedness warnings in glib/tests/sequence.c
glib/tests/sequence.c: In function ‘check_integrity’:
glib/tests/sequence.c:139:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  139 |   g_assert (info->n_items == g_queue_get_length (info->queue));
      |                           ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/tests/sequence.c:139:3: note: in expansion of macro ‘g_assert’
  139 |   g_assert (info->n_items == g_queue_get_length (info->queue));
      |   ^~~~~~~~
glib/tests/sequence.c:157:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  157 |   g_assert (info->n_items == g_queue_get_length (info->queue));
      |                           ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/tests/sequence.c:157:3: note: in expansion of macro ‘g_assert’
  157 |   g_assert (info->n_items == g_queue_get_length (info->queue));
      |   ^~~~~~~~
glib/tests/sequence.c: In function ‘run_random_tests’:
glib/tests/sequence.c:554:55: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  554 |             g_assert (g_queue_get_length (seq->queue) == g_sequence_get_length (seq->sequence));
      |                                                       ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/tests/sequence.c:554:13: note: in expansion of macro ‘g_assert’
  554 |             g_assert (g_queue_get_length (seq->queue) == g_sequence_get_length (seq->sequence));
      |             ^~~~~~~~
glib/tests/sequence.c: In function ‘main’:
glib/tests/sequence.c:1404:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1404 |   for (i = 0; i < G_N_ELEMENTS (seeds); ++i)
      |                 ^
2020-11-17 17:25:03 +01:00
Philip Withnall
053d2ae2b4 Merge branch '2046-add-shellcheck-pylint-in-ci' into 'master'
resolve "Add pylint and shellcheck CI checks"

Closes #2046

See merge request GNOME/glib!1743
2020-11-17 14:23:17 +00:00
Emmanuel Fleury
82be350f59 Fix signedness warnings in glib/tests/shell.c
glib/tests/shell.c: In function ‘main’:
glib/tests/shell.c:194:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  194 |   for (i = 0; i < G_N_ELEMENTS (cmdline_tests); i++)
      |                 ^
glib/tests/shell.c:201:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  201 |   for (i = 0; i < G_N_ELEMENTS (quote_tests); i++)
      |                 ^
glib/tests/shell.c:208:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  208 |   for (i = 0; i < G_N_ELEMENTS (unquote_tests); i++)
      |                 ^
2020-11-17 14:12:53 +01:00
Emmanuel Fleury
f4bfc50db3 Fix signedness warnings in glib/tests/slice.c
glib/tests/slice.c: In function ‘test_allocate’:
glib/tests/slice.c:146:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  146 |   for (i = 0; i < G_N_ELEMENTS(threads); i++)
      |                 ^
glib/tests/slice.c:149:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  149 |   for (i = 0; i < G_N_ELEMENTS(threads); i++)
      |                 ^
2020-11-17 14:12:53 +01:00
Emmanuel Fleury
fcbd9d6d75 Fix signedness warning in glib/tests/spawn-singlethread.c
glib/tests/spawn-singlethread.c: In function ‘test_spawn_async_with_fds’:
glib/tests/spawn-singlethread.c:204:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  204 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
2020-11-17 14:12:53 +01:00
Emmanuel Fleury
f5b2b8132d Fix signedness warning in glib/guri.c
glib/guri.c: In function ‘should_normalize_empty_path’:
glib/guri.c:756:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  756 |   for (i = 0; i < G_N_ELEMENTS (schemes); ++i)
      |                 ^
2020-11-17 14:12:53 +01:00
Sebastian Dröge
c3388932fd Merge branch 'cmpstrv-null-check' into 'master'
Minor Coverity fixes

See merge request GNOME/glib!1755
2020-11-17 11:01:30 +00:00
Philip Withnall
51f322b74c tests: Add missing assertion to guard against infinite loop
Since the loop variable changed signedness, it’s now possible for there
to be an infinite loop if `get_match_count()` returns an error. Guard
against that.

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

Coverity CID: #1436405
2020-11-17 10:38:12 +00:00
Philip Withnall
065dea99f4 gtestutils: Drop unnecessary NULL check
The macro wrapper to `g_assertion_message_cmpstrv()` makes sure that
neither array is `NULL`, so there’s no need for a second `NULL` check.
Additionally, this check happens after the arrays have already been
dereferenced, at which point the program would have crashed if the
arrays were `NULL`.

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

Coverity CID: #1436406, #1436407
2020-11-17 10:31:59 +00:00
Frederic Martinsons
bafc7cf1b1 Remove sanity_check script unused for years.
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-11-15 17:34:27 +01:00
Frederic Martinsons
e817a049f0 Correct shellcheck errors (and ignore world splitting when we want it)
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-11-15 17:34:27 +01:00
Frederic Martinsons
8f45fbdadd add 2 new stages: sh-check (which run shellcheck) and py-check (which run black and flake8)
The debian docker have been modified to install these tools.

Closes #2046

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-11-15 17:34:21 +01:00
Yuri Chornoivan
bb4d9e8c6d Update Ukrainian translation 2020-11-15 07:55:38 +00:00
Sebastian Dröge
728c591d76 Merge branch '1560-converter-zero-size' into 'master'
gresource: Fix handling of zero-sized compressed resource entries

Closes #1560

See merge request GNOME/glib!1752
2020-11-14 21:35:18 +00:00
Sebastian Dröge
94942bce2b Merge branch '1849-g-set-object-docs' into 'master'
gobject: Clarify documentation and annotations of g_set_object()

Closes #1849

See merge request GNOME/glib!1753
2020-11-14 21:33:46 +00:00
Philip Withnall
a65fe37e5c gobject: Clarify documentation and annotations of g_set_object()
Heavily based on changes suggested by Дилян Палаузов.

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

Fixes: #1849
2020-11-14 20:35:09 +00:00
Matthias Clasen
e53e8b28dd gio: Add some tracing to GTask
Set counters for the number of running tasks and
for the max. threadpool size. These are meant to
get a sense for whether G_TASK_POOL_SIZE and related
constants are still suitable for current gio and
GTask usage patterns.
2020-11-14 19:04:45 +00:00
Matthias Clasen
89d45c7f6a gio: Include sysprof tracing support
Include gtrace.c in the sources, so we can
use the same g_trace_ apis in GIO when sysprof
support is enabled.
2020-11-14 19:04:45 +00:00
Matthias Clasen
d4cb76f3d3 Make the gtrace-private.h header usable in gio
Don't include glib-private headers here, so we can
share this.
2020-11-14 19:04:45 +00:00