Commit Graph

19827 Commits

Author SHA1 Message Date
Emmanuel Fleury
6e49b36cc2 Fixing signedness in glib/gdate.c
glib/gdate.c: In function ‘g_date_add_months’:
glib/gdate.c:1732:27: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   g_return_if_fail (years <= G_MAXUINT16 - d->year);
                           ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gdate.c:1732:3: note: in expansion of macro ‘g_return_if_fail’
   g_return_if_fail (years <= G_MAXUINT16 - d->year);
   ^~~~~~~~~~~~~~~~
glib/gdate.c: In function ‘g_date_add_years’:
glib/gdate.c:1816:28: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   g_return_if_fail (nyears <= G_MAXUINT16 - d->year);
                            ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gdate.c:1816:3: note: in expansion of macro ‘g_return_if_fail’
   g_return_if_fail (nyears <= G_MAXUINT16 - d->year);
   ^~~~~~~~~~~~~~~~
2019-01-28 15:29:21 +01:00
Emmanuel Fleury
a419146578 Fixing signedness in g_ptr_array_insert():glib/garray.c
glib/garray.c: In function ‘g_ptr_array_insert’:
glib/garray.c:1522:14: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   if (index_ < rarray->len)
              ^
2019-01-28 15:29:21 +01:00
Emmanuel Fleury
3384ed3f7f Fixing signedness warnings in glib/gdatetime.c
glib/gdatetime.c: In function ‘get_iso8601_int’:
glib/gdatetime.c:1142:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   for (i = 0; i < length; i++)
                 ^
glib/gdatetime.c: In function ‘get_iso8601_seconds’:
glib/gdatetime.c:1175:9: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   if (i == length)
         ^~
glib/gdatetime.c:1178:12: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   for (; i < length; i++)
            ^
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gtimezone.h:27,
                 from glib/gdatetime.h:31,
                 from glib/gdatetime.c:62:
glib/gdatetime.c: In function ‘initialize_alt_digits’:
glib/gdatetime.c:2806:27: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘long int’ [-Werror=sign-compare]
       g_assert (digit_len < buffer + sizeof (buffer) - buffer_end);
                           ^
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gdatetime.c:2806:7: note: in expansion of macro ‘g_assert’
       g_assert (digit_len < buffer + sizeof (buffer) - buffer_end);
       ^~~~~~~~
2019-01-28 15:29:14 +01:00
Emmanuel Fleury
b8efd0df41 Fixing signedness in digest_to_string:glib/gchecksum.c
glib/gchecksum.c: In function ‘digest_to_string’:
glib/gchecksum.c:186:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   for (i = 0; i < digest_len; i++)
                 ^
2019-01-28 15:26:43 +01:00
Emmanuel Fleury
bfedf0f144 Fixing signedness in gdataset.c
glib/gdataset.c: In function ‘g_datalist_clear_i’:
glib/gdataset.c:233:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
       for (i = 0; i < data->len; i++)
                     ^
glib/gdataset.c: In function ‘g_datalist_clear’:
glib/gdataset.c:270:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
       for (i = 0; i < data->len; i++)
                     ^
glib/gdataset.c: In function ‘g_datalist_foreach’:
glib/gdataset.c:1147:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
       for (j = 0; j < d->len; j++)
                     ^
2019-01-28 15:24:06 +01:00
Emmanuel Fleury
5ca8c2fa8f Fixing signedness in g_ptr_array_maybe_expand():garray.c
../glib.git/glib/garray.c: In function ‘g_ptr_array_maybe_expand’:
../glib.git/glib/garray.c:1172:43: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
   if G_UNLIKELY ((G_MAXUINT - array->len) < len)
2019-01-28 15:24:06 +01:00
Emmanuel Fleury
9402940919 Fixing signedness warning in sindent():gtester.c
../glib.git/glib/gtester.c: In function ‘sindent’:
../glib.git/glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                          ^
../glib.git/glib/gtester.c:73:7: note: in expansion of macro ‘MIN’
   n = MIN (n, l);
       ^~~
