Commit Graph

16266 Commits

Author SHA1 Message Date
Mikhail Zabaluev
0dbc81c73a Move G_POLLFD_FORMAT to glibconfig.h
It's a platform-specific macro, so it belongs in glibconfig.h.
This ensures that g-ir-scanner will not pick the wrong definition
for introspection.

https://bugzilla.gnome.org/show_bug.cgi?id=757294
2015-11-02 20:03:38 +02:00
Xavier Claessens
6f1b574cea Doc: Fix missing glibconfig.h when builddir!=srcdir
Currently the doc is incomplete when builddir!=srcdir
(e.g. debian package) because glibconfig.h is generared from
configure.ac and is thus missing from srcdir. This leads to
missing doc for symbols like G_GINT64_FORMAT.

https://bugzilla.gnome.org/show_bug.cgi?id=734469
2015-11-02 10:02:43 -05:00
Xavier Claessens
86a7c864b3 Doc: copy included example files
This fix missing files when src_dir != build_dir.

https://bugzilla.gnome.org/show_bug.cgi?id=734469
2015-11-02 09:26:58 -05:00
Lars Uebernickel
ee718d3526 gapplication: reject actions without names
https://bugzilla.gnome.org/show_bug.cgi?id=756134
2015-11-02 13:52:10 +01:00
Daiki Ueno
863bffdac7 doc: fix g_task_attach_source() example
The 3rd argument of the function is not a GCallback, but a GSourceFunc.

https://bugzilla.gnome.org/show_bug.cgi?id=757451
2015-11-02 11:14:04 +09:00
Xavier Claessens
df352203d6 Stop using g_sequence_get_length() to check if it's empty
g_sequence_is_empty() is more efficient for that task.

https://bugzilla.gnome.org/show_bug.cgi?id=756988
2015-10-30 11:35:28 -04:00
Xavier Claessens
2bc32606c7 GSequence: document that _get_length() is not O(1)
https://bugzilla.gnome.org/show_bug.cgi?id=756988
2015-10-30 11:35:27 -04:00
Xavier Claessens
2331437df3 Doc: fix some gtk-doc warnings
https://bugzilla.gnome.org/show_bug.cgi?id=755364
2015-10-30 10:30:55 -04:00
Allison Ryan Lortie
7dd9ffbcff tests: test bounds-checked int arithmetic
Add some simple testcases for the new bounds-checked integer arithmetic
helpers.

Include a second build of the testcase to make sure we test the fallback
code even if we are on a compiler that supports the intrinsics.

https://bugzilla.gnome.org/show_bug.cgi?id=503096
2015-10-30 11:58:49 +01:00
Allison Ryan Lortie
d0219f2597 GLib: add bounds-checked unsigned int arithmetic
Add some helpers for builds-checked unsigned integer arithmetic to GLib.
These will be based on compiler intrinsics where they are available,
falling back to standard manual checks otherwise.

The fallback case needs to be implemented as a function (which we do
inline) because we cannot rely on statement expressions.  We also
implement the intrinsics case as an inline in order to avoid people
accidentally writing non-portable code which depends on static
evaluation of the builtin.

For now there is only support for addition and multiplication for guint,
guint64 and gsize.  It may make sense to add support for subtraction or
for the signed equivalents of those types in the future if we find a use
for that.

https://bugzilla.gnome.org/show_bug.cgi?id=503096
2015-10-30 11:58:49 +01:00
Allison Ryan Lortie
89bda59170 macros: add dummy __has_builtin()
Add a dummy definition for Clang's __has_builtin() macro.  This will
allow us to use __has_builtin() unconditionally, in the same way as we
already do for __has_feature().

https://bugzilla.gnome.org/show_bug.cgi?id=503096
2015-10-30 11:58:49 +01:00
Yosef Or Boczko
41bd8c90ae Updated Hebrew translation 2015-10-30 12:50:00 +02:00
Murray Cumming
adfd184776 Fix tiny typo. 2015-10-28 10:50:40 +01:00
Chun-wei Fan
d52625a94a gwin32.c: Fix g_win32_check_windows_version() on 32-bit
The Windows API function RtlGetVersion() is actually a function that is
decorated by WINAPI (i.e. __stdcall), so we need to correct this so that
the symbol can be loaded correctly from ntdll.dll, so that we won't crash as
a result.  Should fix the crash due to stack overflow on 32-bit builds.

https://bugzilla.gnome.org/show_bug.cgi?id=756179
2015-10-27 09:28:10 +08:00
Matthias Clasen
f87fd39cf3 2.47.1 2015-10-26 13:52:47 -04:00
Matthias Clasen
a036bd38a5 Try to fix the desktop-app-info test
This was broken in 2bb898c60f.
2015-10-26 13:52:47 -04:00
Rico Tzschichholz
e93aaeb533 gio: Fix version of "Since" annotation 2015-10-25 19:43:54 +01:00
Rico Tzschichholz
0d4f6afcdf docs: Add index for 2.48 api 2015-10-25 19:42:18 +01:00
Dan Winship
4dae2d8289 gtask: re-fix tasks-blocking-other-tasks
The new "slowly add more task threads" code doesn't fully deal with
apps that queue lots and lots of tasks which then block on tasks from
their task threads. Fix this by bringing back the "task is blocking
other task" check and making sure that such tasks get bumped to the
front of the queue.

