Commit Graph

22682 Commits

Author SHA1 Message Date
Emmanuel Fleury
176b204754 Fix signedness warnings in gobject/tests/properties.c:properties_get_property()
gobject/tests/properties.c: In function ‘properties_get_property’:
gobject/tests/properties.c:562:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  562 |   for (i = 0; i < G_N_ELEMENTS (test_props); i++)
      |                 ^
gobject/tests/properties.c:583:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  583 |   for (i = 0; i < G_N_ELEMENTS (test_props); i++)
      |                 ^
2020-12-16 23:26:34 +01:00
Philip Withnall
db70edb6ec Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1773
2020-12-16 11:45:41 +00:00
Emmanuel Fleury
8fb696e003 Fix missing initializer warning in gobject/tests/dynamictests.c:test_module_get_type()
gobject/tests/dynamictests.c: In function ‘test_module_get_type’:
gobject/tests/dynamictests.c:97:7: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   97 |       };
      |       ^
In file included from gobject/gobject.h:24,
                 from gobject/gbinding.h:29,
                 from glib/glib-object.h:22,
                 from gobject/tests/dynamictests.c:23:
gobject/gtype.h:1063:26: note: ‘value_table’ declared here
 1063 |   const GTypeValueTable *value_table;
      |                          ^~~~~~~~~~~
2020-12-16 10:56:32 +01:00
Emmanuel Fleury
34cb225543 Fix missing initializer warning in gobject/gparam.c:g_param_type_register_static()
gobject/gparam.c: In function ‘g_param_type_register_static’:
gobject/gparam.c:1434:3: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘struct _GTypeInfo’}
 1434 |   };
      |   ^
In file included from gobject/gvalue.h:26,
                 from gobject/gparam.h:26,
                 from gobject/gparam.c:26:
gobject/gtype.h:1063:26: note: ‘value_table’ declared here
 1063 |   const GTypeValueTable *value_table;
      |                          ^~~~~~~~~~~
2020-12-16 10:56:32 +01:00
Emmanuel Fleury
dd16d1e879 Fix missing initializer warning in gobject/gtypemodule.c:g_type_module_get_type()
gobject/gtypemodule.c: In function ‘g_type_module_get_type’:
gobject/gtypemodule.c:154:7: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  154 |       };
      |       ^
In file included from gobject/gtypeplugin.h:24,
                 from gobject/gtypemodule.c:22:
gobject/gtype.h:1063:26: note: ‘value_table’ declared here
 1063 |   const GTypeValueTable *value_table;
      |                          ^~~~~~~~~~~
2020-12-16 10:56:32 +01:00
Emmanuel Fleury
12ec1eb062 Fix missing initializer warning in gobject/gtypeplugin.c:g_type_plugin_get_type()
gobject/gtypeplugin.c: In function ‘g_type_plugin_get_type’:
gobject/gtypeplugin.c:91:7: error: missing initializer for field ‘class_init’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   91 |       };
      |       ^
In file included from gobject/gtypeplugin.h:24,
                 from gobject/gtypeplugin.c:20:
gobject/gtype.h:1053:26: note: ‘class_init’ declared here
 1053 |   GClassInitFunc         class_init;
      |                          ^~~~~~~~~~
2020-12-16 10:56:32 +01:00
Emmanuel Fleury
cc7540909f Fix signedness warning in gobject/gtype.c:iface_node_has_available_offset_L()
gobject/gtype.c: In function ‘iface_node_has_available_offset_L’:
gobject/gtype.c:1288:42: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
 1288 |   if (G_ATOMIC_ARRAY_DATA_SIZE (offsets) <= offset)
      |                                          ^~
2020-12-16 10:56:24 +01:00
Sebastian Dröge
c257049751 Merge branch 'codegen-flake8-warnings' into 'master'
gdbus-codegen: Ignore some flake8 warnings

See merge request GNOME/glib!1813
2020-12-15 10:05:25 +00:00
Philip Withnall
b207965697 gdbus-codegen: Ignore some flake8 warnings
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-15 09:43:35 +00:00
Sebastian Dröge
7d96944c98 Merge branch '2227-more-annotations' into 'master'
Add more missing nullable annotations

