Commit Graph

16074 Commits

Author SHA1 Message Date
Philip Withnall
4e631d2e5f gio: Add GDatagramBased interface and rebase GSocket on it
GDatagramBased is an interface abstracting datagram-based communications
in the style of the Berkeley sockets API. It may be contrasted to (for
example) GIOStream, which supports only streaming I/O.

GDatagramBased allows socket-like communications to be done through any
object, not just a concrete GSocket (which wraps socket()).

This adds the GDatagramBased interface, and implements it in GSocket.

https://bugzilla.gnome.org/show_bug.cgi?id=697907
2015-10-13 15:33:48 +01:00
Mike Frysinger
e5e08ebedb gthreadedresolver.c: Fix for Android 5.0+
https://bugzilla.gnome.org/show_bug.cgi?id=756477
2015-10-13 09:04:39 -04:00
Chun-wei Fan
dc4361f4cb MSVC 2010+ builds: Explicitly use /LTCG
The Visual Studio projects used a default setting for link-time code
generation, which is a part of the various linker optimizations that is
available, which is set as /LTCG for Visual Studio 2013 and earlier.

This changed in Visual Studio 2015 to become /LTCG:incremental, which would
cause GResources-generated code to be optimized out during linking, unless
they were referred to directly in the main line code (such as when the
GResource is manually registered), causing programs to crash as a result as
they can't find the needed code/data at run time.

Fix this by explicitly setting /LTCG for all release builds, for Visual
Studio 2010 and later.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-10-13 19:30:22 +08:00
Chun-wei Fan
b7e2973048 gobject: Further optimize MSVC builds
Use /ltcg (link time code generation) for linking as well.

In fact, whole program optimization and /ltcg are the default for Release
builds, so we don't really have to set them explicitly in the projects, so
as a result, we can clean up the projects a little bit.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-10-12 16:56:46 +08:00
Chun-wei Fan
670400ee33 gobject: MSVC builds-improve optimization a bit
Use whole program optimization (/GL) as we now use DllMain() to
initialize the library on Windows builds.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-10-12 15:05:23 +08:00
Ignacio Casal Quinteiro
7a29771a74 gobject: use a DllMain to initialize gobject on windows
It seems that VS 2015 optimizes out the constructor on windows,
so it is better to use a DllMain to initialize the library
and keep using a normal constructor on the other platforms.
This research was done by  Arnav Singh.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-10-11 10:29:10 +02:00
Debarshi Ray
cd1eba043c docs: Improve the text on G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
... and fix a couple of typos in the process.

https://bugzilla.gnome.org/show_bug.cgi?id=756251
2015-10-09 14:16:29 +02:00
John Hiesey
16e0a5a886 goutputstream: Report input stream read failure correctly
When G_OUTPUT_STREAM_CLOSE_TARGET is set,
g_output_stream_real_splice was not returning -1 in any error
cases, since the success flag was being overwritten.

https://bugzilla.gnome.org/show_bug.cgi?id=756255
2015-10-08 20:07:08 +02:00
Ignacio Casal Quinteiro
fb9df27776 Change message system to use fputs instead of write
By default g_log_default_handler always assumes that stdout
and stderr are file descriptors 1 and 2. On Win32 this isn't
always the case as the win32 API functions AttachConsole and
freopen can be used to dynamically attach GUI applications to
a console and the file descriptors of stderr and stdout will
become different than 1 and 2.

Fix it by using fputs with the FILE directly instead of
using the file descriptors.

https://bugzilla.gnome.org/show_bug.cgi?id=692085
2015-10-08 17:32:29 +02:00
Philip Withnall
144d38fb9d gparamspecs: Mark g_param_spec_string()’s default value as (nullable) 2015-10-08 12:57:33 +01:00
Emmanuele Bassi
99ff9bb5e0 Maintain the struct order when initializing
Otherwise it'll break every GLIB_PRIVATE_CALL user.
2015-10-08 12:32:58 +01:00
Philip Withnall
0cc8c0f3e1 gerror: Add (optional) annotation to g_propagate_error()
Also clarify in the documentation that @src must be non-%NULL.
2015-10-08 11:16:02 +01:00
Philip Withnall
2e078f1fc0 gstrfuncs: Add missing annotations to g_[ascii_]strto*() functions
Add missing (out) (transfer none) (optional) annotations to g_strtod(),
g_ascii_strtod(), g_ascii_strtoull() and g_ascii_strtoll().
2015-10-08 11:10:39 +01:00
Matthias Clasen
8d83aace10 Call glib_init from the gobject constructor
We are using quarks in the gobject constructor, among other things,
so we need to ensure that glib is being initialized first.

