Commit Graph

21817 Commits

Author SHA1 Message Date
Philip Withnall
e86dd77655 gfileutils: Correct operator precedence to avoid undefined pointer maths
`base` can be `-1` in some situations, which would lead to pointing
outside an allocation area if the sums were evaluated as `(file_name +
base) + 1` rather than `file_name + (base + 1)`.

I don’t see how this can practically cause an issue, as the arithmetic
is all finished before anything’s dereferenced, but let’s keep to the
letter of the C standard to avoid this coming up in code audits in
future.

Fix suggested by fablhx.

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

Closes: #2077
2020-06-10 13:26:14 +01:00
sicklylife
98b89b739a Update Japanese translation 2020-06-10 12:18:46 +00:00
Philip Withnall
b202604389 Merge branch 'wip/smcv/normalize-trailing-newlines' into 'master'
Normalize C source files to end with exactly one newline

See merge request GNOME/glib!1525
2020-06-10 09:19:55 +00:00
Simon McVittie
44c004c84e Normalize C source files to end with exactly one newline
Some editors automatically remove trailing blank lines, or
automatically add a trailing newline to avoid having a trailing
non-blank line that is not terminated by a newline. To avoid unrelated
whitespace changes when users of such editors contribute to GLib,
let's pre-emptively normalize all files.

Unlike more intrusive whitespace normalization like removing trailing
whitespace from each line, this seems unlikely to cause significant
issues with cherry-picking changes to stable branches.

Implemented by:

    find . -name '*.[ch]' -print0 | \
    xargs -0 perl -0777 -p -i -e 's/\n+\z//g; s/\z/\n/g'

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-06-10 09:48:02 +01:00
Philip Withnall
a50ad8b10e Merge branch 'meson-fix-gnulib-printf-checks' into 'master'
meson: Fix gnulib printf checks

See merge request GNOME/glib!1522
2020-06-08 14:14:53 +00:00
Nirbheek Chauhan
6c76089ccc meson: Fix gnulib printf checks
Some typos, and accidental usage of the strings `'true'` / `'false'`
instead of the booleans `true` / `false`.
2020-06-08 18:45:33 +05:30
Philip Withnall
625f1b4007 Merge branch 'Android-stpcpy' into 'master'
meson: check for stpcpy using cc.links()

See merge request GNOME/glib!1515
2020-06-08 11:29:24 +00:00
Vilius Sutkus 89
fcfb1c6b9e meson: Require 0.54.2 when building for Android ≤ 20
cc.has_function() provide false positive for Android-20 and earlier; the fix is in Meson 0.54.2. People attempting to cross-compile previously wouldn’t have been able to get it to work without manual intervention, so the dependency bump for this platform is not an additional obstacle for them.
2020-06-08 11:29:24 +00:00
Philip Withnall
633413909d Merge branch 'docs' into 'master'
docs: Add (nullable) annotations

Closes #2124

See merge request GNOME/glib!1521
2020-06-05 14:05:12 +00:00
Avinash Sonawane
e91f4ac961 docs: Add (nullable) annotations 2020-06-05 18:40:37 +05:30
Philip Withnall
016c39d883 Merge branch 'win32reg-assertions' into 'master'
GWin32RegistryKey: Move assertions

See merge request GNOME/glib!1517
2020-06-05 11:26:22 +00:00
Руслан Ижбулатов
8651bee90f GWin32RegistryKey: Move assertions
While these assertions look right at the first glance,
they actually crash the program. That's because GObject
insists on initializing all construct-only properties
to their default values, which results in
g_win32_registry_key_set_property() being called multiple
times with NULL string, once for each unset property.

If "path" is actually set by the caller, a subsequent
call to set "path-utf16" to NULL will fail an assertion,
since absolute_path is already non-NULL.

With assertions moved the set-to-NULL calls bail out before
an assertion is made.
2020-06-05 10:31:25 +00:00
Sebastian Dröge
c573e21191 Merge branch 'wip/baedert/arrays' into 'master'
strfuncs: Use a GPtrArray in strsplit()

See merge request GNOME/glib!1518
2020-06-05 07:31:34 +00:00
Matej Urbančič
201d9cbd76 Updated Slovenian translation 2020-06-05 09:13:17 +02:00
Timm Bäder
a2e715a4fe strfuncs: Use a GPtrArray in strsplit()
This is more efficient and also much easier since we already have the
memory allocated that we're going to return from the function. No need
to do that ourselves or reverse a list.
2020-06-05 08:59:15 +02:00
Philip Withnall
c93318953e Merge branch 'threaded-socket-service-nullable-source-object' into 'master'
gthreadedsocketservice: Mark source_object of run signal as nullable

See merge request GNOME/glib!1516
2020-06-02 11:54:23 +00:00
Sebastian Dröge
2ed356cb67 Merge branch 'disable-ios-nsgetenviron' into 'master'
Various fixes when building for iOS

