Commit Graph

22318 Commits

Author SHA1 Message Date
Andre Miranda
622806d5cf glocalfileinfo: Add support for optional/required fields in stat bufs
This is a step towards supporting `statx()`, which allows the set of
fields it returns to be specified by the caller. Currently, the existing
`stat()` and `fstat()` calls continue to be made, and there are no
behavioural changes — but the new wrapper functions will be extended in
future.

Helps: #1970
2020-08-14 17:30:11 +01:00
Andre Miranda
8edbfe8bb0 glocalfileinfo: Use accessors to access struct stat members
This will allow the actual struct in use to be changed in future without
code changes everywhere.

Helps: #1970
2020-08-14 17:30:11 +01:00
Florentina Mușat
83a59e99ff Update Romanian translation 2020-08-14 12:32:40 +00:00
Philip Withnall
91ccc46fe5 Merge branch 'json-stripblanks-docs' into 'master'
docs: glib-compile-resources: json-stripblanks

See merge request GNOME/glib!1615
2020-08-13 08:07:51 +00:00
James Westman
2ec4e05733 docs: glib-compile-resources: json-stripblanks
Document the `json-stripblanks` preprocessing option for .gresource.xml files.
2020-08-13 08:07:51 +00:00
Fran Dieguez
80887d5044 Update Galician translation 2020-08-12 23:56:12 +00:00
Thibault Martin
b301c92ee9 Update French translation 2020-08-12 14:36:03 +00:00
Philip Withnall
056aaf36f8 Merge branch 'master' into 'master'
gdatetime: Add %f format specifier and microsecond precision to g_date_time_format_iso8601

See merge request GNOME/glib!1605
2020-08-12 13:37:06 +00:00
Philip Withnall
d31c771185 Merge branch 'wip/alloc-memset-inlining' into 'master'
gslice: Allow inlining of memset() in g_slice_new0() macro

Closes #5

See merge request GNOME/glib!1597
2020-08-12 13:29:27 +00:00
Johan Bjäreholt
8e13683f70 gdatetime: Format iso8601 strings with microsecond precision 2020-08-12 15:07:40 +02:00
Johan Bjäreholt
bcb48a18e3 gdatetime: Fix alphabetical order of format specifiers 2020-08-12 15:07:40 +02:00
Johan Bjäreholt
3b0eca5be6 gdatetime: Add %f format specifier for microseconds
Same specifier used as in pythons datetime.strptime

Change-Id: Ic15a63e3c83674b2e8a05bc79ef2665738e71a5a
2020-08-12 15:07:38 +02:00
Sebastian Dröge
e4f4a40fb4 Merge branch 'file-delete-docs' into 'master'
gfile: Document TOCTTOU avoidance using g_file_delete()

See merge request GNOME/glib!1613
2020-08-12 10:00:12 +00:00
Philip Withnall
373c54a52c gfile: Document TOCTTOU avoidance using g_file_delete()
Don’t call `g_file_query_exists()` followed by `g_file_delete()`. Just
call `g_file_delete()` and check the error.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-12 10:48:28 +01:00
Sebastian Dröge
1cb567f3c0 Merge branch 'g-socket-receive-annotations' into 'master'
gio: add missing (out) annotations to g_socket_receive*

Closes #2176

See merge request GNOME/glib!1614
2020-08-11 18:06:11 +00:00
Phil Clayton
4a848a0aca gio: add missing (out) annotations to g_socket_receive*
This makes the introspection interface to g_socket_receive* consistent
with the interface to g_input_stream_read*.

Closes #2176
2020-08-11 18:34:16 +01:00
Daniel Mustieles
03f1980fb8 Updated Spanish translation 2020-08-11 12:19:50 +02:00
Efstathios Iosifidis
b7db04865d Update Greek translation 2020-08-08 16:06:14 +00:00
Yuri Chornoivan
55018d3f99 Update Ukrainian translation 2020-08-08 15:00:20 +00:00
Emin Tufan Çetin
b660ffe161 Update Turkish translation 2020-08-07 15:04:24 +00:00
Philip Withnall
b99008f57f 2.65.1
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 15:29:26 +01:00
Philip Withnall
e30fc2e116 Merge branch 'uri-tweaks' into 'master'
Various GUri code, documentation and API fixes

Closes #2149

See merge request GNOME/glib!1610
2020-08-07 14:14:29 +00:00
Philip Withnall
cacf9c2926 guri: Add various small new tests to increase branch coverage
Nothing particularly interesting or major.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
b654eb1846 guri: Make G_URI_FLAGS_PARSE_STRICT the default
Make `G_URI_FLAGS_PARSE_RELAXED` available instead, for the
implementations which need to handle user-provided or incorrect URIs.
The default should nudge people towards being compliant with RFC 3986.

This required also adding a new `G_URI_PARAMS_PARSE_RELAXED` flag, as
previously parsing param strings *always* used relaxed mode and there
was no way to control it. Now it defaults to using strict mode, and the
new flag allows for relaxed mode to be enabled if needed.

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

