Commit Graph

24231 Commits

Author SHA1 Message Date
Ivaylo Dimitrov
f065497acf GDesktopAppInfo: Try to always correctly set id
Specs say that on Unix id should be desktop file id from the xdg menu
specification, however, currently code just uses basename of .desktop file.
Fix that by finding the .desktop file in all the desktop_file_dirs and use
basename only as a fallback.

See https://specifications.freedesktop.org/menu-spec/latest/go01.html#term-desktop-file-id
and https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s02.html#desktop-file-id

"To determine the ID of a desktop file, make its full path relative to the
$XDG_DATA_DIRS component in which the desktop file is installed, remove the
"applications/" prefix, and turn '/' into '-'."

Also, add unit test that verifies Desktop Id is being correctly set

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
2021-12-14 11:46:57 +00:00
Philip Withnall
62be185463 Merge branch 'moving_completion_tests' into 'main'
Move tests/completion-test.c to glib/tests/completion.c

See merge request GNOME/glib!2392
2021-12-14 11:37:46 +00:00
Emmanuel Fleury
cde56cfc70 Move tests/completion-test.c to glib/tests/completion.c
Helps issue #1434
2021-12-13 17:42:23 +01:00
Aurimas Černius
ce57cc1c02 Updated Lithuanian translation 2021-12-11 21:08:29 +02:00
Philip Withnall
67dad10fb8 Merge branch 'xlocale-musl' into 'main'
gstrfuncs: don't require nonstandard functions for USE_XLOCALE.

Closes #2553

See merge request GNOME/glib!2388
2021-12-10 13:05:53 +00:00
Daniel Șerbănescu
44397add95 Update Romanian translation
(cherry picked from commit 409326e1d4)
2021-12-10 10:19:51 +00:00
Érico Nogueira
4b2f342a22 gstrfuncs: don't require nonstandard functions for USE_XLOCALE.
Make it so USE_XLOCALE is set whenever newlocale() and uselocale() are
available. This way, we can still use the _g_snprintf() path for some
functions, and also use the *_l functions when they are available.

newlocale(3) are uselocale(3) part of POSIX 2008, while the *_l
functions being used are nonstandard glibc extensions. Gating all the
locale functionality behind them meant we were using fallbacks on non
glibc platforms unnecessarily.

Further changes to this code could add fallback for the non _l suffixed
number parsing functions, but that might be unnecessary complexity.

Fixes #2553
2021-12-09 18:20:07 -03:00
Sebastian Dröge
6c938587d9 Merge branch 'project-docs' into 'main'
docs: Update the README a little

See merge request GNOME/glib!2387
2021-12-09 16:17:59 +00:00
Philip Withnall
568291b371 docs: Update the README a little
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2021-12-09 13:30:23 +00:00
Sebastian Dröge
e3e3c02bd2 Merge branch 'readme-docs' into 'main'
docs: Add API documentation links to the README

See merge request GNOME/glib!2386
2021-12-08 15:37:45 +00:00
Philip Withnall
1acef5a4e4 docs: Add API documentation links to the README
Might make the API documentation a little easier to find from the GitLab
landing page for GLib.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-08 14:48:35 +00:00
Andika Triwidada
84464d82fa Update Indonesian translation 2021-12-05 04:11:51 +00:00
Sebastian Dröge
4d2a76af69 Merge branch 'file-utils-minor-fixes' into 'main'
gfileutils: Fix transfer annotation and whitespace issues

See merge request GNOME/glib!2385
2021-12-03 15:40:30 +00:00
Phaedrus Leeds
93f5758cf4 gfileutils: Fix transfer annotation and whitespace issues 2021-12-02 12:37:26 -08:00
Sebastian Dröge
9538e05387 Merge branch 'ossfuzz-41563-canonical-triple-slash-dot-dot' into 'main'
gfileutils: Correctly reset start value when canonicalising paths

See merge request GNOME/glib!2382
2021-12-02 18:46:06 +00:00
Philip Withnall
fc25f8d7ef gfileutils: Correctly reset start value when canonicalising paths
If a path starts with more than two slashes, the `start` value was
previously incorrect:
 1. As per the `g_path_skip_root()` call, `start` was set to point to
    after the final initial slash. For a path with three initial
    slashes, this is the character after the third slash.
 2. The canonicalisation loop to find the first dir separator sets
    `output` to point to the character after the first slash (and it
    overwrites the first slash to be `G_DIR_SEPARATOR`).
 3. At this point, with a string `///usr`, `output` points to the second
    `/`; and `start` points to the `u`. This is incorrect, as `start`
    should point to the starting character for output, as per the
    original call to `g_path_skip_root()`.
 4. For paths which subsequently include a `..`, this results in the
    `output > start` check in the `..` loop below not skipping all the
    characters of a preceding path component, which is then caught by
    the `G_IS_DIR_SEPARATOR (output[-1])` assertion.