See merge request GNOME/glib!1811
2020-12-15 09:31:53 +00:00
Daniel Mustieles
b7e03e37db Updated Spanish translation 2020-12-15 10:27:47 +01:00
Philip Withnall
b66ae5a87e gdbuserror: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-15 09:14:39 +00:00
Philip Withnall
eb8d1c4826 gdbusconnection: Improve documentation formatting slightly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-15 09:14:20 +00:00
Philip Withnall
06b5e3e54c gdbusconnection: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-15 09:13:22 +00:00
Philip Withnall
b19782e26b gdbusaddress: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-15 09:11:50 +00:00
Philip Withnall
f4766f2034 gcredentials: Improve documentation formatting slightly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-15 09:10:19 +00:00
Philip Withnall
2a76f01698 gcredentials: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-15 09:09:59 +00:00
Sebastian Dröge
784f968895 Merge branch '2227-more-nullables' into 'master'
glib: Add more missing return value annotations

See merge request GNOME/glib!1801
2020-12-15 08:22:00 +00:00
Philip Withnall
2e99579268 Merge branch 'dm' into 'master'
gfileinfo: Add missing preconditions to g_file_info_get_attribute_data()

See merge request GNOME/glib!1810
2020-12-14 17:42:55 +00:00
oucaijun
f49831ccb4 gfileinfo: Add missing preconditions to g_file_info_get_attribute_data() 2020-12-14 09:41:00 +08:00
Sebastian Dröge
4fb3b6aa37 Merge branch 'asyncqueue-test-timing' into 'master'
tests: Be more lenient with timing checks on asyncqueue pops

See merge request GNOME/glib!1808
2020-12-13 09:18:21 +00:00
Sebastian Dröge
cb0f6ad08f Merge branch 'py-style-fix' into 'master'
python: Reformat some files to keep style-check-diff happy

See merge request GNOME/glib!1807
2020-12-13 09:17:39 +00:00
Sebastian Dröge
06511b16fa Merge branch 'timeout-test-fix' into 'master'
tests: Add some rounding tolerance in timeout test

See merge request GNOME/glib!1806
2020-12-13 09:17:18 +00:00
Sebastian Dröge
18f8a8b25f Merge branch '1568-initially-unowned-docs' into 'master'
docs: Mention GInitiallyUnowned when introducing refcounts

Closes #1568

See merge request GNOME/glib!1798
2020-12-12 20:48:42 +00:00
Philip Withnall
e7f9ae61dc docs: Mention GInitiallyUnowned when introducing refcounts
For completeness.

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

Fixes: #1568
2020-12-12 18:47:00 +00:00
Philip Withnall
c58f308aed tests: Be more lenient with timing checks on asyncqueue pops
On heavily loaded CI machines it seems to be taking about 1.3s between
one `g_get_monotonic_time()` call and the next. Allow that.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-12 18:41:50 +00:00
Philip Withnall
ff56386788 tests: Add some rounding tolerance in timeout test
Occasionally this test fails in CI with the message:
```
assertion failed: (current_time / 1000000 - last_time / 1000000 == 1)
```

The way this calculation is done at the moment, a difference of 1001ms
between `current_time` and `last_time` can result in failure, if the
times are close to a multiple to 1000ms.