Fixes: #2149
2020-08-07 14:02:18 +01:00
Philip Withnall
943b1e45ab guri: Don’t fail g_uri_is_valid() if URI is missing a hostname
According to my reading of
https://tools.ietf.org/html/rfc3986#section-4, the only requirement for
a URI to be ‘absolute’ (actually, not a relative reference) is for the
scheme to be specified. A hostname doesn’t have to be specified: see any
of the options in the `hier-part` production in
https://tools.ietf.org/html/rfc3986#appendix-A which don’t include
`authority`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
b5c59cc3fc guri: Use gssize for array/string lengths
This reduces the possibility for overflow, and makes the code a little
more conventional to read.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
e446c3487b guri: Change type of g_uri_escape_bytes() to use guint8
`guint8` is the conventional way in modern GLib APIs to represent ‘a byte
which could contain arbitrary binary’. `guchar` is not advised for that
(even though it’s equivalent) because it could be misread as `gchar`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
ceda9755de guri: Clear return values on error from g_uri_params_iter_next()
This reduces the chance of the caller accidentally double-freeing or
use-after-free-ing something.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
83597b9e57 guri: Use NONE values of flags rather than 0
This introduces no functional changes, but makes the code a little
easier to read.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
41a21c3566 guri: Add links to RFC 3986 in code comments
This should make the RFC easier to refer to in future.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
f873b88f89 guri: Add G_URI_HIDE_QUERY
Sometimes there are sensitive details in URI query components, so we
should provide the option for hiding them too.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
ae6a0ef8b8 guri: Tweak quotes in error strings
Use nice curly Unicode quotes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
40873f8452 guri: Use g_steal_pointer() to make ownership transfer clearer
This introduces no functional changes, just makes the code a bit easier
to read.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
de0ebf8a5f guri: Minor code formatting fixes
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
1f1efbbb05 guri: Rename G_URI_ERROR_MISC to G_URI_ERROR_FAILED
This brings its naming in line with the ‘generic’ error codes in other
error domains.

This is not an API break since `GUriError` hasn’t been in a release yet.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
ff60d2ebf5 guri: Various minor documentation tweaks and improvements
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:17 +01:00
Sebastian Dröge
602b7cca33 Merge branch 'uri-path-slashes' into 'master'
guri: Document and check restrictions on path prefixes

See merge request GNOME/glib!1612
2020-08-07 12:57:17 +00:00
Sebastian Dröge
cff78507dc Merge branch 'uri-bees' into 'master'
guri: Always prepend `//` to the host when building a URI

See merge request GNOME/glib!1611
2020-08-07 12:38:49 +00:00
Philip Withnall
89cf298b19 guri: Document and check restrictions on path prefixes
RFC 3986, section 3 says:
> The scheme and path components are required, though the path may be
> empty (no characters).  When authority is present, the path must
> either be empty or begin with a slash ("/") character.  When
> authority is not present, the path cannot begin with two slash
> characters ("//").  These restrictions result in five different ABNF
> rules for a path (Section 3.3), only one of which will match any
> given URI reference.

(See https://tools.ietf.org/html/rfc3986#section-3.)

Given that those conditions are almost always going to be true, and that
typically the number and form of arguments passed to g_uri_join() will
be known at compile time, it would be unnecessarily awkward to add a
`GError` argument to g_uri_join() to detect these situations.

Instead, add precondition checks and document the restrictions.
Developers are responsible for ensuring their paths are in the right
format themselves.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 13:24:12 +01:00
Philip Withnall
623cb10f55 guri: Always prepend // to the host when building a URI
This is needed to distinguish the host (‘authority’ in the terms of RFC
3986) from a path if a scheme is not present.

It can be seen from the grammar in RFC 3986
(https://tools.ietf.org/html/rfc3986#appendix-A) that `authority` only
ever appears after `"//"`.

Spotted by Simon McVittie in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1606#note_884893.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 12:51:31 +01:00
Sebastian Dröge
13ad6ab83c Merge branch 'patch-1' into 'master'
Fix multiple typos in guri.c

See merge request GNOME/glib!1609
2020-08-06 14:36:51 +00:00
Felix Yan
161168c672 Fix multiple typos in guri.c 2020-08-06 14:18:01 +00:00
Sebastian Dröge
d7e0fde3ca Merge branch 'dont-use-gnulib-ios' into 'master'
meson: Don't use gnulib for printf on iOS

Closes #1868

See merge request GNOME/glib!1607
2020-08-06 06:07:46 +00:00
Nirbheek Chauhan
77f9b0b9d5 meson: Don't use gnulib for printf on iOS
iOS and tvOS use the same printf family as macOS, and these all have
been available on macOS for a long time.

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/1868
2020-08-06 05:16:15 +05:30
Sebastian Dröge
a2c8f6f719 Merge branch 'guri-join-schemeless' into 'master'
uri: allow to join a partial URI, without scheme

Closes #2166

See merge request GNOME/glib!1606
2020-08-05 19:14:21 +00:00
Marc-André Lureau
0ba7ebfda9 uri: allow to join a partial URI, without scheme
Fixes: #2166

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-08-05 22:40:08 +04:00
Philip Withnall
bb1df0e515 Merge branch 'uri-params-iter' into 'master'
Add GUriParamsIter

See merge request GNOME/glib!1572
2020-08-05 16:07:42 +00:00
Philip Withnall
df8dc7fc38 Merge branch 'guri-gio' into 'master'
Replace _g_uri_parse_authority() with GUri

Closes #2156

See merge request GNOME/glib!1567
2020-08-05 16:06:02 +00:00
Philip Withnall
71d1a28afb Merge branch 'ipv6-zoneid' into 'master'
Make g_hostname_is_ip_address() accept ipv6 zoneid

See merge request GNOME/glib!1604
2020-08-05 16:00:32 +00:00
Philip Withnall
931496b93a Merge branch 'replace-destination' into 'master'
GFile: Document that G_FILE_CREATE_REPLACE_DESTINATION can only be used with...

See merge request GNOME/glib!1594
2020-08-05 15:39:34 +00:00