Commit Graph

29385 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
a201cbd719 girepository: Various indentation cleanups
Various random syntax cleanups found while refactoring
2024-01-16 18:56:57 +01:00
Marco Trevisan (Treviño)
b68857e707 giroffsets: Use size types for size and alignments
Note that for alignments we should actually use size_t, but this would
imply some refactors since this value can be acually set to -1 in our
implementation.

So we use gssize for now, that at least on gcc is defined.
2024-01-16 18:55:45 +01:00
Marco Trevisan (Treviño)
223acf44ba gitypelib: Replace gi_typelib_check_format with compile-time static checks only
There's no much time to have checks at runtime when the compiler can
make sure that the structures size match the expected ones.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
c8eeca9492 girnode: Use size_t to compute gir node size and ensure value is valid 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
a73cc6d5a2 girepository: Use size_t to keep track of the number of interfaces 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
bd29b0bf65 gtypelib: Use size_t for size-related arguments 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
6ef67b9a0d gtypelib: Use proper formatting for sizeof value
That returns a size_t, so we should use the z printf directive.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
25ae968fc2 girepository: Use expected signed types for iterating
We are using various indexes types, but not always using the correct
sign or size, so let's adapt this to ensure we're consistent with the
values we're comparing with.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
91a3399027 girmodule: Ensure we actually use unsigned for gi_ir_module_fatal line 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
13791b47f6 gistructinfo: Use proper types for offset lookup
This is a private function so we can just use the expected types.

Also this avoids a signed/unsigned conversion.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
19476db825 girepository: Ensure indexed access on members is not overflowing
Even though we expose member access as size_t, a GI info blob can
typically just access to an a number of values that is never bigger
than uint16_t, as that's how the typelib is defined (cfr. typelib
internal header blob sizes and n_* elements).

So let's avoid this to happen by adding a check.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
acabaa1568 gibaseinfo: Ensure the typelib offset is within the allowed limits
Even though we expose the offset as a size_t value, we actually have
a less space for it, so let's ensure this is the case at runtime.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
157f93d2ee girepository: Use size_t for size-related arguments and return types
We used to use unsigned values, while they should be big enough to old
the data we're handling here, it's cleaner and clearer if we use size_t
as type for such values, as it makes straight forward to understand what
a value should contain. It also makes these values more future proof.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
de8ac339fb gitypeinfo: Use gssize to return the array length index
Use a bigger integer value, even though int is more than enough, but
to make it clearer that we're returning a size-related value.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
a3d29b6437 giarginfo: Use gssize to return the closure and destroy indexes
Use a bigger integer value, even though int is more than enough, but
to make it clearer that we're returning a size-related value.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
bc2e4b3de5 girrepository: Replace usage of gsize with standard size_t
We just do a safe s/gsize/size_t/ replacement here without doing any
changes to places in which different size of size_t and gsize may be
actually different and create troubles.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
c8aecbb834 girepository: Use uint8_t pointers instead of guchar 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
e3aac4281d girrepository: Remove unneeded static check
The check was added to ensure compatibility with previous versions but
this is not something we care anymore with this API/ABI break.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
5c96b0231a girnode: Use unsigned type for unsigned values
Also use proper sized casting for blob values.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
9f33015a25 girrepository: Use standard int sized types instead of g[u]int* 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
e5353ef0c1 girnode: Assign negative value to signed integer 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
8891429a5b girepository: Use char instead of glib-specific gchar 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
eda4bfcf95 girrepository: Use void* instead of gpointer 2024-01-16 18:40:37 +01:00
Marco Trevisan (Treviño)
44e4555765 girepository/cmph-bdz-test: Avoid using unused temporary variable 2024-01-16 17:30:49 +01:00
Marco Trevisan (Treviño)
91fc45ea57 girepository: Replace tabs with spaces in indentation
We don't use tabs anywhere and the mixed setup just makes many editors
to cry. So let's just replace the tabs with 8 spaces.
2024-01-16 17:30:37 +01:00
Philip Withnall
35fe0d0bba Merge branch 'girrepository-cleanups' into 'main'
girepository: Misc cleanups

