Commit Graph

19639 Commits

Author SHA1 Message Date
Sebastian Dröge
f5541d8a6e Merge branch 'compiler-warnings' into 'master'
Fix a couple of wrong compiler warnings

See merge request GNOME/glib!615
2019-01-24 15:15:07 +00:00
Philip Withnall
791819c79d Merge branch 'writev' into 'master'
Add writev() API to GOutputStream and GPollableOutputStream

See merge request GNOME/glib!333
2019-01-24 14:42:51 +00:00
Sebastian Dröge
bd75dffc00 Fix compiler warning about uninitialized variable in desktop-app-info test
It would always be initialized but initialize it to NULL to silence the
compiler, and also check that it is not NULL anymore when we expect it
to contain a valid value.

../gio/tests/desktop-app-info.c: In function ‘test_fallback’:
../gio/tests/desktop-app-info.c:191:18: warning: ‘app’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   g_assert_true (g_app_info_equal (info1, app));
                  ^~~~~~~~~~~~~~~~
2019-01-24 16:37:23 +02:00
Sebastian Dröge
b4a5157f95 Fix compiler warning about uninitialized variable in giomodule
It could've never been uninitialized in this code but the code flow is
not obvious to the compiler. Initialize it to NULL and for clarity also
add an assertion that it is not NULL anymore on usage.

In file included from ../glib/glib.h:62,
                 from ../gobject/gbinding.h:28,
                 from ../glib/glib-object.h:23,
                 from ../gio/gioenums.h:28,
                 from ../gio/giotypes.h:28,
                 from ../gio/giomodule.h:28,
                 from ../gio/giomodule.c:25:
../gio/giomodule.c: In function ‘_g_io_module_get_default’:
../glib/gmessages.h:343:25: warning: ‘extension’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define g_debug(...)    g_log (G_LOG_DOMAIN,         \
                         ^~~~~
../gio/giomodule.c:912:17: note: ‘extension’ was declared here
   GIOExtension *extension, *preferred;
                 ^~~~~~~~~
2019-01-24 16:35:13 +02:00
Sebastian Dröge
b94940dfae Add test for blocking and non-blocking and async read/write(v) on UNIX streams 2019-01-24 16:26:05 +02:00
Sebastian Dröge
fe71a19716 Add test for blocking read/write/writev on GSocket*Streams 2019-01-24 16:26:02 +02:00
Sebastian Dröge
61520ae601 Add test for async read/write(v)/close on GSocketConnections 2019-01-24 16:25:59 +02:00
Sebastian Dröge
708aa8f4ee Add some tests for g_output_stream_writev() and its async variant 2019-01-24 16:25:56 +02:00
Sebastian Dröge
e6f5a50cd7 Implement GOutputStream::writev_fn() and GPollableOutputStream::writev_nonblocking() for GSocketOutputStream 2019-01-24 16:25:52 +02:00
Sebastian Dröge
9ae40d982a Rename timeout variables in gsocket.[ch] to include the unit as suffix
Makes it clearer which unit we work with. We have timeouts in seconds,
milliseconds and microseconds in here.
2019-01-24 16:25:50 +02:00
Sebastian Dröge
cc7f2f6b28 Add (type GSocketMsgFlags) to int-typed flags parameters in GSocket 2019-01-24 16:25:48 +02:00
Sebastian Dröge
f0a11b2727 Add g_socket_send_message_with_timeout() 2019-01-24 16:25:46 +02:00
Sebastian Dröge
63ea8d18f3 Simplify some code in GUnixOutputStream 2019-01-24 16:25:44 +02:00
Sebastian Dröge
90d9e4ab72 Implement GOutputStream::writev() and GPollableOutputStream::writev_nonblocking() GUnixOutputStream 2019-01-24 16:25:42 +02:00
Sebastian Dröge
c39264d35b Implement GOutputStream::writev_fn() for GLocalFileOutputStream on UNIX 2019-01-24 16:25:40 +02:00
Sebastian Dröge
89da9eb6c0 Change to g_warning() into assertions in GOutputStream
These would only happen if the API contract of the write() and writev()
functions was broken by subclasses.
2019-01-24 16:25:38 +02:00
Sebastian Dröge
0bcc177378 Add writev() / writev_all() API to GOutputStream and GPollableOutputStream
This comes with default implementations around the normal write
functions and async variants.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1431
2019-01-24 16:25:34 +02:00
Sebastian Dröge
042b8dc40d Introduce new GPollableReturn enum
This allows returning WOULD_BLOCK without allocating a GError, and
should later be used for various functions of GPollableOutputStream,
GPollableInputStream and anything else that can potentially block.
2019-01-24 16:25:31 +02:00
Philip Withnall
72329ea303 Merge branch 'fix-gdir-warning-msvc' into 'master'
gdir: shutup a warning when building with msvc

See merge request GNOME/glib!612
2019-01-24 10:44:34 +00:00
Ignacio Casal Quinteiro
57c779dab4 gdir: shutup a warning when building with msvc
This way we avoid the warning:
warning C4716: 'g_dir_new_from_dirp': must return a value
2019-01-24 11:31:38 +01:00
Philip Withnall
2821ff0fd2 Merge branch '1663-minint32-cxx-win32' into 'master'
gtypes: Define signed integer minimum values in terms of maximum values

Closes #1663

See merge request GNOME/glib!607
2019-01-23 17:35:01 +00:00
Emmanuele Bassi
85b5a72e69 Merge branch '1662-no-pedantry' into 'master'
build: Add -Wno-pedantic flag to compiler arguments

See merge request GNOME/glib!608
2019-01-23 14:15:18 +00:00
Philip Withnall
5c05af9aca build: Add -Wno-pedantic flag to compiler arguments
We do not support building with -Wpedantic due pervasively casting
function pointers through (void*) — see
https://wiki.gnome.org/Projects/GLib/CompilerRequirements#Function_pointer_conversions.

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

Helps https://gitlab.gnome.org/GNOME/glib/issues/1662
2019-01-23 13:38:40 +00:00
Philip Withnall
6a2cfde29f gtypes: Define signed integer minimum values in terms of maximum values
This is what limits.h does. It avoids a problem when compiling with MSVC
(in C++ mode) on Windows, whereby the 0x80000000 constant is interpreted
as unsigned, and *then* the unary minus is applied to it.

https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4146?view=vs-2017

Add a test which should hopefully catch problems with different
compilers’ interpretations of this in future.

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

https://gitlab.gnome.org/GNOME/glib/issues/1663
2019-01-23 13:23:53 +00:00
Philip Withnall
7035462da0 Merge branch 'contributing-docs' into 'master'
Update contribution documentation

See merge request GNOME/glib!590
2019-01-23 10:52:15 +00:00
Philip Withnall
3806c34df9 Merge branch '1655-int-signedness-casts' into 'master'
gvariant-parser: Add explicit unsigned-to-signed casts

Closes #1655

See merge request GNOME/glib!600
2019-01-23 09:55:33 +00:00
Matthias Clasen
ab40b242f1 Merge branch 'gio-extension-point-help' into 'master'
gio: Support "help" in extension point env vars

See merge request GNOME/glib!601
2019-01-22 18:29:36 +00:00
Matthias Clasen
8f71892862 Document "help" for extensions
Mention the special value "help" for the environment variables
that we document for picking extensions.
2019-01-22 13:18:50 -05:00
Matthias Clasen
df5b482781 gio: Support "help" in extension point env vars
Interpret the value "help" for environment variables that
are passed to _g_io_module_get_default(), and print the
names and priorities of available extensions.

This lets users explore what is available, and can be helpful
in figuring out why a certain extension was chosen as default.

It is similar in spirit to what we already do with environment
variables like G_DEBUG.
2019-01-22 13:18:42 -05:00
Emmanuele Bassi
3d9727c0b8 Merge branch 'keyfile-backend-strings' into 'master'
keyfile settings: Accept unquoted strings

See merge request GNOME/glib!603
2019-01-22 17:03:11 +00:00
Matthias Clasen
e6574b228e keyfile settings: Accept unquoted strings
It is hard for users to remember that strings have to be explicitly
quoted in the keyfile. Be lenient and accept strings that lack those
quotes.
2019-01-22 11:11:24 -05:00
Philip Withnall
4a49a31075 Merge branch 'piotrdrag/update-potfilesles-190121' into 'master'
Update POTFILES.in

See merge request GNOME/glib!602
2019-01-22 13:37:21 +00:00
Philip Withnall
91493db48b docs: Rewrite CONTRIBUTING.md to update it
The new version is significantly based on the proposed GTK+
CONTRIBUTING.md file
(https://gitlab.gnome.org/GNOME/gtk/merge_requests/358).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-22 13:36:29 +00:00
Philip Withnall
1afeaa6cb3 docs: Drop signatures at the bottom of CONTRIBUTING.md
They’re out of date. Probably best to leave the document unsigned, since
it’s supposed to be endorsed by all the GLib maintainers.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-22 13:36:29 +00:00
Philip Withnall
2327cc4f65 docs: Convert CONTRIBUTING.md to actually be Markdown
This doesn’t change its contents, just its formatting.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-22 13:36:29 +00:00
Piotr Drąg
a3157cc59a Update POTFILES.in 2019-01-21 20:51:41 +01:00
Philip Withnall
5506de3b92 Merge branch '1523-network-monitor-debugging' into 'master'
giomodule: Print the type of each default GIO module

See merge request GNOME/glib!319
2019-01-21 17:48:11 +00:00
Philip Withnall
92b3f22ad5 giomodule: Print the type of each default GIO module
This is useful for debugging in many situations. It’ll be printed with
G_MESSAGES_DEBUG=GLib-GIO or G_MESSAGES_DEBUG=all.

Mostly I need it for debugging the default GNetworkMonitor, but it will
work for all GIO module implementations.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-21 16:27:58 +00:00
Philip Withnall
be10f19752 Merge branch 'settings-portal' into 'master'
Settings portal

See merge request GNOME/glib!450
2019-01-21 12:02:43 +00:00
Matthias Clasen
2854522379 settings: Prefer the keyfile backend when sandboxed
When we are in a sandboxed situation, bump the priority
of the keyfile settings backend above the dconf one,
so we use a keyfile inside the sandbox instead of requiring
holes in the sandbox for dconf.
2019-01-20 21:03:35 -05:00
Matthias Clasen
c63e3a4ada settings: Add support for defaults to keyfile backend
Stacked databases and locks are dconf features that allow
management software like Fleet Commander to set system-wide
defaults and overrides centrally for applications.

This patch adds minimal support for the same to the keyfile
backend. We look for a keyfile named 'defaults' and a
lock-list named 'locks'.

Suitable files can be produced from a dconf database with
dconf dump and dconf list-locks, respectively.

The default location for these files is /etc/glib-2.0/settings/.
For test purposes, this can be overwritten with the
GSETTINGS_DEFAULTS_DIR environment variable.

Writes always go to the per-user keyfile.
2019-01-20 21:03:35 -05:00
Matthias Clasen
5357a23321 settings: Register the keyfile backend as extension
This was not done previously because the backend
could not be instantiated without parameters.
2019-01-20 21:03:35 -05:00
Matthias Clasen
26c8b29ee1 settings: Make the keyfile backend parameterless
Make it possible to instantiate a keyfile settings backend
without specifying parameters, by turning the arguments to
the new() function into construct-only properties. If no
filename is specified, default to
$XDG_CONFIG_HOME/glib-2.0/settings/keyfile
2019-01-20 21:03:35 -05:00
Philip Withnall
e3e4a09716 gvariant-parser: Add explicit unsigned-to-signed casts
Rather than prefixing unsigned numbers with unary minus operators and
expecting the implicit cast to carry the correct value through, add an
explicit cast to a signed type before the unary minus is applied.

In all four cases, an overflow check has already been done.

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

https://gitlab.gnome.org/GNOME/glib/issues/1655
2019-01-19 01:07:57 +00:00
Emmanuele Bassi
3fe6f2a44f Merge branch 'wip/nacho/gdtlsconnection-warning' into 'master'
gdtlsconnection: do not return on a void method

See merge request GNOME/glib!599
2019-01-18 17:59:21 +00:00
Ignacio Casal Quinteiro
e9506d7719 gdtlsconnection: do not return on a void method
Fixes:
warning C4098: 'g_dtls_connection_set_advertised_protocols': 'void' function returning a value
2019-01-18 17:27:44 +01:00
Emmanuele Bassi
da2bf2a280 Merge branch '1500-list-store-state' into 'master'
gliststore: Store validity of last_position explicitly

Closes #1500

See merge request GNOME/glib!596
2019-01-18 16:03:56 +00:00
Philip Withnall
8ce0c49f9c Merge branch '1653-gsocketclient-slow-flaky' into 'master'
tests: Tag gsocketclient-slow test as ‘flaky’

See merge request GNOME/glib!597
2019-01-18 15:57:38 +00:00
Philip Withnall
5612c90fdf tests: Tag gsocketclient-slow test as ‘flaky’
It needs investigating and fixing properly, but let’s not let it disrupt
the CI in the meantime.

Follow-up in https://gitlab.gnome.org/GNOME/glib/issues/1653.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-18 15:27:45 +00:00
Philip Withnall
c9aba16af3 gliststore: Store validity of last_position explicitly
Rather than storing it as an invalid value in last_position, store it as
a separate boolean.

This introduces no functional changes, but should fix some warnings from
MSVC.

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

https://gitlab.gnome.org/GNOME/glib/issues/1500
2019-01-18 15:22:19 +00:00