https://bugzilla.gnome.org/show_bug.cgi?id=687223
2015-10-24 10:37:22 -04:00
Chun-wei Fan
556705cb9c gwin32.c: Fix build on Visual Studio
ntdef.h is a header that is normally only shipped with MinGW, not Visual
Studio, which broke the build in commit 975cb91.  Fix this by including
winternl.h, which typedef's the NTSTATUS type in question on both Visual
Studio and MinGW/mingw-w64, as well as pre-2008 Visual Studio.

Clean up this inclusion part a little bit as well.
2015-10-24 11:05:27 +08:00
Dan Winship
af0a47701d gtypes.h: fix G_MAXUINT64 definition to use G_GUINT64_CONSTANT
(Noticed as part of https://bugzilla.gnome.org/show_bug.cgi?id=756550)
2015-10-23 11:38:31 -04:00
Dan Winship
263aac125e .gitignore updates 2015-10-23 11:28:03 -04:00
Ignacio Casal Quinteiro
50d704ab8f win32: make sure bytes_read/written is set to 0 on error
If we fail to PeekMessage or PostMessage we should make sure
that the output parameter bytes_read/written is set 0 instead
of being left uninitialized. This fixes an assertion in the io
channel call where the following invariant is checked:
(status == G_IO_STATUS_NORMAL) || (read_size == 0)
2015-10-23 10:34:50 +02:00
Víctor Manuel Jáquez Leal
3bb8294e00 giomodule: return a copy of module name
This is a regression from commit 6dedc0.

The clients expect to free the received module name, so the function
must return a copy.

https://bugzilla.gnome.org/show_bug.cgi?id=756952
2015-10-22 11:21:47 +02:00
Ignacio Casal Quinteiro
144a87a643 Use bin/gio/modules when building with visual studio 2015-10-22 09:22:01 +02:00
Ignacio Casal Quinteiro
6dedc0364a Factor out a get_gio_module_dir
This also fixes some memory leaks on windows
2015-10-22 08:42:22 +02:00
Robert Ancell
31c45cb6ae gkeyfile: Handle whitespace after boolean values
Ignore trailing whitespace when reading boolean values. Currently it is
very easy to manually edit a keyfile to be:

[section]
key=true_

Where '_' is a space character. g_key_file_get_boolean will read this value as
false and this is hard for a user to detect (it will be reported in GError
as an invalid value).

Trailing whitespace is ignored for numbers for the same reason. This was
fixed in 7a45dde4fe.

https://bugzilla.gnome.org/show_bug.cgi?id=664740
2015-10-21 15:26:53 +13:00
Robert Ancell
51ed0f0405 gkeyfile: Test that whitespace is allowed after numbers
Test that whitespace is allowed after numbers - this was fixed in
commit 7a45dde4fe.
2015-10-21 15:26:17 +13:00
Sebastian Dröge
975cb91085 win32: Include ntdef.h for NTSTATUS
https://bugzilla.gnome.org/show_bug.cgi?id=756875
2015-10-20 20:47:07 +03:00
Ignacio Casal Quinteiro
ad0f340c27 win32: let glib to use the right path separator for the modules 2015-10-20 16:13:08 +02:00
Matthias Clasen
2ac7c5a6fb Use -Wl,-znodelete for all our libraries
Now that we initialize the quark tables from a constructor,
reloading libglib is just as bad as reloading libgobject,
so add the linker option to the LDFLAGS for all our libraries.

https://bugzilla.gnome.org/show_bug.cgi?id=755609
2015-10-20 08:18:22 -04:00
Philip Withnall
bf33f1d98d docs: Replace Maman in the tutorial with a more meaningful example
Change it to a running example of a file viewer application with a file
class and various derived classes and related interfaces. Hopefully the
reader can relate to this a little better than to their maman.

https://bugzilla.gnome.org/show_bug.cgi?id=753935
2015-10-20 07:18:15 +09:00
Ryan Lortie
419f57137a GDateTime test: fix occasional failures
We were using the time() library call to get the current time from the
system in order to compare it to the time returned by
g_date_time_new_now().

Of course, we took care to ensure that the time (in seconds) didn't
change in the middle of this process by checking the before and after
value of the system time.

Unfortunately, the system time as measured by time() was being taken
from a less-accurate clock source than the time used by GDateTime.  As a
result, we could have GDateTime already into the next second while the
"seconds" value of the time returned by time() was still in the last
one, even when checked "after".

Avoid the problem by using the same ultimate source for time --
g_get_real_time().

This is based on a similar patch from Iain Lane, but it uses
g_get_real_time() instead of g_get_current_time().

https://bugzilla.gnome.org/show_bug.cgi?id=754994
2015-10-16 12:10:50 +01:00
Mikhail Zabaluev
75eaf5091c g_main_context_query(): Annotate @n_fds as (in) parameter
The default is picked up as (out), which is bogus.

https://bugzilla.gnome.org/show_bug.cgi?id=756099
2015-10-15 23:57:06 +03:00
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