Commit Graph

16032 Commits

Author SHA1 Message Date
Olivier Crête
be732677f5 gio: Add G_IO_ERROR_MESSAGE_TOO_LARGE
Corresponding to EMSGSIZE, for when UDP datagrams are rejected due to
being too big.

https://bugzilla.gnome.org/show_bug.cgi?id=752240
2015-10-01 14:31:40 +01:00
Philip Withnall
1086507e75 gsocket: Fix error behaviour of g_socket_send_messages()
If an error in the underlying sendmmsg() syscall occurs after
successfully sending one or more messages, g_socket_send_messages()
should return the number of messages successfully sent, rather than an
error. This mirrors the documented sendmmsg() behaviour.

This is a slight behaviour change for g_socket_send_messages(), but as
it relaxes the error reporting (reporting errors in fewer situations
than before), it should not cause problems.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 14:10:10 +01:00
Philip Withnall
f62cbfc022 gsocket: Add g_socket_receive_messages()
Add support for receiving multiple messages with a single system call,
using recvmmsg() if available. Otherwise, fall back to looping over
g_socket_receive_message().

This adds new API, g_socket_receive_messages(), and corresponding unit
tests.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 14:10:10 +01:00
Philip Withnall
a0cefc2217 gsocket: Switch internal functions from blocking booleans to timeouts
In order to support per-operation timeouts on new API like
g_socket_receive_messages(), the internal GSocket API should use
timeouts rather than boolean blocking parameters.

   (timeout == 0) === (blocking == FALSE)
   (timeout == -1) === (blocking == TRUE)
   (timeout > 0) === new behaviour

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:59:08 +01:00
Philip Withnall
7f985b35ce gsocket: Factor out blocking parameter from g_socket_receive_message()
This will make future API additions easier. The factored version is
internal for the time being.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:58:44 +01:00
Philip Withnall
5d68947466 gsocket: Split out functions to convert to and from struct msghdr
As new methods are added to GSocket, we don’t want to duplicate this
code, so factor it out.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:58:27 +01:00
Philip Withnall
8c4c16ddf4 giotypes: Add GInputMessage struct
This complements the GOutputMessage struct. It will shortly be used for
adding a g_socket_receive_messages() function, but needs to be committed
first to allow some internal refactoring of GSocket.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 13:58:07 +01:00
Philip Withnall
37fcab17d3 build: Bump version to 2.47.0
So that early adopters of new API have a version number to target.
2015-10-01 13:49:15 +01:00
Emmanuele Bassi
037991211d Revert "Apply the previous change to gmarshal.c"
This reverts commit 43e8bfca0c.

https://bugzilla.gnome.org/show_bug.cgi?id=755922
2015-10-01 11:58:37 +01:00
Emmanuele Bassi
cc818f5fe4 Revert "glib-genmarshal: Treat all parameters the same"
This reverts commit 8e362161d9.

There is a fundamental difference between g_value_peek_pointer() and
g_value_get_pointer(), and it's not just complexity: the latter checks
if the GValue holds a pointer type, whereas the former doesn't.

https://bugzilla.gnome.org/show_bug.cgi?id=755922
2015-10-01 11:54:11 +01:00
Philip Withnall
ad7250ab53 giostream: Fix a typo in the documentation for g_io_stream_close() 2015-09-30 12:58:08 +01:00
Ryan Lortie
202a9c3497 GLocalFile: return text/plain for empty files
Previously, GLib returned text/plain for empty files.

This is important because people may want to open empty (eg:
just-created) text files with the text editor.

An unintended side-effect of b6fc1df022
caused GLib to start returning application/octet-stream instead of
text/plain for these files.

This commit is essentially a revert of that commit, with a different
solution: we move the special-case up a bit in the function and
hard-code it to text/plain.

