Commit Graph

32354 Commits

Author SHA1 Message Date
Philip Withnall
515bc96e87 Merge branch 'clang_test_warnings' into 'main'
tests: Fix clang compilation warnings

See merge request GNOME/glib!4778
2025-09-07 14:56:27 +00:00
Philip Withnall
49bd40d958 Merge branch 'update-lt-translation' into 'main'
Update Lithuanian translation

See merge request GNOME/glib!4777
2025-09-07 14:55:33 +00:00
Philip Withnall
c2442d07e7 Merge branch 'update_uk2' into 'main'
Update Ukrainian translation

See merge request GNOME/glib!4775
2025-09-07 14:55:01 +00:00
Philip Withnall
c8e373ba52 Merge branch 'catalan' into 'main'
Update Catalan translation

See merge request GNOME/glib!4776
2025-09-07 14:54:44 +00:00
Makoto Sakaguchi
5b450a2390 Update Japanese translation
From https://l10n.gnome.org/vertimus/glib/main/po/ja/
2025-09-07 08:50:52 +09:00
Tobias Stoeckmann
bb6eab0e67 ghash: Turn version into guintptr
The gintptr data type is already used in iterator. Keep versions in sync
to avoid issues when one of them overflows while the other did not
(yet). Since integer overflows could eventually happen anyway, make
version unsigned.
2025-09-06 23:54:54 +02:00
Tobias Stoeckmann
cd7f7b29e7 ghash: Turn mod into guint
The only signed arithmetic left is the version. Keep it at that for now
but turn mod into unsigned for all other unsigned operations.
2025-09-06 23:23:29 +02:00
Tobias Stoeckmann
2b51b57f05 ghash: Turn size into guint
The size attribute is actually a "capacity" instead of a size in a more
classical sense: It doesn't represent the byte size but the amount of
elements within the hash table.

This is always a power of two, capped at 32 bit. This limit is required
to satisfy the support of converting a GHash into a GArray, which is
capped at G_MAXUINT elements.

Treat the size as capacity and bring it to the same data type as nnodes
and other element counters for better performance.

While at it, turn all variables taking the value of size into a guint
as well.

Closes: #672
2025-09-06 23:23:25 +02:00
Tobias Stoeckmann
4414a42c42 ghash: Perform shift calculations unsigned
Having unsigned values guarantees that g_hash_table_find_closest_shift
will never loop endlessly. Also make sure that it's impossible to
evade the sanity check of size in g_hash_table_set_shift. Since the
value will be an index, do not allow negative values.

Helps: #672
2025-09-06 22:17:53 +02:00
Tobias Stoeckmann
b5edef8200 ghash: Remove float from g_hash_table_resize
Multiplying nnodes with 1.333 leads to floating point operation.
Just divide nnodes by 3 and add it to nnodes for slightly faster
code.
2025-09-06 21:58:22 +02:00
Tobias Stoeckmann
81aa7a8bc4 ghash: Support all nnodes values in g_hash_table_maybe_resize
If nnodes value is very large, multiplying by 4 could overflow its guint
data type. Instead, first check that size is not 0, subtract by one, divide
by 4 and then check if that value is larger or equal to nnodes.

Flipping these checks has a nice advantage for small hash tables.

Helps: #672
2025-09-06 21:58:04 +02:00
Changwoo Ryu
89a20f8c5b Update Korean translation 2025-09-06 20:11:23 +09:00
Asier Saratsua Garmendia
1177c8eae3 Update eu translation 2025-09-06 07:33:09 +00:00
Rafael Fontenelle
9e1241a0d0 Update Brazilian Portuguese translation 2025-09-05 20:24:43 -03:00
Tobias Stoeckmann
ceb5ac4925 gmem: Replace SIZE_OVERFLOWS with g_size_checked_mul
Using the builtin multiplication checks leads to less instructions used
for these common functions (true for clang as well as gcc on x86_64).

Also, from a C perspective, the result is re-used, making code audits
easier.
2025-09-05 23:00:07 +02:00
Tobias Stoeckmann
c546ac20d8 tests: Fix clang compilation warnings
With these adjustments, building with clang leads to no warnings:

- The "{ NULL }" statement could be replaced with "{ 0 }" to satisfy
  clang, but this way it's explicitly filling all fields
- Even though "i" is not read with these g_array_binary_search calls,
  it rightfully should be set