Fix this by resetting `start` to `output` after finding the final slash
to keep in the output, but before starting the main parsing loop.

Relatedly, split `start` into two variables: `after_root` and
`output_start`, since the variable actually has two roles in the two
parts of the function.

Includes a test.

This commit is heavily based on suggestions by Sebastian Wilhemi and
Sebastian Dröge.

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

oss-fuzz#41563
2021-12-02 17:50:17 +00:00
Quentin PAGÈS
e3d28f8b80 Update Occitan translation
(cherry picked from commit 711efa507b)
2021-12-02 15:06:08 +00:00
Philip Withnall
3421a703ca gfileutils: Add a comment in g_canonicalize_filename()
Clarify the code a little. This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-02 11:32:25 +00:00
Sebastian Dröge
5ab008a50c Merge branch 'bit-test-improvements' into 'main'
tests: Test the function forms of g_bit_*() APIs too

See merge request GNOME/glib!2381
2021-12-02 10:21:59 +00:00
Philip Withnall
cbd48824bd tests: Test the function forms of g_bit_*() APIs too
The tests were previously only checking the macro forms. The function
forms should behave identically, but since it’s easy enough to get
coverage of them, we might as well.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-02 10:02:57 +00:00
Philip Withnall
d5e6793b83 tests: Factor out common calculations in test_basic_bits() test
This decreases the overall test time from 0.17s to 0.12s for me, and
will help further in the following commit where I’m going to repeat some
of these calculations again for further comparisons.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-02 09:59:46 +00:00
Philip Withnall
17ffe7b303 Merge branch 'move_bit-test' into 'main'
Merging tests/bit-test.c into glib/tests/utils.c

See merge request GNOME/glib!2379
2021-12-02 09:45:37 +00:00
Emmanuel Fleury
dd47df80e1 Merging tests/bit-test.c into glib/tests/utils.c 2021-12-01 14:10:44 +01:00
Philip Withnall
b5b3327636 Merge branch 'move_test_sources' into 'main'
GSource: move test to glib/tests/

See merge request GNOME/glib!2376
2021-12-01 11:39:46 +00:00
Nishal Kulkarni
70a8811ccc GSource: move test to glib/tests/
Previously tests existed in two places,
`$top_srcdir/tests/sources.c` contained additional tests,
they have now been moved to `$top_srcdir/glib/tests/mainloop.c`
and `$top_srcdir/tests/sources.c` was deleted.

Related to: #1434
2021-12-01 14:04:46 +05:30
Philip Withnall
9bd3ae856e Merge branch '2541-canonicalize-performance' into 'main'
gfileutils: Improve performance of g_canonicalize_filename()

Closes #2541

See merge request GNOME/glib!2374
2021-11-30 09:59:13 +00:00
Philip Withnall
4e8239b8d8 Merge branch 'removing_asyncqueue_from_test' into 'main'
Removing tests/asyncqueue-test.c from tests/

See merge request GNOME/glib!2347
2021-11-30 09:49:52 +00:00
Emmanuele Bassi
120478eeae Merge branch 'home-dir-suppression' into 'main'
glib.supp: Suppress one-time allocation in g_get_home_dir()

See merge request GNOME/glib!2373
2021-11-29 17:40:34 +00:00
Philip Withnall
0ebaf8a375 glib.supp: Suppress one-time allocation in g_get_home_dir()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-29 16:57:33 +00:00
Sebastian Dröge
b1e748abd2 Merge branch 'ebassi/dispose-notify' into 'main'
Freeze notification during object destruction

See merge request GNOME/glib!2371
2021-11-29 16:46:57 +00:00
Emmanuel Fleury
074d0a79d9 Removing tests/asyncqueue-test.c from tests/
Tests on async queues are already performed in a more extensive way in
glib/tests/asyncqueue.c. This test file can be safely removed without
any loss.
2021-11-29 16:46:13 +01:00
Emmanuele Bassi
1ec331266a Defer GObject::notify during object destruction
Notifying during object destruction is a dubious "feature": objects
might end up recreating a bunch of state just before clearing it;
language bindings might get spurious notifications during garbage
collection runs.

