Commit Graph

20496 Commits

Author SHA1 Message Date
Philip Withnall
ec61daf503 garray: Rewrite binary search calculation to avoid integer overflow
If `right` and `left` are both near `G_MAXUINT`, it’s possible for the
addition to overflow, even if the eventual result would fit in a
`guint`. Avoid that by operating on the difference instead.

The difference is guaranteed to be positive due to the prior `left <=
right` check.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 11:35:18 +01:00
Philip Withnall
bc0fcddc18 tests: Use g_ptr_array_set_free_func() rather than manual free()
We don’t need to free array elements manually.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:17:20 +01:00
Philip Withnall
121b6bc599 tests: Add missing array length checks
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:17:08 +01:00
Philip Withnall
625055f60e tests: Fix array length calculations in array tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:16:41 +01:00
Philip Withnall
b4943aa360 gptrarray: Correctly set copied array length in g_ptr_array_copy()
The allocation size was set correctly before, but not the array length,
so the copied array appeared to have zero elements.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:15:57 +01:00
Philip Withnall
1ac8d50331 gptrarray: Set free func on copied array in g_ptr_array_copy()
Otherwise its elements (which have just all been copied) will leak.

Spotted by Xavier Claessens in
https://gitlab.gnome.org/GNOME/glib/merge_requests/918#note_555867.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:15:09 +01:00
Nirbheek Chauhan
d076c4c688 Merge branch 'gio-docs-fixes' into 'master'
gio: Fix minor docs mistakes

See merge request GNOME/glib!994
2019-07-15 23:39:18 +00:00
Matthew Leeds
ce9ea30b1d gio: Fix minor docs mistakes 2019-07-15 16:07:18 -07:00
Philip Withnall
2ac44f3111 Merge branch 'key-file-no-file' into 'master'
key file: Handle filename being NULL

Closes #1825

See merge request GNOME/glib!984
2019-07-15 12:50:45 +00:00
Philip Withnall
493b8ca021 Merge branch 'keyfile-portal-fixes' into 'master'
Keyfile portal fixes

See merge request GNOME/glib!985
2019-07-15 12:32:01 +00:00
Matthias Clasen
addb8c158a settings: Tweak priorities for keyfile backend
We want to use the keyfile backend in sandboxes,
but we want to avoid people losing their existing
settings that are stored in dconf. Flatpak does
a migration from dconf to keyfile, but only if
the app explictly requests it.

From an app perspective, there are two steps to
the dconf->keyfile migration:
1. Request that flatpak do the migration, by adding
   the migrate-path key to the metadata
2. Stop adding the 'dconf hole' to the sandbox

To keep us from switching to the keyfile backend
prematurely, look at whether the app has stopped
requesting a 'dconf hole' in the sandbox.
2019-07-15 13:01:56 +01:00
Matthias Clasen
9c5d3a6081 portal: Add a getter for dconf access
Add method to find whether the sandbox provides
access to dconf. This will be used to tweak
the priorities for the keyfile settings backend.
2019-07-15 13:01:56 +01:00
Philip Withnall
003b6dacbb Merge branch 'fix-static-test-3' into 'master'
Fix test failures for static builds (Reworked again)

Closes #1648

See merge request GNOME/glib!989
2019-07-15 11:01:04 +00:00
DDoSolitary
2718245dc2 Fix test failures for static builds
The plugin modules in these tests get statically linked with a separate
copy of GLib so they end up calling vfuncs in their own copy of GLib.

Fixes #1648
2019-07-15 11:01:04 +00:00
Philip Withnall
618d3e4a0a Merge branch 'issue-943' into 'master'
Improve the documentation for G_DEFINE_TYPE_WITH_PRIVATE

Closes #943

See merge request GNOME/glib!990
2019-07-15 08:53:52 +00:00
Christoph Reiter
b6566ad92e Merge branch 'slow-tests' into 'master'
build: Increase the slow test timeout to 180s

See merge request GNOME/glib!934
2019-07-14 21:15:53 +00:00
Emmanuele Bassi
87016536a6 Improve the documentation for G_DEFINE_TYPE_WITH_PRIVATE
Connect the dots between G_ADD_PRIVATE and the various G_DEFINE_* macros
that use it, as well as expanding the code example for
G_DEFINE_TYPE_EXTENDED with a private instance data declaration.

Closes: #943
2019-07-14 17:50:35 +01:00
Emmanuele Bassi
d56bdeb926 Merge branch 'nirbheek/remove-outdated-libtool-stuff' into 'master'
gio/tests: Remove code and comments referring to libtool