https://bugzilla.gnome.org/show_bug.cgi?id=756139
2015-10-07 23:39:29 -04:00
Matthias Clasen
e0dce8a9ae Export glib_init via GLIB_PRIVATE_CALL
This will be used in the next commit to call glib_init from the
gobject constructor, to ensure proper constructor ordering with
non-GNU libc.

https://bugzilla.gnome.org/show_bug.cgi?id=756139
2015-10-07 23:39:29 -04:00
Matthias Clasen
342d329685 Make glib_init safe to call more than once
This will be needed to fix constructor order for non-GNU libc.

https://bugzilla.gnome.org/show_bug.cgi?id=756139
2015-10-07 23:39:29 -04:00
Chun-wei Fan
46a20470fa gwin32.c: Avoid deprecated Win32 API usage
The VerifyVersionInfo() Win32 API has been deprecated in Windows 10, and
there is no direct replacement for it, except by using a lower-level
RtlGetVersion() that we aquire from the Windows DDK or from ntdll.dll.

Switch g_win32_check_windows_version() to use RtlGetVersion(), and
compare its results with the input parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=756179
2015-10-07 20:46:31 +08:00
Matthias Clasen
3624e70508 Update Unicode test data for Unicode 8
These files are used by the unicode-caseconv test.
2015-10-06 06:49:48 -04:00
Philip Withnall
ac05ad55fa gdbusconnection: Add missing (nullable) to get_peer_credentials()
Since Colin mentioned it on gir-devel-list.
2015-10-06 07:59:19 +01:00
Olivier Fourdan
4919c25d49 GDesktopAppInfo: Do not set the DISPLAY in gio
The environment variable DISPLAY makes sense only for X11, it should
not be set in gio.

Beside, if the backend is not X11 but Wayland, forcing the value of
DISPLAY to the Wayland display will confuse the backend selection and
possibly crash the applications.

https://bugzilla.gnome.org/show_bug.cgi?id=754983
2015-10-05 23:21:43 -04:00
Philip Withnall
212b0c28cc gsocket: Fix g_socket_send_messages_with_timeout() on win32
Commit a0cefc2217 introduced an unresolved
symbol, g_socket_send_message_with_timeout(), on win32. Windows
unfortunately isn’t clever enough to fill in the gaps and magic up the
implementation of that function from nowhere, so we had better do it
ourselves.

Factor the blocking behaviour out of g_socket_send_message() into a new
internal g_socket_send_message_with_timeout().

https://bugzilla.gnome.org/show_bug.cgi?id=756054
2015-10-05 16:15:19 +01:00
Marc-André Lureau
f91d1a2a76 docs: misc spelling 2015-10-05 15:33:05 +02:00
Marc-André Lureau
dabf662788 testutils: remove internal ABI comment
Some testutils external symbols are marked semi-internals, other
internals. It is not obvious what guarantees these symbols provide.
However, tests are now installable, and require the ABI stability
that glib provides for the rest of the symbols.

In my case, I would like to introduce g_assert* compat code for older
glib versions, and be able to use the so-called "internal" ABI.

I propose this change to the headers comments to explain the stability
guarantees. Removing the "internal" = you must not use this, in favor
of semi-internal = this is not documented.

https://bugzilla.gnome.org/show_bug.cgi?id=756077
2015-10-05 15:32:41 +02:00
Chun-wei Fan
e81d4ea988 gio/goscket.c: Fix build on Windows
5d68947 factored out resuable items, but some of these are only for
*NIX builds, which will break the build on Windows.  Fix this by
building these portions only when !G_OS_WIN32.

https://bugzilla.gnome.org/show_bug.cgi?id=756053
2015-10-05 17:15:12 +08:00
Philip Withnall
9b7f5ad611 gunixsocketaddress: Clarify construction behaviour of anonymous addrs
Clarify the handling of G_UNIX_SOCKET_ADDRESS_ANONYMOUS in the
documentation for g_unix_socket_address_new_with_type().
2015-10-04 15:26:37 +01:00
Matthias Clasen
f9d9f9c056 Update to Unicode 8.0
Regenerate data tables from the Unicode Character Database, add
new scripts, and update tests to include some of the new data.
2015-10-04 10:24:06 -04:00
Philip Withnall
fc59c20e97 gsocket: Minor documentation clarifications
As suggested by Dan Winship on bug #697907.
2015-10-04 11:34:36 +01:00
Philip Withnall
237fec7e70 gsocket: Fix connected state if shutting down in two steps
The value of g_socket_is_connected() gets stuck high if the GSocket is
shut down in two steps:
   g_socket_shutdown (socket, TRUE, FALSE, NULL);
   g_socket_shutdown (socket, FALSE, TRUE, NULL);