See merge request GNOME/glib!1512
2020-06-02 10:56:44 +00:00
Sebastian Dröge
4556bf1e24 gthreadedsocketservice: Mark source_object of run signal as nullable 2020-06-02 13:40:54 +03:00
Philip Withnall
3fd3a246f6 Merge branch 'bookmark-visited' into 'master'
Initialize the visited time of a new GBookmarkFile

See merge request GNOME/glib!1513
2020-05-30 18:03:08 +00:00
Emmanuele Bassi
9f7f2b4d55 Add a GBookmarkFile serialization test case
We're roundtripping from a valid file, but we should also roundtrip from
a newly created GBookmarkFile, to ensure that we set all the necessary
fields.
2020-05-30 17:40:52 +01:00
Emmanuele Bassi
909a8856ef Initialize the visited time of a new GBookmarkFile
Just like we do for the other fields. Otherwise, when we serialise the
item, we're going to hit a segmentation fault when trying to format a
NULL GDateTime.
2020-05-30 17:09:40 +01:00
Nirbheek Chauhan
ab6b764e24 ci: growing_stack should be true for android and ios
We can't run this test when cross-compiling, but we know what this
should be on Android and iOS.
2020-05-29 02:44:44 +05:30
Nirbheek Chauhan
e3ef2cdf82 .gitlab-ci: Add an example iOS cross file
This should be generated based on the available SDK versions and the
iPhone version you want to target, but that's something we can do
when adding macOS and iOS CI.
2020-05-29 01:17:14 +05:30
Nirbheek Chauhan
a28b52d7db meson: Only look for _NSGetEnviron when building for macOS
On iOS it can cause build failures with some SDK versions, and its
usage will also cause the app to be rejected on submission.
2020-05-29 00:31:35 +05:30
Nirbheek Chauhan
3c78d0cec6 meson: Autodetect when building for iOS
Instead of relying on `system` to be set correctly in the
cross-compile file, detect when we're building for iOS/watchOS/tvOS.
2020-05-29 00:31:35 +05:30
Nirbheek Chauhan
c6af3c7749 meson: host_system can be ios when cross-compiling
Cross-compile system names aren't standardized in Meson yet[1], but we
already use this name in `tests/meson.build`, so use it here too for
consistency.

1. https://mesonbuild.com/Reference-tables.html#operating-system-names
2020-05-29 00:31:35 +05:30
Emmanuele Bassi
3d0e1f5c85 Merge branch '1931-bookmark-file-y2038' into 'master'
Resolve "GBookmarkFile API involves time_t"

Closes #1931

See merge request GNOME/glib!1511
2020-05-28 15:41:04 +00:00
Philip Withnall
c45ad011f4 tests: Add tests for deprecated GBookmarkFile API
Just to check that it correctly wraps the new replacement APIs.

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

Helps: #1931
2020-05-28 14:55:53 +01:00
Philip Withnall
6147cae1c6 gbookmarkfile: Deprecate GBookmarkFile APIs which use time_t
They use the `time_t` type, which is not year 2038 safe on 32-bit
systems, so have to be deprecated.

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

Fixes: #1931
2020-05-28 14:55:53 +01:00
Philip Withnall
9b82fd021a tests: Update GBookmarkFile tests to use new APIs
In preparation for deprecating the old APIs. This shouldn’t functionally
affect the tests.

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

Helps: #1931
2020-05-28 14:55:53 +01:00
Philip Withnall
fbc1456971 gbookmarkfile: Add Y2038-proof APIs to GBookmarkFile
These are alternatives to the existing `time_t`-based APIs, which will
soon be deprecated due to `time_t` only being Y2038-safe on 64-bit
systems.

The new APIs take a GDateTime instead.

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

Helps: #1931
2020-05-28 14:55:53 +01:00
Nirbheek Chauhan
caec84ae1e Merge branch 'gdbus-codegen-exporting' into 'master'
Make symbols generated by gdbus-codegen exportable on Visual Studio-style builds

See merge request GNOME/glib!1452
2020-05-28 13:01:46 +00:00
Chun-wei Fan
cd229a2fb4 docs: Document --symbol-decorator for gdbus-codegen
This updates gdbus-codegen.xml to include documentation for the
--symbol-decorator, --symbol-decorator-header and
--symbol-decorator-define options, which is used to help to export
symbols in the generated code.
2020-05-28 18:24:57 +08:00
Nirbheek Chauhan
73d9b72fec Merge branch 'fix-gresource-export-msvc' into 'master'
glib-compile-resources: Fix exporting on Visual Studio

Closes #1215

See merge request GNOME/glib!1468
2020-05-28 10:03:28 +00:00
Philip Withnall
a3c1bce4fd Merge branch 'static-libintl' into 'master'
meson: Fix underlinking of static libintl by trying iconv and pthread