2025-09-05 22:34:44 +02:00
Aurimas Černius
fcaefd2fa6 Update Lithuanian translation 2025-09-05 20:01:54 +00:00
Jordi Mas
a04e18fc6d Update Catalan translation 2025-09-05 20:21:22 +02:00
Yuri Chornoivan
4310757baa Update Ukrainian translation 2025-09-05 20:57:17 +03:00
Philip Withnall
87eaa8b0f0 docs: Add Luca Bacci as a co-maintainer of the Windows code
He’s been listed in `docs/CODEOWNERS` as one of the co-maintainers for a
long time, and it seems like an administrative oversight that the right
record was never added to `glib.doap` to give the GitLab maintainer
rights bit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-05 14:18:08 +01:00
Philip Withnall
723c28e116 Merge branch 'ghash_iter_overflow' into 'main'
ghash: Handle all table sizes in iterator

See merge request GNOME/glib!4756
2025-09-05 13:10:04 +00:00
Philip Withnall
16b92b3c9e Merge branch 'ghash_entry_is_big' into 'main'
ghash: Fix entry_is_big for CHERI architecture

See merge request GNOME/glib!4755
2025-09-05 13:07:51 +00:00
Philip Withnall
b1ad93eff2 Merge branch 'bookmark_escape' into 'main'
gbookmarkfile: Escape icon href and mime-type

See merge request GNOME/glib!4760
2025-09-05 13:07:24 +00:00
Philip Withnall
e33be08bda 2.86.0
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.86.0
2025-09-05 13:42:14 +01:00
Philip Withnall
56136cb804 Merge branch 'Persian' into 'main'
po: Update Persian translation.

See merge request GNOME/glib!4772
2025-09-05 12:22:30 +00:00
Danial Behzadi
831c4f7f83 po: Update Persian translation. 2025-09-05 15:25:47 +03:30
Philip Withnall
20b023a287 Merge branch 'gmessages_win32_debug' into 'main'
gmessages: Fix win32_keep_fatal_message regression

See merge request GNOME/glib!4768
2025-09-05 08:57:03 +00:00
Philip Withnall
2b7346e088 Merge branch 'main' into 'main'
Update Georgian translation

See merge request GNOME/glib!4771
2025-09-05 08:51:10 +00:00
Philip Withnall
fad50ad4e2 Merge branch 'translation' into 'main'
Update Chinese translation

See merge request GNOME/glib!4770
2025-09-05 08:51:03 +00:00
NorwayFun
edc81fa803 Update ka.po 2025-09-04 12:34:17 +00:00
lumingzh
698ecdfc1a update Chinese translation 2025-09-04 17:47:56 +08:00
Michael Catanzaro
8a6f6b352e Merge branch 'typos' into 'main'
docs: Fix typos

See merge request GNOME/glib!4769
2025-09-03 16:37:07 -05:00
Tobias Stoeckmann
48bf508bc1 docs: Fix typos
Typos found with codespell
2025-09-03 21:47:11 +02:00
Tobias Stoeckmann
3d21160b85 docs: Fix typos in comments 2025-09-03 21:33:53 +02:00
Tobias Stoeckmann
19dce43557 gstring: Fix argument reference
The argument is named init, not data.
2025-09-03 21:33:35 +02:00
Tobias Stoeckmann
795ca50a98 gmessages: Fix win32_keep_fatal_message regression
The functionality of win32_keep_fatal_message was lost with commit
fb9df27776, which introduced the usage of
fputs instead of write. The write system call was wrapped with a macro
for Windows systems to keep fatal messages in an extra buffer.

For the record, the unused dowrite function was removed in commit
5400f4e128.

Reintroduce the functionality to fix this regression in a memory-safe
way.
2025-09-03 19:40:51 +02:00
Tobias Stoeckmann
b030663112 gmessages: Add static variables only if needed
The static variables win32_keep_fatal_message and fatal_msg_buf are only
used for Windows debug builds and those without G_WINAPI_ONLY_APP
defined.

These checks are already in place for consumer of fatal_msg_buf, so
extend their usage.
2025-09-03 19:37:38 +02:00
Luca Bacci
fc9ce24359 GWin32AppInfo: Add support for focus stealing (unpackaged apps)
...by calling AllowSetForegroundWindow.