See merge request GNOME/glib!3823
2024-01-15 22:25:03 +00:00
Philip Withnall
2784028552 Merge branch 'brz-guintptr' into 'main'
brz.c: Use uintptr_t instead of a hardcoded list of 64-bit arches

See merge request GNOME/glib!3812
2024-01-15 22:16:00 +00:00
Philip Withnall
39f0b74a66 Merge branch 'syslog' into 'main'
gmessages: add syslog support

Closes #3207

See merge request GNOME/glib!3791
2024-01-15 21:59:19 +00:00
Marco Trevisan (Treviño)
2ee2088f4a girrepository: Drop trailing new line on GMessages 2024-01-15 21:26:53 +00:00
Marco Trevisan (Treviño)
d78b6c55bc girepository/tests: Add further checks on GObject methods infos 2024-01-15 21:26:42 +00:00
Marco Trevisan (Treviño)
18d0b0eb40 girepository: Move cmph-bdz test to tests subfolder
We can avoid to maintain the special case and still works fine
2024-01-15 21:26:40 +00:00
Alex Richardson
dd2a42cad2 brz.c: Use uintptr_t instead of a hardcoded list of 64-bit arches
This also fixes the build for AArch64 since cmph_uint32 is not big
enough to hold a pointer there. I found this while building for CHERI
since the compiler errors there when casting from a non-inptr_t integer.
This also fixes warnings when building for AArch64 with clang.
2024-01-15 13:10:32 -08:00
Philip Withnall
166f04a57f Merge branch 'gvariant-parse-detail' into 'main'
gvariant-parser: Mention annotated types

See merge request GNOME/glib!3811
2024-01-15 17:24:53 +00:00
Marco Trevisan (Treviño)
8a4755106d girepository: Add gthash test to tests and run it 2024-01-15 18:16:56 +01:00
Philip Withnall
0c9fe8156a Merge branch 'improve-set_str-documentation' into 'main'
gstrfuncs: Improve and port g_set_str() docs to gi-docgen

See merge request GNOME/glib!3810
2024-01-15 17:09:17 +00:00
Philip Withnall
c804bd781c Merge branch 'girepository-api-tweaks' into 'main'
girepository: Various small API cleanups

See merge request GNOME/glib!3805
2024-01-15 16:37:18 +00:00
Philip Withnall
12373227d1 Merge branch 'gmoduleopen_docs_clarify' into 'main'
docs: Clarify >=2.76 changes to g_module_open()

See merge request GNOME/glib!3818
2024-01-15 16:17:54 +00:00
Philip Withnall
048afc5923 Merge branch 'wip/smcv/issue3226' into 'main'
tests: Don't test --external-data with toolchains that can't do the setup

Closes #3226

See merge request GNOME/glib!3819
2024-01-15 15:41:44 +00:00
Philip Withnall
cbb29a54c3 Merge branch 'socket-test-leak' into 'main'
tests: Fix a minor leak in the socket test

See merge request GNOME/glib!3821
2024-01-15 15:32:01 +00:00
Philip Withnall
6900e0450f Merge branch '3093-gdbus-header-validation' into 'main'
gdbusmessage: Validate the types of all known message headers

Closes #3093

See merge request GNOME/glib!3748
2024-01-15 15:21:44 +00:00
Philip Withnall
dea4cc66bd Merge branch 'realloc-ub' into 'main'
gsignal.c: drop an optimization that is undefined behaviour

See merge request GNOME/glib!3806
2024-01-15 15:16:05 +00:00
Guido Günther
13a2ea7dd8 gvariant-parser: Fix links to gvariant-format doc
Also escape some function names
2024-01-15 14:39:46 +00:00
Guido Günther
d025a7f5b3 gvariant-parser: Mention annotated types
g_variant_parse() supports g_variant_printf()s type annotations which
can be needed e.g. in detailed action names.

Reference: https://gitlab.gnome.org/GNOME/gtk/-/issues/6303#note_1958300
2024-01-15 14:39:17 +00:00
Philip Withnall
528dd834a9 Merge branch 'wip/smcv/issue3225' into 'main'
gdatetime: Ignore %E modifier on 64-bit big-endian for the moment

Closes #3225

