ptr_array_new(len, ., TRUE) ensures that there are at least len+1
elements in pdata, and that pdata[0] is null, but leaves the rest of
pdata uninitialized. After copying the array data into pdata[1] to
pdata[len-1] inclusive, we still need to make sure pdata[len] is a
null terminator.
Note that if len is 0, then pdata is not guaranteed to be non-null. If
it's null, then we can't add null-termination to it until its size
is updated.
Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2877
Signed-off-by: Simon McVittie <smcv@collabora.com>
The gobject-introspection build goes through the GLib types when
generating the introspection data for GLib, but it does not include
glib-object.h, otherwise all GObject symbols would end up inside the
GLib namespace. This means we need to import the gobject-visibility.h
header inside glib-types.h. Since the header is guarded by a once
pragma, it doesn't really affect any legitimate user of the C API.
We cannot use `gvisibility_h` for different visibility header files; you
never know when you're going to refer to the variable again, and
projects might end up needing to retrieve the variable contents—like,
for instance, gobject-introspection using glib as a subproject.
Historically GPtrArray made possible to compare pointers of pointers values
that it holds, however this is inconvenient in most cases as it requires
wrapper functions and not friendly castings.
So, add two functions that allow to perform the comparisons between the
pointer values that a GPtrArray holds following the same syntax that we
share everywhere in the codebase.
Fix a regression that appeared after adding support for nanosecond
timestamps to set_mtime_atime(). User-visible effect: when copying a
file from a gvfs MTP mountpoint to the local filesystem, the file's
mtime is set to 0.
This behavior happens when setting G_FILE_ATTRIBUTE_TIME_MODIFIED first,
then G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC. Setting the second attribute
ends up in set_mtime_atime() with mtime_usec_value set, and mtime_value
== NULL. When mtime_value is NULL, the tv_sec part of the timestamp
should be fetched by lazy_stat(), but set_mtime_atime() fails to assign
it properly, and tv_sec stays at 0, leading to losing the main part of
the timestamp.
Fix the issue by setting times_n[1].tv_sec to the value fetched from
lazy_stat().
Fixes: b33ef610de ("Add functionality to preserve nanosecond timestamps")
Fixes: 15cb123c82 ("glocalfileinfo: don't call both utimes and utimensat")
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
If proxy-libintl has already been configured before we get to glib, we
will pick that up in dependency('intl'), which then does compiler
checks on it. This was written to assume that the first check will not
find a subproject for libintl, so force it with allow_fallback: false.
Also update the proxy-libintl wrap file and get rid of the explicit
subproject() call.
Reported by Benjamin Gilbert at
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3172
This test assumes that pcre2 is not provided by a subproject, so force
it to be that. Explicitly allow fallback in the next check (although
it's implied already).
`search_token` cannot be `NULL` at this point (guaranteed by all the
current call sites of `desktop_file_dir_unindexed_search()`), so remove
an unnecessary `NULL` check.
Add an assertion to make the nullability clear.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Coverity CID: #1502196, #1502193
If the port is not specified, then a default port should be assumed.
This is how everybody expects URIs to work and it's how GProxyResolver
should work too.
We already have lots of tests to ensure this works as expected; however,
the documentation currently does not allow it. Change the documentation
to match reality.
Fixes#2832