Commit Graph

19713 Commits

Author SHA1 Message Date
Mart Raudsepp
2ab231f52a docs: Fix dconf GSETTINGS_BACKEND name in gio overview 2018-12-21 17:38:06 +02:00
Philip Withnall
ab56f0459c tests: Add test for G_ALIGNOF()
To guarantee that its behaviour is always the same as the
G_STRUCT_OFFSET fallback.

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

https://gitlab.gnome.org/GNOME/glib/issues/1055
2018-12-21 13:22:55 +00:00
Philip Withnall
b7d2eeed17 gmacros: Don’t use __alignof__ in G_ALIGNOF implementation
It has different semantics from _Alignof and our G_STRUCT_OFFSET
fallback. See the comments in the diff for details.

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

https://gitlab.gnome.org/GNOME/glib/issues/1055
2018-12-21 13:09:57 +00:00
Philip Withnall
ea0da960ab Merge branch 'issues/1620' into 'master'
Issues/1620

See merge request GNOME/glib!554
2018-12-21 12:46:38 +00:00
Philip Withnall
87ea4ce1ff Merge branch 'gdbus-codegen-propemitschanged' into 'master'
honor "Property.EmitsChangedSignal" annotations

Closes #542

See merge request GNOME/glib!532
2018-12-21 12:34:55 +00:00
Philip Withnall
ac974a721f Merge branch 'suppress-int-in-bool-context-warning-with-g++' into 'master'
Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++

See merge request GNOME/glib!555
2018-12-21 12:16:30 +00:00
Kouhei Sutou
b8ac6e146a Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++
Note that it's not reported with gcc. It's only reported with g++.

C++ code to reproduce this warning:

    #include <glib-object.h>

    G_BEGIN_DECLS

    #define GARROW_TYPE_FILE (garrow_file_get_type())
    G_DECLARE_INTERFACE(GArrowFile,
                        garrow_file,
                        GARROW,
                        FILE,
                        GObject)

    struct _GArrowFileInterface {
      GTypeInterface g_iface;
    };

    G_DEFINE_INTERFACE(GArrowFile,
                       garrow_file,
                       G_TYPE_OBJECT)

    static void
    garrow_file_default_init(GArrowFileInterface *iface)
    {
    }

    G_END_DECLS

Build command line:

    % g++ -Wall -shared -o liba.so a.cpp $(pkg-config --cflags --libs gobject-2.0)

Message:

    In file included from /tmp/local.glib/include/glib-2.0/gobject/gobject.h:24,
                     from /tmp/local.glib/include/glib-2.0/gobject/gbinding.h:29,
                     from /tmp/local.glib/include/glib-2.0/glib-object.h:23,
                     from a.cpp:1:
    a.cpp: In function 'GType garrow_file_get_type()':
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:219:50: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
     #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
                                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:2026:11: note: in definition of macro '_G_DEFINE_INTERFACE_EXTENDED_BEGIN'
           if (TYPE_PREREQ) \
               ^~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:1758:47: note: in expansion of macro 'G_DEFINE_INTERFACE_WITH_CODE'
     #define G_DEFINE_INTERFACE(TN, t_n, T_P)      G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    a.cpp:16:1: note: in expansion of macro 'G_DEFINE_INTERFACE'
     G_DEFINE_INTERFACE(GArrowFile,
     ^~~~~~~~~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:178:25: note: in expansion of macro 'G_TYPE_MAKE_FUNDAMENTAL'
     #define G_TYPE_OBJECT   G_TYPE_MAKE_FUNDAMENTAL (20)
                             ^~~~~~~~~~~~~~~~~~~~~~~
    a.cpp:18:20: note: in expansion of macro 'G_TYPE_OBJECT'
                        G_TYPE_OBJECT)
                        ^~~~~~~~~~~~~
2018-12-20 11:24:53 +09:00
Cosimo Cecchi
dec0a6874e gdbusproxy: only connect to NameOwnerChanged for message buses
Names are a message bus feature, so it does not make sense to connect
to NameOwnerChanged when the underlying connection is not a message
bus.

Moreover, g_dbus_connection_signal_subscribe() will also enforce that
condition. Adding this extra check here is helpful to avoid a critical
warning when using GDBusProxy with peer-to-peer connections.

https://gitlab.gnome.org/GNOME/glib/issues/1620
2018-12-20 00:41:19 +00:00
Cosimo Cecchi
7d02e32644 gdbusconnection: add a getter for the flags property
Right now this can only be set at construction but not read back.
That seems unnecessarily restrictive, and we'll need to read these
flags from outside of gdbusconnection.c in the next commit, so let's
just make it public.

https://gitlab.gnome.org/GNOME/glib/issues/1620
2018-12-20 00:41:13 +00:00
Philip Withnall
3924ef6ac1 Merge branch 'glib-gresource-ld-binary' into 'master'
glib-compile-resources: Add external data option

Closes #1489