This change does not exactly maintain the old behaviour: previously, a
"fast" lookup would have returned application/octet-stream on an empty
file and now it will return text/plain.  I consider this to be an
improvement (since we're returning better data) and don't expect it to
cause problems.

https://bugzilla.gnome.org/show_bug.cgi?id=755795
2015-09-29 12:29:10 -04:00
Ryan Lortie
56b164a195 g_variant_get_child(): flatten-first logic on '&'
Copy the flatten-first logic from g_variant_get(), and for the same
reason: if the user is requesting a direct pointer access to a
tree-based child inside of argument to this function then that child
could disappear later.

Forcing serialisation means that the pointer will remain valid as long
as the passed-in instance exists, which is the usual expectation with
GVariant API.

https://bugzilla.gnome.org/show_bug.cgi?id=755374
2015-09-29 10:17:28 -04:00
Nicolas Dufresne
3c0d38d68b gvalue: Improve _unset() documentation
g_value_unset() only works with initialized value and will assert
if the GValue is zero-filled (or initialized with G_VALUE_INIT). Document
this behaviour and refer to g_value_clear() for a method that work on
both initialized and zero-filled GValue.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:30:21 -04:00
Nicolas Dufresne
3bb2e8dfc9 gvalue: Use g_value_clear as clear function
This change allow leaving a scope before g_value_init() has been
called. This would happen if you do:

  {
    g_auto(GValue) value = G_VALUE_INIT;
  }

Or have a return statement (due to failure) before the part of
your code where you set this GValue.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:26:14 -04:00
Nicolas Dufresne
1233962b54 gvalue: Add g_value_clear method
This method is similar to g_value_unset() but will accept
an uninitialized (zero-filled) GValue structure.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:26:14 -04:00
Nicolas Dufresne
b36b4941a6 glib: Add 2.48 availibity macros
https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:26:13 -04:00
Matthias Clasen
43e8bfca0c Apply the previous change to gmarshal.c
Since gmarshal.c is no longer generated, we have to manually
apply this change to the builtin marshallers.
2015-09-29 07:04:36 -04:00
Matthias Clasen
8e362161d9 glib-genmarshal: Treat all parameters the same
There's no need to use a more expensive getter when swapping,
so just use the g_marshal_ getters there too.
2015-09-29 07:04:35 -04:00
Philip Withnall
de04fd1304 gerror: Document the disadvantages of using GError
And move the discussion to a new subsection in the GError documentation.
Follow-up from commit 04662a8667.

https://bugzilla.gnome.org/show_bug.cgi?id=743011
2015-09-28 13:32:36 +01:00
Philip Withnall
04662a8667 gerror: Document advantages of GError over numeric error codes
Despite knowing about GError, there are multiple cases where developers
have still used traditional numeric error codes, and then got themselves
into a mess about bindability and generation of error messages.

Try and avoid this by including a brief paragraph on the benefits of
GError over EINVAL-style error codes.

https://bugzilla.gnome.org/show_bug.cgi?id=743011
2015-09-28 13:04:25 +01:00
Philip Withnall
5ceaeef832 gerror: Add an extra heading to the GError documentation
This means that the top of the documentation can link forward to this
important section, and random people on the internet can link directly
to it on developer.gnome.org.

https://bugzilla.gnome.org/show_bug.cgi?id=743011
2015-09-28 13:04:25 +01:00
Philip Withnall
21809c8c0f giostream: Fix some typos in the GIOStream documentation
This doesn’t change the meaning of the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=735754
2015-09-28 13:02:19 +01:00
Philip Withnall
363fa18223 gsocket: Fix documentation for g_socket_send_message()
It is no longer the most fully featured version of this function —
g_socket_send_messages() stole that dubious honour with 2.44.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-09-28 12:47:09 +01:00
Philip Withnall
347e4a75ec gsocket: Clarify GSocket:blocking doesn’t apply to ops with a parameter
Operations which take an explicit blocking parameter are completely
unaffected by GSocket:blocking.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-09-28 12:47:09 +01:00
Philip Withnall
8fdc670188 gsocket: Clarify flags documentation for g_socket_receive_message()
The API design here is a bit awkward — the in/out flags argument should
actually have been an in flags argument and an out msg_flags argument.
Clarify that a bit in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-09-28 12:47:07 +01:00
Benjamin Gilbert
4745c08220 win32: Fix link error with _wstat32i64() on 64-bit
_wstat32i64() doesn't exist in msvcrt.dll.  This doesn't cause a problem
on 32-bit Windows because mingw-w64 #defines _wstat32i64 to _wstati64,
but on 64-bit Windows we get a link error.

In addition, _wstat32i64() takes a struct _stat32i64 *, but
GLocalFileStat is #defined to struct _stati64, which is not the same
type on 64-bit Windows.

Fix by using _wstati64().

https://bugzilla.gnome.org/show_bug.cgi?id=749161
2015-09-27 16:07:27 -04:00
Trần Ngọc Quân
da2217859f Updated Vietnamese translation
Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
2015-09-27 15:28:55 +07:00
Chun-wei Fan
a0b4e87f44 build/Makefile-newvs.am: Update Comments for Usage
Update the notes that this is also used for Visual Studio 2015 support,
and correct the MSVC_VER_LONG for MSVC 2015, which is 14, not 2015.

Also add a note that this can be used for other projects that have
Visual Studio build support.
2015-09-25 19:41:21 +08:00
Chun-wei Fan
762437c849 Build: Make Makefile.msvcproj A Bit More Generic
Handle also the situation where $(srcdir) == $(top_srcdir), so that this
can also be used in cases like librsvg and gobject-introspection.
2015-09-25 19:41:11 +08:00
Chun-wei Fan
ecd2652883 build/win32/replace.py: Add Note On Its Reusability
Add a note stating that this script can be copied for use to replace
strings in files when necessary, such as replacing autotools variables
in non-autotools builds, such as Visual Studio builds.
2015-09-25 17:47:33 +08:00
Matthias Clasen
2d7817887a Revert "list store: Fix a parameter check"
This reverts commit d28639507d.

This wasn't meant to go in.

https://bugzilla.gnome.org/show_bug.cgi?id=755496
2015-09-23 18:55:28 -04:00
Chun-wei Fan
aef2d0c56d build/win32: Make "Install" Property Sheet Generation More Robust
List the files that are generated in the process to generate the
glib-install property sheets, so that we can use that list as a
depedency, as well as deleting those files in one shot after the
property sheet is generated, so we don't need to worry about those
in 'make distclean' or so.
2015-09-23 18:33:28 +08:00
Xavier Claessens
b81f3ced71 Move GStrv typedef to glib.h instead of gobject.h
GStrv was historically only needed for the boxed G_TYPE_STRV,
but it is now useful for g_auto(GStrv) as well. This is not
an ABI change.

https://bugzilla.gnome.org/show_bug.cgi?id=755355
2015-09-22 11:18:30 -04:00
Xavier Claessens
32811598f3 doc: clarify that _get_instance_private() is NULL-safe
https://bugzilla.gnome.org/show_bug.cgi?id=755083
2015-09-22 11:15:19 -04:00
Emmanuele Bassi
ab26dd5433 Revert use of the system_header GCC pragma
This reverts commit 662bf991c0. It is not
a straight up revert because the old commit involved various long since
removed ChangeLog files and we'd end up mudding the patch.

The system_header GCC pragma is breaking warnings in the various
g_return_* macros; GCC stopped warning when using a macro with a return
value in a function that returns void, as well as when using a macro
with no return value in a function that has a non-void return value.
Suppressing this kind of warnings is not a good idea.

Other compilers are unaffected, even ones like Clang with a GCC
compatibility layer.

Given the fact that the original commit was added 14 years ago as a
workaround in the old days of GTK+ 1.2, I think it's safe to drop it.

https://bugzilla.gnome.org/show_bug.cgi?id=753310
2015-09-22 15:14:14 +01:00
Xavier Claessens
d488d75909 Remove useless NULL check before g_free() 2015-09-22 09:43:47 -04:00
Милош Поповић
f7f0c86a9c Updated Serbian Latin translation 2015-09-22 12:33:23 +00:00
Милош Поповић
45c39bfed4 Updated Serbian translation 2015-09-22 12:32:49 +00:00
Petr Kovar
613393bc1d Update Czech translation 2015-09-21 17:56:16 +02:00
Xavier Claessens
9348af3651 Doc: g_autoptr(gchar) has been replaced by g_autofree
https://bugzilla.gnome.org/show_bug.cgi?id=755351
2015-09-21 10:47:50 -04:00
Matthias Clasen
d73cd49799 2.46.0 2015-09-21 08:38:33 -04:00
Xavier Claessens
3ffed912c1 doc: small clarification in g_autoptr()
https://bugzilla.gnome.org/show_bug.cgi?id=755077
2015-09-21 08:38:33 -04:00
Matthew Waters
8297ea8bad win32: fix incorrect specifier
error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has
   type ‘gsize {aka long long unsigned int}’ [-Werror=format=]

https://bugzilla.gnome.org/show_bug.cgi?id=755154
2015-09-21 08:37:29 -04:00
Matthias Clasen
2bc094264b Documentation fixups
Various parameter fixups and symbol list additions.
2015-09-21 06:44:58 -04:00
Ask Hjorth Larsen
3ad2ef7510 Updated Danish translation 2015-09-20 20:20:37 +02:00
Rafael Fontenelle
b1af572567 Updated Brazilian Portuguese translation 2015-09-20 14:32:13 +00:00
Rūdolfs Mazurs
1dc70d703e Updated Latvian translation 2015-09-18 22:29:37 +03:00
Bernd Homuth
9d859934c5 Updated German translation 2015-09-17 15:36:28 +00:00
Stas Solovey
f1599649e5 Updated Russian translation 2015-09-17 11:31:28 +00:00