See merge request GNOME/glib!987
2019-07-13 11:13:56 +00:00
Nirbheek Chauhan
5e7f12b0ce gio/tests: Remove code and comments referring to libtool 2019-07-13 12:23:07 +05:30
Philip Withnall
88b9e71c9c Merge branch 'fixing_gio_manpage_typo' into 'master'
Fixing a small typo in docs/references/gio/gio.xml

Closes #1828

See merge request GNOME/glib!986
2019-07-12 16:12:15 +00:00
Emmanuel Fleury
628e448e02 Fixing a small typo in docs/references/gio/gio.xml
Fix issue #1828
2019-07-12 17:49:51 +02:00
Matthias Clasen
953f23f13c key file: Handle filename being NULL
This happens when we are default-constructed
without explicit arguments.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1825
2019-07-10 11:14:03 -04:00
Philip Withnall
b80c17e325 Merge branch 'patch-1' into 'master'
gio: fix typo in g_settings_reset documentation

See merge request GNOME/glib!981
2019-07-10 14:22:36 +00:00
Sonny Piers
40b3efe931 gio: fix typo in g_settings_reset documentation 2019-07-10 13:51:53 +00:00
Philip Withnall
caaa131d8a Merge branch 'gmacros-h-support-clang-cl' into 'master'
gmacros.h: Add better support for clang-cl

See merge request GNOME/glib!980
2019-07-10 09:46:25 +00:00
Chun-wei Fan
45a21dcc3a Merge branch 'fix-module-tests-msvc' into 'master'
Fix module tests on Visual Studio builds

See merge request GNOME/glib!937
2019-07-10 07:30:41 +00:00
Chun-wei Fan
d616ca25ff gmacros.h: Support deprecation macros better on clang-cl
Use the GCC-style definition for the deprecation warning macros so that
builds using those won't break due to how they are placed as clang-cl
seems to not support __declspec(deprecated) very well.  Also make sure
that we do indeed support the temparary disabling of deprecation
warnings on clang-cl, as the MSVC ones don't really work on clang-cl.
2019-07-10 10:47:35 +08:00
Chun-wei Fan
2bc73d7281 glib/gmacros.h: Check for __clang__ for g_autoptr
clang-cl does support __attribute__((cleanup)), which is what is used
for the g_auto* macros, but neither it, nor clang.exe defines __GNUC__
when they are used in a MSVC cmd.exe environment.  It does, however,
define __clang__.

So, check for the presence of the __clang__ macro to enable g_autoptr as
well, so that we can build things with MSVC builds that make use
of g_autoptr via pretending to be MSVC by using clang-cl.
2019-07-10 10:32:49 +08:00
Emmanuele Bassi
2e39f4148e Merge branch 'fix-prepare-annot' into 'master'
gmain: Fix g_main_context_prepare priority annotation

See merge request GNOME/glib!961
2019-07-09 12:21:14 +00:00
Emmanuele Bassi
c23ee5fabf Merge branch 'garray_binary_search' into 'master'
Add g_array_binary_search() to garray API

Closes #373

See merge request GNOME/glib!850
2019-07-09 10:39:34 +00:00
Emmanuel Fleury
104fca78cd Add g_array_binary_search() to garray API
Original code written by Christian Hergert

Fix issue #373
2019-07-09 12:12:18 +02:00
Philip Withnall
8cd0a2c328 Merge branch 'ensure-keyfile-settings' into 'master'
Ensure that the keyfile settings backend exists

Closes #1822

See merge request GNOME/glib!974
2019-07-09 08:48:17 +00:00
Philip Withnall
495a7de22f Merge branch 'master' into 'master'
docs: update build instructions for selinux

Closes #1823