See merge request GNOME/glib!553
2018-12-19 17:10:00 +00:00
Ninja-Koala
d04b9c371d glib-compile-resources: Add external data option
Add option to not encode resource data into the C source file
in order to embed the data using `ld -b binary`. This improves compilation
times, but can only be done on Linux or other platforms with a
supporting linker.

(Rebased by Philip Withnall, fixing minor rebase conflicts.)

Fixes #1489
2018-12-19 16:43:21 +00:00
António Fernandes
3da40e9036 gutils: Use no-break space in g_format_size()
It's undesirable for quantity and unit to be separated by line breaks.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1625
2018-12-19 16:27:14 +00:00
Emmanuele Bassi
c33a98f42f Merge branch 'fix-gsubprocess-tests' into 'master'
Revert "tests: Fix GOptionContext leak in GSubprocess tests"

See merge request GNOME/glib!551
2018-12-19 15:14:29 +00:00
Philip Withnall
ccb3486543 Revert "tests: Fix GOptionContext leak in GSubprocess tests"
This reverts commit 52bab0254a.

It silently conflicted with another commit,
90ca3b4dd0, which was merged later than
it. I’ve kept commit 90ca3b because it also frees the GError; 52bab
doesn’t.

This is my failure to rebase and test old branches before merging them,
instead of assuming that the lack of automatically detected merge
conflicts actually means there are no merge conflicts.
2018-12-19 14:54:27 +00:00
Emmanuele Bassi
b709c6bde4 Merge branch 'rw-lock-docs' into 'master'
gthread: Clarify priority handling in GRWLock

See merge request GNOME/glib!376
2018-12-19 13:27:49 +00:00
Emmanuele Bassi
48c2d94d7b Merge branch 'gmarkup-docs' into 'master'
gmarkup: Make the documentation even more explicit about untrusted input

See merge request GNOME/glib!332
2018-12-19 13:27:05 +00:00
Philip Withnall
499e08a462 Merge branch 'gtask-set-name' into 'master'
gtask: Add a g_task_set_name() method

See merge request GNOME/glib!384
2018-12-19 13:16:07 +00:00
Philip Withnall
0b80445b0c Merge branch 'gsubprocess-communicate-utf8-tests' into 'master'
Add UTF-8 communication tests for GSubprocess

See merge request GNOME/glib!381
2018-12-19 13:15:04 +00:00
Philip Withnall
a81aa3cb96 Merge branch 'rc-align' into 'master'
Align the reference counted allocations

Closes #1581

See merge request GNOME/glib!473
2018-12-19 12:30:57 +00:00
Philip Withnall
ed007bb4cf docs: Mention handling of filenames containing colons in gio docs
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1623
2018-12-19 12:24:17 +00:00
Philip Withnall
88ceff934c docs: Use Unicode apostrophes in gio documentation
Let’s move into the 21st century.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:20:01 +00:00
Philip Withnall
3026efbc0f docs: Fix some minor wording problems in the gio documentation
And some missing apostrophes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:17:49 +00:00
Philip Withnall
30ed95216a docs: Fix capitalisation of ‘ETag’
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:17:32 +00:00
Philip Withnall
7bac53d41f docs: Improve formatting of literals in gio documentation
There was no distinction between literals which need to be typed, and
normal words in the prose.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:16:48 +00:00
Philip Withnall
04af8f12f0 Merge branch 'master' into 'master'
GTlsConnection: add ALPN support

See merge request GNOME/glib!520
2018-12-19 12:01:50 +00:00
Philip Withnall
0953338704 Merge branch 'tpm-keys-in-pem-files' into 'master'
gtlscertificate: Add support for TPM keys in PEM files

See merge request GNOME/glib!522
2018-12-19 11:53:17 +00:00
Thomas Jost
5731f06541
gdbus-codegen: honor "Property.EmitsChangedSignal" annotations
Co-Authored-by: Andy Holmes <andrew.g.r.holmes@gmail.com>
2018-12-19 11:06:31 +01:00
Philip Withnall
46900e55e7 Merge branch 'mcatanzaro/g-assert-error-doc' into 'master'
Improve documentation of g_assert_error()

See merge request GNOME/glib!549
2018-12-19 09:29:26 +00:00
Michael Gratton
1d62b3b452 Merge branch 'wip/1615-gdbus-codgen-nullable' into 'master'
gdbus-codegen: Add missing nullable and optional g-i annotations to generated code

Closes #1615

See merge request GNOME/glib!526
2018-12-19 07:25:19 +00:00
Michael Gratton
613f63f4a1 gdbus-codegen: Add missing nullable and optional g-i annotations to generated code
Fixes #1615
2018-12-19 18:00:25 +11:00
Michael Catanzaro
0618d67411 Improve documentation of g_assert_error()
This macro is intended for use in tests, but recommends as an
alternative to use a macro that is not intended for use in tests.
Fix it.
2018-12-19 02:29:14 +00:00
Scott Hutton
9032e8897d Implement support for ALPN in GTlsConnection, GDtlsConnection 2018-12-18 16:32:55 -08:00
Philip Withnall
26f783576d Merge branch 'docs-fixes' into 'master'
Various minor docs fixes