Closes #1851

See merge request GNOME/glib!1450
2020-05-28 09:36:36 +00:00
Chun-wei Fan
a94f32f140 gdbus-object-manager-example: Fix build on Visual Studio
This ensures that we do really export the symbols for Visual
Studio-style builds, by using _GLIB_EXTERN to decorate the generated
prototypes and including config.h so that we are sure the symbols are
actually exported.
2020-05-28 17:20:22 +08:00
Chun-wei Fan
d955719f04 gdbus-codegen: Allow decorating symbols in headers
This adds three options to gdbus-codegen so that we may be able to
use a self-defined symbol decorator, such as _GLIB_EXTERN, to decorate
the generated prototypes, to be used possibly to export the symbols, if
needed.

The other two options allows including headers that are required for the
specified symbol decorator to be usable and preprocessor macros that are
required for the symbol decorator to be defined appropriately, also when
needed.
2020-05-28 17:20:22 +08:00
Philip Withnall
11e9c5a9ce Merge branch 'clang-trap' into 'master'
Use __builtin_trap() on Clang on any platform

See merge request GNOME/glib!1430
2020-05-28 09:01:49 +00:00
Martin Storsjö
77346d903d Don't fall back to raise(SIGTRAP) on Windows
When targeting mingw on architectures other than x86, the earlier cases
don't apply, and the final fallback, raise(SIGTRAP) isn't usable there.

GCC and Clang both support __builtin_trap(), so in case we have no
other alternatives, and are on windows (where raise() isn't available),
we can resort to this.
2020-05-28 09:21:35 +01:00
James Le Cuirot
56271ff271 meson: Fix underlinking of static libintl by trying iconv and pthread
I thought about checking for an intl pkg-config file but upstream are
not interested in adding one so there seems little point.

Closes #1851
2020-05-28 09:16:32 +01:00
James Le Cuirot
842dccfce7 meson: Remove transitive dep workaround now we require newer Meson
https://github.com/mesonbuild/meson/issues/1426 was fixed in 0.48.0
but we require 0.49.2.
2020-05-28 09:16:32 +01:00
Sebastian Dröge
f733eff2ee Merge branch 'fix-fedora-ci-build' into 'master'
Rebuild Fedora CI image

See merge request GNOME/glib!1488
2020-05-26 16:09:39 +00:00
Chun-wei Fan
47716bcec9 glib-compile-resources: Fix exporting on Visual Studio
Have the generated .c code decorate the prototypes with "G_MODULE_EXPORT"
instead of "extern" when --internal is not being used, so that we also
export the symbols from the generated code on Visual Studio-style
compilers.  If --internal is used, we decorate the prototypes with
"G_GNUC_INTERNAL", as we did before.

Note that since the generated .c code does not attempt to include the
generated headers (if one is also generated), the gnerated headers are
still generated as they were before.
2020-05-23 10:35:05 +08:00
Philip Withnall
2ba0f14b52 Merge branch 'w32reg-mui' into 'master'
MUI capabilities for GWin32RegistryKey

See merge request GNOME/glib!1341
2020-05-22 16:21:41 +00:00
Руслан Ижбулатов
f77a6a1626 GWin32AppInfo: Drop read_resource_string(), use GWin32RegistryKey
Now GWin32RegistryKey can internally do the same thing that
read_resource_string() does, and more.
2020-05-22 14:17:12 +00:00
Sebastian Dröge
2730e5dcc3 Merge branch 'fix-file-test' into 'master'
tests: Speed up the file test and make it more reliable

See merge request GNOME/glib!1508
2020-05-22 10:54:58 +00:00
Sebastian Dröge
743bbb90da Merge branch 'cancellable-test-fix' into 'master'
tests: Speed up the cancellable test

See merge request GNOME/glib!1506
2020-05-22 10:36:11 +00:00
Philip Withnall
26c433d26c tests: Speed up the file test and make it more reliable
Sometimes this test was timing out due to the file monitor notifications
taking longer than the arbitrary 2s delay before ending the test and
checking its results at the end of `iclosed_cb()`.

Avoid that timing-dependence by ending the test when the expected file
monitor notifications are seen, or after a 10s timeout (if so, the test
is failed).

This makes the test run 4× faster in the normal case, as it’s no longer
waiting for a timeout to elapse if the file monitor notifications come
in sooner.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-22 11:05:27 +01:00
Philip Withnall
43969bf41a tests: Port file test to use g_assert_*() rather than g_assert()
g_assert() can be compiled out with G_DISABLE_ASSERT, which renders the
test rather useless.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-22 11:04:34 +01:00
Florentina Mușat
4f0b0e1b57 Update Romanian translation 2020-05-22 09:10:42 +00:00