rather than one:
   g_socket_shutdown (socket, TRUE, TRUE, NULL);

Fix that by tracking the connected status for the read half and the
write half of the connection separately.

https://bugzilla.gnome.org/show_bug.cgi?id=697907
2015-10-04 10:39:13 +01:00
Philip Withnall
58ec667480 gkeyfile: Remove dead code and unused string literals
In all these functions, group_name is guaranteed to be non-NULL by the
function preconditions, so there is no need to handle it as NULL when
building error messages. Remove some unnecessary string literals as a
result.

Coverity CID: 1325438–1325441
2015-10-03 23:31:44 +01:00
Philip Withnall
456e02f280 gdbusaddress: Fix memory leak when G_DBUS_DEBUG_ADDRESS is enabled
Coverity CID: 1325374
2015-10-03 11:52:27 +01:00
Philip Withnall
0f98b2f4ec gsocks5proxy: Fix error reporting in authentication
set_auth_msg() was returning FALSE to indicate error, but all its
callers were expecting a negative return value to indicate error. This
was causing memory leaks for the GError, and errors to not be reported.

Coverity CID: 1325357
2015-10-03 11:46:18 +01:00
Philip Withnall
c1c001e300 gresource-tool: Fix minor memory leak when listing resources
Coverity CID: 1325353
2015-10-03 11:43:49 +01:00
Philip Withnall
4f6dc30232 glib-genmarshal: Fix memory leak with --prefix
If --prefix is specified, marshaller_prefix is allocated and never
freed. It does not actually have to be allocated — just use the static
string from argv.

Coverity CID: 1325370
2015-10-03 11:33:00 +01:00
Philip Withnall
292fd1155a gtlscertificate: Fix error reporting if a GError is not passed in
If the certificate constructor is called as:
   g_tls_certificate_new_from_pem (data, length, NULL);
and PEM parsing fails for the private key, the function would have
continued to try and create a certificate using a NULL key_pem value,
which would have failed or crashed.

Use g_propagate_error() correctly to avoid this.

Coverity CID: 1325403
2015-10-03 10:58:18 +01:00
Philip Withnall
9275be383f glocalfile: Fix memory leak in find_topdir_for()
Coverity CID 1325398.
2015-10-03 10:48:46 +01:00
Dan Winship
4b2d92a864 Allow passing unset GValues to g_value_unset()
This makes it more useful as an autocleanup func.

Also, add a minimal test of g_value_init/g_value_reset/g_value_unset.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-10-02 10:07:53 -04:00
Dan Winship
b4a3c1bb11 Revert "gvalue: Add g_value_clear method"
This reverts commit 1233962b54.
2015-10-02 10:07:53 -04:00
Dan Winship
4c870904cd Revert "gvalue: Use g_value_clear as clear function"
This reverts commit 3bb2e8dfc9.
2015-10-02 10:07:53 -04:00
Dan Winship
8ed9e8c79f Revert "gvalue: Improve _unset() documentation"
This reverts commit 3c0d38d68b.
2015-10-02 10:07:53 -04:00
Mikhail Zabaluev
0448e758cf Skip g_bytes_new_with_free_func() in introspection
The tricky ownership/mutability semantics on data make this function
unusable in introspection.

https://bugzilla.gnome.org/show_bug.cgi?id=755961
2015-10-01 21:15:22 -04:00
Mikhail Zabaluev
1e1e6c1086 gbytes: fix up annotations
Annotate array elements as bytes.
Annotate a missed output parameter.
Replace (allow-none) with the corresponding modern annotations.

https://bugzilla.gnome.org/show_bug.cgi?id=755961
2015-10-01 21:14:54 -04:00
Philip Withnall
4a5a30f716 docs: Tidy up GObject construction discussion in the GObject tutorial
Remove some outdated references to an old example, and add a row in the
table of steps in object initialization for the GObjectClass.constructed
virtual method.

https://bugzilla.gnome.org/show_bug.cgi?id=754855
2015-10-01 15:27:21 +01:00
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