See merge request GNOME/glib!976
2019-07-09 08:40:15 +00:00
Chris Packham
3f51694185 docs: update build instructions for selinux
Commit 8cc92bcca ("meson: Turn selinux into a meson feature and make it
auto by default") update the selinux option to be a feature with
instead of a boolean. Update the documentation to reflect this.

Closes: #1823
2019-07-09 17:34:16 +12:00
Matthias Clasen
5f8d787815 Ensure that the keyfile settings backend exists
We need to bring the type into existence.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1822
2019-07-08 10:32:18 -04:00
Philip Withnall
18cfe50caa Merge branch 'patch-1' into 'master'
doc: fix typo in gio/gresource.c

See merge request GNOME/glib!973
2019-07-08 12:17:03 +00:00
Sonny Piers
06f27fc208 doc: fix typo in gio/gresource.c 2019-07-08 10:48:23 +00:00
Kukuh Syafaat
78379099a6 Update Indonesian translation 2019-07-08 08:28:38 +00:00
Philip Withnall
4e538e674c Merge branch 'bug-787-investigation' into 'master'
Fix memory error with GDBusConnection in g_test_dbus_down()

Closes #787

See merge request GNOME/glib!963
2019-07-05 11:52:28 +00:00
Philip Withnall
711b4b0578 Merge branch 'win32-enhance-gtimezone' into 'master'
Win32 enhance and fix gtimezone

Closes #870

See merge request GNOME/glib!912
2019-07-05 11:08:32 +00:00
Chun-wei Fan
5d54727180 glib/tests/gdatetime.c: Fix TZ envvar test on Windows
Windows does not recognize the "America/Recife" as a valid timezone
identifier, so setting the TZ envvar to that will result in "UTC" to
be returned on Windows.

Instead, set TZ to be the Windows equivilant "SA Eastern Standard
Time", and see whether that is indeed our identifier when we create the
GTimeZone using that.
2019-07-05 18:52:02 +08:00
Chun-wei Fan
f24444c585 gtimezone.c: Fix identifier assignment on Windows
On Windows, we may be using the US DST boundaries by using the default
"Pacific Standard Time" for rules_from_windows_time_zone() in
rules_from_identifier().  This has the unfortunate side-effect of
hardcoding the out_identifier to "Pacific Standard Time", which is
likely not what we want.

Instead, upon retrieving the items successfully using
rules_from_windows_time_zone ("Pacific Standard Time", ...), we just
set the out_identifier to whatever identifier that was passed into
rules_from_identifier().
2019-07-05 18:52:02 +08:00
Chun-wei Fan
5ca4ac16ef Update the gdatetime Test Program for Windows
Update the gdatetime test program to make use of the updates that was
done in gtimezone.c in the previous commit, so that we don't have to
worry what language version of Windows the tests are being run in, but
instead be assured that we produce and check for the English-language
time zone name strings.

Also, instead of testing for "Pacific Standard Time" in
test_GDAteTime_printf(), use GetDynamicTimeZoneInformation() to get the
actual time zone string (where the system running the test program is)
we want to check for, because on Windows the actual result will be
dependent on which timezone the system running the test program is in.

https://bugzilla.gnome.org/show_bug.cgi?id=719344
2019-07-05 18:52:02 +08:00
Chun-wei Fan
2e5d3aa911 glib/gtimezone.c: Use RegLoadMUIStringW() to query Std/Dlt strings
The existing method of using RegQueryValueExW() to query the Std/Dlt
strings can only retrive the localized versions of those strings, so
that means they will vary by the language version of Windows.  Instead,
use RegQueryValueExW() only as a fallback when RegLoadMUIStringW() fails,
as RegLoadMUIStringW() can query for the Std and Dlt strings in
whatever language we need by setting the locale stuff programatically on
the fly.
2019-07-05 18:52:02 +08:00
Chun-wei Fan
c868123c0a glib/gtimezone.c: Use Unicode versions of Windows Registry API
We are going to use RegLoadMUIStringW() in the next commit, since there
is no real RegLoadMUIStringA() function (it exists as a stub only).
This is done so that we are consistent along the way

Also fix rule_from_windows_time_zone_info() as we can't just do a strncpy()
of tzi->StandardName and tzi->DaylightName directly, as they are wchar_t/
gunichar2 strings, where we must convert to UTF-8 first.

https://bugzilla.gnome.org/show_bug.cgi?id=719344
2019-07-05 18:51:49 +08:00
Philip Withnall
dc774db608 Merge branch 'dboles/gmacros-docs' into 'master'
docs.c: Forward link from g_auto* → G_DEFINE_AUTO*

See merge request GNOME/glib!971
2019-07-05 09:56:42 +00:00
Daniel Boles
71ccfadbe1 docs.c: Forward link from g_auto* → G_DEFINE_AUTO*
We said the type must support being cleaned up and will be cleaned up in
an appropriate way, but in order to figure out how to do that, you had
to jump forward in the documentation to the other macros. Just say them.
2019-07-05 10:34:27 +01:00
Philip Withnall
1230be3d11 Merge branch 'wip/lantw/gdatetime-unset-lc-all-for-the-test-as-well' into 'master'
gdatetime: Unset LC_ALL for the test as well

See merge request GNOME/glib!970
2019-07-05 09:30:56 +00:00
Ting-Wei Lan
7089f67f14 gdatetime: Unset LC_ALL for the test as well
This is a follow-up to a0c7f85437.

In addition LC_MESSAGES, we should remove LC_ALL from the environment
as well. Otherwise, LC_ALL overrides LC_MESSAGES, causing the test to
fail on FreeBSD when LC_ALL is set to a non-English locale.
2019-07-05 15:13:11 +08:00
Philip Withnall
8efe050a39 Merge branch 'master' into 'master'
Fix typo in request handle

See merge request GNOME/glib!968
2019-07-04 16:23:45 +00:00