See merge request GNOME/glib!3820
2024-01-15 14:18:40 +00:00
Simon McVittie
6de98cc255 gdatetime: Ignore %E modifier on 64-bit big-endian for the moment
This doesn't appear to work reliably on s390x and ppc64, returning
the results that were expected without %E or intermittently crashing.
It seems that on little-endian 64-bit, the intptr_t returned by the
undocumented _NL_TIME_ERA_NUM_ENTRIES correctly has the number of entries
in its low-order half (at the time of writing, 0x0000'0000'0000'000b for
Japan), but on big-endian 64-bit, it has the number of entries in its
high-order half instead (for example 0x0000'000b'0000'0000 for Japan),
with the low-order half being all-zero or possibly uninitialized.

Making this reliable will require some sort of defined API from glibc.

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/3225
Bug-Debian: https://bugs.debian.org/1060735
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-15 14:18:40 +00:00
Philip Withnall
c7ace595e8 tests: Fix a minor leak in the socket test
As seen in [CI](https://gitlab.gnome.org/GNOME/glib/-/jobs/3436216):
```
==13767== 144 (40 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 528 of 562
==13767==    at 0x4A18B2C: g_type_create_instance (gtype.c:1928)
==13767==    by 0x49F92FF: g_object_new_internal (gobject.c:2235)
==13767==    by 0x49FA247: g_object_new_valist (gobject.c:2574)
==13767==    by 0x49F8D81: g_object_new (gobject.c:2047)
==13767==    by 0x4AE2337: g_inet_socket_address_new (ginetsocketaddress.c:387)
==13767==    by 0x4B1DB94: g_socket_address_new_from_native (gsocketaddress.c:230)
==13767==    by 0x4B16CC2: g_socket_get_local_address (gsocket.c:2071)
==13767==    by 0x40E102: test_receive_bytes_from (socket.c:2469)
==13767==    by 0x4901E78: test_case_run (gtestutils.c:2974)
==13767==    by 0x49022B2: g_test_run_suite_internal (gtestutils.c:3069)
==13767==    by 0x490241A: g_test_run_suite_internal (gtestutils.c:3088)
==13767==    by 0x4902690: g_test_run_suite (gtestutils.c:3168)
==13767==    by 0x4900C8F: g_test_run (gtestutils.c:2275)
==13767==    by 0x40EE8A: main (socket.c:2614)
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3220
2024-01-15 14:16:21 +00:00
Philip Withnall
1964c4f833 Merge branch 'ebassi/thread-gir' into 'main'
gir: Hide pthread types in deprecated GThread structures

Closes #3222

See merge request GNOME/glib!3815
2024-01-15 12:39:36 +00:00
Emmanuele Bassi
88251e63bb gir: Hide pthread types in deprecated GThread structures
We only care about the introspection data for documentation purposes;
the GStaticMutex and GStaticRecMutex types are long since deprecated,
and they cannot be used from language bindings anyway, so their size is
immaterial.

Fixes: #3222
2024-01-15 12:39:36 +00:00
Simon McVittie
fb5dd18f21 tests: Don't test --external-data with toolchains that can't do the setup
There are several reasons why we might not be able to do the test setup
for --external-data: non-Linux platform, missing ld or objcopy,
objcopy doesn't support --add-symbol, or the CPU family is MIPS
(on which cc -r does not necessarily emit the specific MIPS ABI flavour
that we are targeting, for example different functionality levels or
different NaN encodings).

If we can't link in the test data, then obviously this test is not going
to pass. It was already skipped on non-Linux, but not on platforms that
hit one of the other reasons for the test setup to fail.

In particular, this test failed on Debian mips64el since commit 81059169,
which stopped linking the necessary resource on MIPS platforms, but
continued to assert that the resource is present at runtime.

Fixes: 81059169 "GIO/tests: skip test_resources_binary on MIPS platform"
Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3226
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-01-13 19:54:28 +00:00
Simon McVittie
4ba14ff28d Merge branch 'wip/smcv/manpages-but-no-gi-docgen' into 'main'
docs: Allow building man pages without the reference documentation

See merge request GNOME/glib!3817
2024-01-12 16:13:18 +00:00