../glib.git/glib/gmacros.h:351:41: error: operand of ?: changes signedness from ‘int’ to ‘guint’ {aka ‘unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                         ^~~
../glib.git/glib/gtester.c:73:7: note: in expansion of macro ‘MIN’
   n = MIN (n, l);
       ^~~
2019-01-28 15:23:34 +01:00
Philip Withnall
140b82083f Merge branch 'trash-mount-points-master' into 'master'
Don't fail trash test if ~/.local doesn't exist or mount points can't be determined (master)

See merge request GNOME/glib!593
2019-01-28 13:53:36 +00:00
Philip Withnall
80f2c96a45 Merge branch 'portals-no-o-path' into 'master'
gio: do not pass O_PATH file descriptors to portal APIs

See merge request GNOME/glib!585
2019-01-28 12:58:03 +00:00
Philip Withnall
79d5e1432d Merge branch 'docs' into 'master'
gvariant: Fix a mistake in docs

See merge request GNOME/glib!619
2019-01-28 12:42:55 +00:00
Daniel Mustieles
5a79548572 Updated Spanish translation 2019-01-28 13:06:32 +01:00
Fran Dieguez
337889e7fc Update Galician translation 2019-01-27 22:04:42 +00:00
Balázs Úr
f0720c727f Update Hungarian translation 2019-01-27 14:56:13 +00:00
Krzesimir Nowak
09eb87ad55 gvariant: Fix a mistake in docs
So now the docs actually match what the code does.
2019-01-26 21:45:34 +01:00
Philip Withnall
2d46dff03e 2.59.1
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-26 12:16:35 +00:00
Philip Withnall
eb589e2bfe tests: Ensure GCancellable is cancelled before operation is started
In the writev() tests, the handling of cancellation is tested. However,
the GCancellable was cancelled after the writev_async() call was
started. Depending on the implementation of the writev() vfunc, the
operation could be done in a thread or in callbacks on the current
thread’s main loop. If done in a separate thread, there’s a chance that
enough of the write could happen before cancellation reaches that thread
that the overall operation returns success with a short write.

That would cause the test to fail, sometimes.

Avoid that by cancelling the GCancellable before starting the writev()
operation.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2019-01-26 12:16:35 +00:00
Anders Jonsson
50d628d859 Update Swedish translation 2019-01-25 21:36:48 +00:00
Philip Withnall
cc95f819e2 Merge branch '424-gdbus-proxy-debugging' into 'master'
gdbusproxy: Add G_DBUS_DEBUG=proxy support

Closes #424

See merge request GNOME/glib!618
2019-01-25 14:42:52 +00:00
Philip Withnall
1275ddb794 Merge branch 'gdbus-proxy-test-fixes' into 'master'
gdbus-proxy test fails with GLib-GIO:ERROR:glib/gio/tests/gdbus-proxy.c:832:fail_test: code should not be reached

See merge request GNOME/glib!598
2019-01-25 14:42:05 +00:00
Richard Hughes
cd7bba985e gdbusproxy: Add G_DBUS_DEBUG=proxy support
(Turned into a merge request by Philip Withnall; unmodified from
original patch on https://bugzilla.gnome.org/show_bug.cgi?id=654905.)

https://gitlab.gnome.org/GNOME/glib/issues/424
2019-01-25 14:30:32 +00:00
Philip Withnall
aa3f7eaac7 Merge branch 'wip/chergert/fix-network-address-crash' into 'master'
gnetworkaddress: fix use-after-free for network address

See merge request GNOME/glib!611
2019-01-25 14:22:00 +00:00
Christian Hergert
4b2a60c73a gnetworkaddress: fix use-after-free for network address
This fixes an error where addr_enum can be used after finalization during
complete_queued_task().
2019-01-25 09:03:34 -05:00
Emmanuele Bassi
6db5101c4f Merge branch '1666-typemodule-casts' into 'master'
gtypemodule: Cast *_init functions to void(*)(void) first

Closes #1666

See merge request GNOME/glib!617
2019-01-25 13:33:50 +00:00
Philip Withnall
a8af2862ab gtypemodule: Cast *_init functions to void(*)(void) first
This is an analogous commit to c1f5e528. The original fix only touched
gtype.h and not gtypemodule.h.

The *_init() functions have prototypes incompatible with *InitFunc types they
are being cast to. This upsets GCC 8's -Wcast-function-type that's enabled by
default with -Wextra.

Let's not have the public header files emit a warning and neutralize it by
doing a void(*)(void) cast first.

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

https://gitlab.gnome.org/GNOME/glib/issues/1666
2019-01-25 11:29:05 +00:00
James Henstridge
b8477255b3 gio: make g_document_portal_add_documents() fall back to read-only access 2019-01-25 14:06:46 +08:00
Ignacio Casal Quinteiro
22b3a5ec00 Use win32 io channel on windows for the protocol test
We must use the platform specific method to create an IO channel
out of an fd. The test still does not work on Windows but
this is a step forward in the direction to make it work.
2019-01-24 21:24:44 +01:00
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