See previous commit for more informations.
2025-09-03 17:05:48 +02:00
Luca Bacci
29535c8998 GWin32AppInfo: Add support for focus stealing (packaged apps)
IApplicationActivationManager implements the IForegroundTransfer interface,
which lets us specify if the launched app is allowed to create a window
that steals focus (assuming our process has such ability). By default that
setting is disabled, so launched apps appear in the background and do not
get focus.

See XDG activation (Wayland) and the Startup notification specification (X11)
for equivalent functionality on Unix.

Support for focus-stealing can be set in GAppLaunchContext subclasses like
GdkAppLaunchContext, see gdk_app_launch_context_set_timestamp [1].

[1] https://docs.gtk.org/gdk4/method.AppLaunchContext.set_timestamp.html
2025-09-03 17:05:48 +02:00
Luca Bacci
8168e68716 GWin32AppInfo: Add support for startup-notification-id
GdkAppLaunchContext for Wayland / X11 fetch an opaque token
from the compositor.

On Windows, the system doesn't give you any token. Instead,
the token is implicit, and you can pass that to other
processes via dedicated APIs like AllowSetForegroundWindow.

Due to that, we use an internal format for startup-notify-id
that lets us check what to pass to activated apps.
2025-09-03 17:05:32 +02:00
Philip Withnall
b9d2fa3cdc Merge branch 'solaris-faccessat' into 'main'
glocalfile: Disable faccessat()-based query_exists on Solaris

See merge request GNOME/glib!4767
2025-09-02 18:32:04 +00:00
Marco Trevisan
72a1b2a50b Merge branch 'girepository-null-pointer-dereference' into 'main'
girepository: Add an assertion to help scan-build

See merge request GNOME/glib!4765
2025-09-02 18:53:59 +02:00
Philip Withnall
5c42d4f82c gdesktopappinfo: Error out on more invalid desktop files
Currently, the `GDesktopAppInfo` constructors return an error if
validity checks for the `Exec=` line, or other lines, fail. However,
they were ignoring the validity checks done at the `GKeyFile` level, for
invalid UTF-8 or string escaping.

It seems consistent to error out for those too, rather than pretending
that the key file line wasn’t set at all (i.e. treating it like `NULL`).

Spotted by Daniel Kondor.

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

Fixes: #3771
2025-09-02 17:50:49 +01:00
Philip Withnall
5bc310bf9e girepository: Add an assertion to help scan-build
This helps scan-build not emit a ‘potential null pointer dereference’
error for calls to `require_internal()`:
```
Access to field 'message' results in a dereference of a null pointer (loaded from variable 'local_error')
```

See https://gitlab.gnome.org/GNOME/glib/-/jobs/5482526 for details of
the error.

I don’t think there is an actual null pointer dereference here.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-02 16:02:26 +01:00
Niveditha Rau
f607ae6511 glocalfile: Disable faccessat()-based query_exists on Solaris 2025-09-01 13:56:21 -07:00
Philip Withnall
813c615be4 Merge branch 'gmemorymonitorpsi-avoid-regex' into 'main'
gio: gmemorymonitorpsi: Replace GRegex with g_str_has_prefix()

See merge request GNOME/glib!4762
2025-08-30 13:31:39 +00:00
Kleis Auke Wolthuizen
e506d16efa gio: gmemorymonitorpsi: Replace GRegex with g_str_has_prefix()
Using g_str_has_prefix() and simple pointer arithmetic is easier and
more efficient.

No functional change.
2025-08-30 13:31:38 +00:00
Emmanuele Bassi
cb074a65c7 Merge branch 'gir-gio-unix-split' into 'main'
girepository: Remove backward compatibility introspection from Gio-2.0

Closes #3744

See merge request GNOME/glib!4761
2025-08-29 18:26:18 +01:00
Emmanuele Bassi
e13fe685cf docs: Fix links to GioUnix types
Now that Unix-specific types have been moved to the GioUnix, we need to
fix the various links in our documentation.
2025-08-29 18:00:50 +01:00
Emmanuele Bassi
45640dffa5 girepository: Load platform-specific GIO data
For backward compatibility, we automatically load the GioUnix or
GioWin32 namespaces if the Gio namespace has been required.

Also ensures that the platform-specific library is loaded in tests

Co-Authored-By: Marco Trevisan (Treviño) <mail@3v1n0.net>
2025-08-29 14:32:08 +02:00