We freeze the notification queue before running the dispose() chain; if
the object was temporarily vivified during dispose, we thaw the
notification queue, otherwise we let the instance clear it when we
finalize it.

See: https://gitlab.gnome.org/GNOME/gjs/-/issues/445
2021-11-29 15:43:59 +00:00
Sebastian Dröge
a8edd30355 Merge branch 'wip/sadiq/improve-gvariant-docs' into 'main'
docs: Improve GVariant docs

See merge request GNOME/glib!2372
2021-11-29 10:13:36 +00:00
Mohammed Sadiq
3bd2ab4550 docs: Improve GVariant docs
Fix a typo and expand examples to include freeing memory
where it's not obvious
2021-11-29 15:24:15 +05:30
Aleksandr Melman
d08690c840 Update Russian translation 2021-11-28 15:20:03 +00:00
Piotr Drąg
0a4b693e93 Update Polish translation
(cherry picked from commit 816d4c3000)
2021-11-28 13:54:28 +00:00
Philip Withnall
38b61f301d Merge branch 'move_qsort_test' into 'main'
gqsort: Move test to glib/tests/

See merge request GNOME/glib!2370
2021-11-26 23:15:35 +00:00
Nishal Kulkarni
279a610018 gqsort: Move test to glib/tests/
Previously tests existed in two places,
`$top_srcdir/tests/qsort-test.c` contained a similar test
to the one in `$top_srcdir/glib/tests/sort.c` called `test_sort_basic()`

The test for checking with zero elements was additional added to
`$top_srcdir/glib/tests/sort.c` and `$top_srcdir/tests/qsort-test.c`
was deleted.

Related to: #1434
2021-11-27 02:16:22 +05:30
Goran Vidović
64961b5420 Update Croatian translation 2021-11-26 18:09:01 +00:00
Daniel Mustieles
96e02da3ba Updated Spanish translation 2021-11-26 18:04:17 +01:00
Sebastian Wilhelmi
9a30a495ec gfileutils: Improve performance of g_canonicalize_filename()
Improve the performance of canonicalising filenames with many `..` or
`.` components, by modifying the path inline rather than calling
`memmove()`.

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

Fixes: #2541
2021-11-26 14:07:10 +00:00
Philip Withnall
72377e3b6e Merge branch 'new_alloca0_newa0' into 'main'
galloca: Add new API g_alloca0 and g_newa0

Closes #475

See merge request GNOME/glib!2367
2021-11-26 12:38:46 +00:00
Sebastian Dröge
e9eec6f1c8 Merge branch '2514-charset-conundrum' into 'main'
tests: Unset CHARSET when testing locales to avoid it breaking tests

Closes #2514

See merge request GNOME/glib!2369
2021-11-26 12:33:42 +00:00
Nishal Kulkarni
48d0d9f76b gsocket: Use new g_alloca0() function
Replace `g_alloca()` and `memset()` with `g_alloca0()`
2021-11-26 12:24:23 +00:00
Nishal Kulkarni
1529c2ca4d gobject: Use new g_newa0() function
Replace old `g_newa()` and `memset()` with `g_newa0()`
2021-11-26 12:24:23 +00:00
Nishal Kulkarni
b321bf70d7 goption: Use new g_newa0() function
Replace old `g_newa()` and `memset()` with `g_newa0()`
2021-11-26 12:24:23 +00:00
Nishal Kulkarni
34cf69ef17 gsignal: Use new g_newa0() function
Replace old `g_alloca()` and `memset()` with `g_newa0()`
2021-11-26 12:24:23 +00:00
Nishal Kulkarni
8bf62d6309 ghmac: Use new g_alloca0() function
Replace `g_alloca()` and `memset()` with `g_alloca0()`
2021-11-26 12:24:23 +00:00
Nishal Kulkarni
1c7936b368 slice-test: Use new g_newa0() function
Replace old `g_alloca()` and `memset()` with `g_newa0()`
2021-11-26 12:24:23 +00:00
Marc-André Lureau
b4631c44ad galloca: Add new API g_alloca0 and g_newa0
Added `g_alloca0()` which wraps `g_alloca()` and initializes
allocated memory to zeroes.

Added `g_newa0()` which wraps `g_alloca0()` in a typesafe manner.

Refreshed and tweaked by Nishal Kulkarni.
2021-11-26 12:24:23 +00:00