See merge request GNOME/glib!536
2018-12-18 15:35:07 +00:00
Matthias Clasen
4e776d9167 Merge branch 'no-free-check' into 'master'
Do not check for NULL when calling free()

See merge request GNOME/glib!547
2018-12-18 13:51:50 +00:00
Emmanuele Bassi
84d013ed46 Do not check for NULL when calling free()
The C standard guarantees that `free()` is `NULL`-safe.
2018-12-18 13:27:43 +00:00
Philip Withnall
8aff74e213 Merge branch 'wip/kalev/recursive-mutex-locker' into 'master'
Add GRecMutexLocker

See merge request GNOME/glib!528
2018-12-18 12:18:40 +00:00
Kalev Lember
e7e40ba1cf tests: Update GMutexLocker tests
Spawn a thread and assert that the mutex actually got locked and then
unlocked again, same as we do in GRecMutexLocker tests.
2018-12-18 12:24:17 +01:00
Kalev Lember
8c2e71bba0 Add GRecMutexLocker
This is the same as GMutexLocker, just for recursive mutexes.
2018-12-18 12:24:17 +01:00
Emmanuele Bassi
76d8fb65b2 Document the alignment for refcounted allocations
We use the same definition as malloc().
2018-12-18 11:18:43 +00:00
Emmanuele Bassi
f81723e675 Test the alignment of the refcounted box allocations
Check that the allocations are aligned regardless of the block size.
2018-12-18 11:18:43 +00:00
Emmanuele Bassi
87f0a5a219 Align the reference counted allocations
We need stronger alignment guarantees for the memory allocations done
through g_rc_box_alloc_full(): while the passed block size may be
aligned, we're not aligning the private data size; this means the
overall allocation may become unaligned, and this could raise issues
when we use the private data size as an offset to access the reference
count.

Fixes: #1581
2018-12-18 11:18:43 +00:00
Fredrik Ternerot
a437a50694 gtlscertificate: Allow any type of private key in PEM files
Allow any type of private key in PEM files by treating PEM guards ending
with "PRIVATE KEY-----" as a private key instead of looking for a
pre-defined set of PEM guards. This enables the possibility for custom
GTlsBackend to add support for new key types.

Test cases have been expanded to ensure PEM parsing works for private
key when either header or footer is missing.

Encrypted PKCS#8 is still rejected. Test case has been added for this to
ensure behaviour is the same before and after this change.
2018-12-18 11:43:08 +01:00
Fredrik Ternerot
73ca761a8d tests/tls-certificate: Add PEM files containing CRLF
Add test case to ensure correct parsing of PEM files containing CRLF
(\r\n) line endings.
2018-12-18 11:41:45 +01:00
Fredrik Ternerot
c7ee522172 tests/tls-certificate: Change to g_assert_null/nonnull
Use g_assert_null/g_assert_nonnull instead of g_assert since
g_assert can be compiled out with G_DISABLE_ASSERT.
2018-12-18 11:40:26 +01:00
Philip Withnall
2a64176b83 Merge branch 'g-alignof' into 'master'
gmacros: Add G_ALIGNOF superseding _g_alignof macro

Closes #1055

See merge request GNOME/glib!538
2018-12-18 10:29:22 +00:00
Philip Withnall
79dc99b9f0 Merge branch 'wip/add-shebang-to-test-script' into 'master'
spawn: add shebang line to script

See merge request GNOME/glib!546
2018-12-18 09:59:26 +00:00
Tapasweni Pathak
58bbdcf6c0 gmacros: Add G_ALIGNOF superseding _g_alignof macro 2018-12-18 13:59:23 +05:30
Ray Strode
3ab7a6544c spawn: add shebang line to script
downstream tools get confused when the script is missing a shebang
line, and having a shebang line doesn't hurt, so add one.
2018-12-17 16:19:31 -05:00
Philip Withnall
70eb076ac3 Merge branch '1601-appinfo-test-again' into 'master'
Support isolating directories for unit tests

Closes #538 and #1601

See merge request GNOME/glib!505
2018-12-17 17:51:37 +00:00
Philip Withnall
7a79984068 gutils: Drop fallback handling for NULL homedirs in XDG getters
It’s not possible for g_build_home_dir() to return NULL. The fallback
code here seems to originate from commit 1607e3f1 in 2005 (bug 169348),
where it was added with the explanation “Guard against g_home_dir being
NULL”.

The XDG Base Directory specification doesn’t have anything to say about
what to do when $HOME is unset:

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

It’s all a bit moot, though, becaause since commit 9cbfb560
(bug 773435), g_{get,build}_home_dir() cannot return NULL. So just drop
the fallback.

See discussion on
https://gitlab.gnome.org/GNOME/glib/merge_requests/505#note_386109.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00