Commit Graph

16582 Commits

Author SHA1 Message Date
Mikhail Zabaluev
05aafe2cff gtypes.h: Make G_MININTn literals negative
This is more friendly to the GIR scanner; with previous definitions,
the constant values end up out of range for their stated integer type.

https://bugzilla.gnome.org/show_bug.cgi?id=756550
2015-10-15 23:47:04 +03:00
Christian Hergert
01baf39685 sequence: fix style issue in previous commit
Use g_assert_true() rather than integer comparison in sequence unit test.
2015-10-15 13:07:27 -07:00
Christian Hergert
8fccf8e4e3 sequence: add g_sequence_is_empty()
This function provides an O(1) check to determine if a sequence is empty.
Compare this to the two following alternatives to perform the same check.

O(h):  if (0 == g_sequence_get_length (seq))
O(2h): if (g_sequence_get_begin_iter(seq) == g_sequence_get_end_iter(seq))

Where `h' is the height of the tree.

https://bugzilla.gnome.org/show_bug.cgi?id=756316
2015-10-15 12:54:09 -07:00
Ignacio Casal Quinteiro
0b84596f6e gnulib: forgot some changes from HAVE_LONG_LONG_INT to HAVE_LONG_LONG
https://bugzilla.gnome.org/show_bug.cgi?id=756382
2015-10-15 17:42:02 +02:00
Ignacio Casal Quinteiro
212e4232e7 Update gnulib
It updates it to the version c5d07ce91a8ad51591154450442fa4376441fdfa
As a difference with upstream we need to ensure:
 * Include "g-gnulib.h" so the methods get the gnulib namespace.
 * xsize.h uses G_MAXSIZE instead of SIZE_MAX and the methods are
   marked as static inline.
 * Some defines are named different from the ones in glib i.e
   HAVE_LONG_LONG_INT is HAVE_LONG_LONG

All the unit tests pass properly with and without --enable-included-printf.
It has also been tested on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=756382
2015-10-15 14:54:42 +02:00
Ryan Lortie
8ece2de964 g_local_file_trash: write info file first
Recent changes to file monitors removed the delay before events were
reported.  Among other things, this caused the trash backend of gvfs to
notice trashed files sooner than before.

On noticing trashed files, the backend tries to read the info file to
discover (among other things) the original location of the file.

Unfortunately, g_local_file_trash() does a strange dance when trashing a
file.  It does a loop of open(O_EXCL) in order to file an empty filename
in the trash to write an info file to, trashes the file, and only then
writes the contents of the info file.  This means that at the time the
file is moved to the trash, the info file is an empty stub.

Change the order so that we write out the actual content of the info
file first.  If the actual trash files then we will unlink the info file
anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=749314
2015-10-14 18:08:02 +01:00
Inaki Larranaga Murgoitio
7c6d29967e Updated Basque language 2015-10-14 11:49:54 +02:00
Philip Withnall
128c413261 gsocketconnectable: Add a to_string() virtual method
Add string serialisation functions for GNetworkAddress, GSocketAddress,
GUnixSocketAddress, GInetSocketAddress, GNetworkService and
GSocketConnectable. These are intended for use in debug output, not for
serialisation in network or disc protocols.

They are implemented as a new virtual method on GSocketConnectable:
g_socket_connectable_to_string().

GInetSocketAddress and GUnixSocketAddress now implement
GSocketConnectable directly to implement to_string(). Previously they
implemented it via their abstract parent class, GSocketAddress.

https://bugzilla.gnome.org/show_bug.cgi?id=737116
2015-10-13 15:42:14 +01:00
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