Change it to only truncate the result after doing the subtraction, and
add a 500ms tolerance to account for scheduling delays in the test. (For
example, the `test_func()` could be called, then descheduled before it
gets to call `g_get_monotonic_time()`.

Additionally, change the test to use `g_assert_cmpint()` so that future
failures provide more useful debug information.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-12 18:41:08 +00:00
Philip Withnall
39f33412db python: Reformat some files to keep style-check-diff happy
The version of `black` on the CI server wanted these changes. Make them
to keep the `style-check-diff` CI job from constantly failing.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-12 18:40:57 +00:00
Philip Withnall
0755ff97be gchecksum: Drop preconditions for checksum_type being valid
Instead, return `NULL` if the checksum type is unsupported. This may
come in useful if we have to withdraw support for a particular checksum
type in future, due to it being broken.

These semantics were already in place for the return value of
`g_checksum_new()` — see commit 877cc60f and bug
comment https://bugzilla.gnome.org/show_bug.cgi?id=501853#c6.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-12 18:30:22 +00:00
Philip Withnall
3fef049472 gchecksum: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-12 18:30:22 +00:00
Philip Withnall
da83d711d6 gbookmarkfile: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-12 18:30:22 +00:00
Philip Withnall
7c3891afe9 gasyncqueue: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-12 18:30:22 +00:00
Philip Withnall
f53b3f3a16 garray: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-12 18:30:22 +00:00
Ondrej Holy
c311b9947b gio-tool-info: Prevent criticals if mount options are not available
NULL is valid return value for the g_unix_mount_get_options function
because mount options are currently provided only by libmount implementation.
However, the gio tool passes the returned value to the g_strescape function
without checking, which produces the following critical warning:
GLib-CRITICAL **: 13:47:15.294: g_strescape: assertion 'source != NULL' failed

Let's add the missing check to prevent the critical warnings.
2020-12-12 18:30:22 +00:00
Sebastian Dröge
a4be8577ed Merge branch 'wip/pwithnall/freebsd-math' into 'master'
gdatetime: Improve ISO 8601 parsing to avoid floating point checks

See merge request GNOME/glib!1797
2020-12-12 18:15:48 +00:00
Sebastian Dröge
975603d74f Merge branch '769778-dbus_register-contract' into 'master'
gapplication: Add postconditions on calls to GApplication.dbus_register

Closes #1188

See merge request GNOME/glib!1800
2020-12-12 09:01:00 +00:00
Emmanuele Bassi
adaca14133 Merge branch '2227-more-nullables-more' into 'master'
gobject: More missing return value annotations

See merge request GNOME/glib!1802
2020-12-12 00:04:31 +00:00
Philip Withnall
181a12c393 gsignal: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-11 23:49:30 +00:00
Philip Withnall
c7a7dd9ae3 gparam: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-11 23:49:14 +00:00
Philip Withnall
a9e3e3715a genums: Add missing (transfer) and (nullable) return annotations
This commit only looks at the `Returns:` lines in the documentation, and
has examined all of them in the file. Function arguments have not been
checked.

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

Helps: #2227
2020-12-11 23:48:35 +00:00
Philip Withnall
539621d2d3 gapplication: Add postconditions on calls to GApplication.dbus_register
Try and catch programmer errors in third-party implementations of
`dbus_register()`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1188
2020-12-11 22:33:13 +00:00
Philip Withnall
f7dbc6010b tests: Add more tests for GDateTime ISO 8601 seconds parsing
This should add a few more lines/branches to the test coverage.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-11 16:03:11 +00:00
Philip Withnall
50a3d0bf9d gdatetime: Use isnan() instead of !isfinite()
Both are provided by libm, but `isnan()` is provided as a macro, whereas
`isfinite()` is an actual function, and hence libm has to be available
at runtime. That didn’t trivially work on FreeBSD, resulting in this
refactor.

`isfinite(x)` is equivalent to `!isnan(x) && !isinfinite(x)`. The case
of `x` being (negative or positive) infinity is already handled by the
range checks on the next line, so it’s safe to switch to `isnan()` here.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-11 15:39:47 +00:00
Philip Withnall
5d7f4b8f04 gdatetime: Remove floating point from seconds parsing code
Rather than parsing the seconds in an ISO 8601 date/time using a pair of
floating point numbers (numerator and denominator), use two integers
instead. This avoids issues around floating point precision, and also
makes it easier to check for potential overflow from overlong inputs.

This last point means that the `isfinite()` check can be removed, as it
was covering the case where a NAN was generated, which isn’t now
possible using integer arithmetic.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-11 15:36:56 +00:00
Philip Withnall
819409cf9a Merge branch 'wip/oholy/gio-info-prevent-criticals' into 'master'
gio-tool-info: Prevent criticals if mount options are not available

See merge request GNOME/glib!1794
2020-12-11 13:41:22 +00:00
Ondrej Holy
48a84f6434 gio-tool-info: Prevent criticals if mount options are not available
NULL is valid return value for the g_unix_mount_get_options function
because mount options are currently provided only by libmount implementation.
However, the gio tool passes the returned value to the g_strescape function
without checking, which produces the following critical warning:
GLib-CRITICAL **: 13:47:15.294: g_strescape: assertion 'source != NULL' failed

Let's add the missing check to prevent the critical warnings.
2020-12-11 13:18:27 +00:00
Sebastian Dröge
a28b3c9dd6 Merge branch 'fix-set-contents-typo' into 'master'
gfileutils: Fix typo in docs

See merge request GNOME/glib!1796
2020-12-11 07:27:38 +00:00
Phaedrus Leeds
7ef936f4e3 gfileutils: Fix typo in docs 2020-12-10 21:06:00 -08:00
Florentina Mușat
673f61a763 Update Romanian translation 2020-12-10 16:24:45 +00:00
Yuri Chornoivan
df42290300 Update Ukrainian translation 2020-12-09 15:43:41 +00:00