Commit Graph

15244 Commits

Author SHA1 Message Date
Ryan Lortie
9da88a12c5 gsubprocess: test empty splices
Make sure we handle the case that our splice returns no data properly.

https://bugzilla.gnome.org/show_bug.cgi?id=724916
2014-03-03 21:26:24 -05:00
Ryan Lortie
9f71965bec gsubprocess: fix communicate() with empty buffers
On the splice for stdout or stderr completing, GSubprocess calls
_slice_finish() to collect the result.

We assume that a zero return value here means failure, but in fact this
function returns a gssize -- the number of bytes transferred, or -1 for
an error.

This causes GSubprocess to mistakenly think that it has an error when it
actually just has an empty buffer (as would be the case when collecting
stderr from a successful command).

Check for -1 instead of FALSE to detect the error.

https://bugzilla.gnome.org/show_bug.cgi?id=724916
2014-03-03 21:26:24 -05:00
Ryan Lortie
de142c0c5a GLib 2.39.91 2014-03-03 16:03:00 -05:00
Ryan Lortie
5d5ea495b5 desktopappinfo: add Exec to searchable keys
Add the basename from the first component of the Exec line to the list of
strings to search for via g_desktop_app_info_search().

We treat Exec as a fairly strong match -- just below the visible name.

Add a testcase to make sure everything is working OK.

https://bugzilla.gnome.org/show_bug.cgi?id=725023
2014-03-03 16:01:27 -05:00
Theppitak Karoonboonyanan
9ecc859f95 Updated Thai translation 2014-03-03 17:27:09 +07:00
Matthias Clasen
79caa3a7e1 Add a few tests for G_MARKUP_TREAT_CDATA_AS_TEXT
Related to
https://bugzilla.gnome.org/show_bug.cgi?id=725433
2014-03-02 19:10:00 -05:00
Matthias Clasen
b93a13bb79 Add a way to test different markup parser flags
For now, we are mainly interested in G_MARKUP_TREAT_CDATA_AS_TEXT.
This commit makes markup-parse look for expected output files with
the extension .cdata-as-text in addition to .expected, and compares
the output of parsing with G_MARKUP_TREAT_CDATA_AS_TEXT against
them. markup-parse --cdata-as-text foo.gmarkup can be used to produce
such expected output.
2014-03-02 19:03:15 -05:00
Matthias Clasen
49cc207e35 docs: Ditch more markup
Some markup was hiding in docs in headers. Drop it there, too.
2014-03-02 18:23:43 -05:00
Piotr Drąg
ad4d81418e Updated Polish translation 2014-03-02 19:24:01 +01:00
Philip Withnall
fdf14e9e6c hmac: Make unit test const-correct
https://bugzilla.gnome.org/show_bug.cgi?id=724741
2014-02-24 16:38:08 +00:00
Ryan Lortie
393503ba5b gmain: simplify g_main_context_find_source_by_id()
Since we now keep a hashtable of sources, we can implement this function
without iteration.

https://bugzilla.gnome.org/show_bug.cgi?id=724839
2014-02-24 09:28:43 -05:00
Ryan Lortie
9e81709012 gmain: Simplify source id tracking
Simplify our tracking of issued source id integers and fix some bugs.

Previously the source's id was remove from the 'used' table from
source_remove_from_context() which was also called if the source
priority was changed (in which case it would never be added back to the
table).  The source id could be reissued in that case.

In the new approach, we just always keep a hash table of sources, by
source id.  This simplifies the logic and will also allow us to improve
performance of g_main_context_find_source_by_id() which is called in some
fairly common cases, such as g_source_remove().  These improvements will be in
the following commits.

https://bugzilla.gnome.org/show_bug.cgi?id=724839
2014-02-24 09:28:43 -05:00
Matthias Clasen
e7bde4acf4 Test content type icons more thoroughly
Check we actually get the right icon names, and check
that symbolic icons fall back to non-symbolic ones.
2014-02-23 12:11:59 -05:00
John Lindgren
e6af432b39 Add non-symbolic fallback icons in g_content_type_get_symbolic_icon().
This makes the behavior consistent with e.g. g_volume_get_symbolic_icon().

https://bugzilla.gnome.org/show_bug.cgi?id=724994
2014-02-23 12:11:59 -05:00
Ryan Lortie
356fe2cec6 asyncqueue: fix timeout math on 32bit systems
88182d375e caught this issue in
g_async_queue_timed_pop() but failed to fix the same bug in the _unlocked()
variant.

This is only a problem on 32bit systems.  On 64bit systems, the tv_sec
in a timeval is already 64 bits, so no overflow occurs.

https://bugzilla.gnome.org/show_bug.cgi?id=722604
2014-02-23 01:14:27 -05:00
Ryan Lortie
4af9b8e9cb mappedfile test: permit ENODEV on /dev/null
mmap() on /dev/null returns ENODEV on old Linux versions and also on
Hurd, so accept that in the testcase.

https://bugzilla.gnome.org/show_bug.cgi?id=722360
2014-02-23 00:47:29 -05:00
Chun-wei Fan
4825e819b2 Fix build of gio/gapplication.c on Visual C++
Visual C++ is quite zealous about checking against the types used in the
initializing of array of structures, even up to Visual C++ 2013.  Fix this
by splitting up the initializing steps.

https://bugzilla.gnome.org/show_bug.cgi?id=724609
2014-02-23 11:48:06 +08:00
Ryan Lortie
8da795de4f gsocket: use check/prepare only on win32
There is no longer any code left in the check/prepare functions on UNIX,
so put %NULL in the GSourceFuncs vtable.

This also allows us to simplify some logic.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:25:42 -05:00
Ryan Lortie
e8f26efe0d gsocket: use _add_unix_fd() instead of _add_poll()
Use g_source_add_unix_fd() on UNIX instead of using a GPollFD.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:25:42 -05:00
Ryan Lortie
04aee2d920 gsocket: make use of g_source_set_ready_time()
Drop our own hand-rolled version of the same functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:25:42 -05:00
Ryan Lortie
12d65f2509 GSource: mark some API as "implementation only"
Clarify that _add_poll() _remove_poll() _add_unix_fd(),
_modify_unix_fd(), _remove_unix_fd(), _query_unix_fd(),
_set_ready_time(), _add_child_source() and _remove_child_source() are only
intended to be used by the implementation of a particular GSource -- not its
consumers.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:25:06 -05:00
Ryan Lortie
1f7100506a gsocket: don't abuse GPollFD.revents field
We are reusing the GPollFD.revents field of the source to store a
temporary value.  Use a local variable for that instead.

This is a refactor to make the next commit easier to understand.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:24:19 -05:00
Ryan Lortie
ff96f88e17 gsocket: use cancellable child source
Now that GCancellable's GSource is based on _set_ready_time() instead of
an fd, we should use it as a child source, instead of forcing the
creation of the fd and adding it as a poll.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:24:19 -05:00
Ryan Lortie
d8263dd793 gsocket: trivial typo fix
https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:24:19 -05:00
Ryan Lortie
6147d15ea2 gmain: repeat preconditions for emphasis
g_main_context_acquire() mentions that you must have called it before
you make any calls to _prepare(), _query(), _check() or _dispatch().

For emphasis, add a note on each of those functions pointing back to the
fact that you must have called _acquire() before using them.
2014-02-22 10:23:40 -05:00
Ryan Lortie
c0aa150cb0 g_main_context_wait: add a critical to detect use
Due to its unusual interface, I suspect that nobody is using
g_main_context_wait() but there is no way to know.

Add a critical notice that will be displayed if anyone calls the
function, asking them to file a bug with us.

We'll let this go out with the 2.40 release and see if we get a response
before we proceed with actually breaking the functionality.
2014-02-21 16:42:21 -05:00
Ryan Lortie
5103c5d643 GCond: check result of pthread_condattr_setclock()
Make sure this call succeeds, aborting if it doesn't

This will prevent people from having to waste time chasing down the problems
that would otherwise be caused by this silent failure.
2014-02-21 16:42:21 -05:00
Ryan Lortie
03a43c290e gmain: abort if monotonic time is unsupported
We now depend on CLOCK_MONOTONIC, but it's possible that people may
attempt to run GLib on systems where it isn't supported at runtime.

Check the return value of clock_gettime() and abort() if it fails in
order to save these people from wasting time on debugging a tricky
issue.

https://bugzilla.gnome.org/show_bug.cgi?id=670144
2014-02-21 16:42:21 -05:00
Xavier Claessens
6fcaa7aa96 GHashTable: Explicitly document that _iter_remove() is safe while iterating
https://bugzilla.gnome.org/show_bug.cgi?id=723316
2014-02-21 15:39:31 -05:00
Aurimas Černius
59a8ae34c0 Updated Lithuanian translation 2014-02-21 22:16:16 +02:00
Chun-wei Fan
450363321d glib/Makefile.am: Dist gtranslit-data.h
This header needs to be distributed as well, which was
inadvertently missed.

https://bugzilla.gnome.org/show_bug.cgi?id=724858
2014-02-21 23:37:31 +08:00
Ryan Lortie
73060f5e78 slow-motion post-release version bump 2014-02-21 07:56:26 -05:00
Ryan Lortie
061793a726 gconvert: add note to avoid transliteration
Add a note to the documentation of g_convert() advising to avoid using
it for transliteration.  Link to g_str_to_ascii().
2014-02-20 18:52:33 -05:00
Ryan Lortie
0415930b49 gsource: document priority of child sources
Add a note to the documentation that child sources cannot have their priority
changed independently from their parent.  Add a g_return_if_fail() to the
public API in order to enforce this.

This was already a reality due to the check in
g_source_set_priority_unlocked(), but it was never explicitly documented.

https://bugzilla.gnome.org/show_bug.cgi?id=724706
2014-02-20 18:32:42 -05:00
Ryan Lortie
8491f03581 g_str_to_ascii(): a couple of minor tweaks
Add a precondition guard and use g_string_sized_new() to avoid some
reallocations.
2014-02-20 18:32:42 -05:00
Ryan Lortie
a8ea3dc03b g_str_tokenize_and_fold: do proper transliteration
g_str_tokenize_and_fold() can now do proper locale-sensitive
transliteration for ascii alternatives.

https://bugzilla.gnome.org/show_bug.cgi?id=710142
2014-02-20 18:27:48 -05:00
Ryan Lortie
d7291760df tests: test transliteration API
Add some tests for the new transliteration API.

https://bugzilla.gnome.org/show_bug.cgi?id=710142
2014-02-20 18:27:24 -05:00
Ryan Lortie
941b8979d0 Add locale-sensitive ASCII transliteration API
Add a new function, g_str_to_ascii() that does locale-dependent ASCII
transliteration of UTF-8 strings.

This function works off of an internal database.  We get the data out of
the localedata shipped with glibc, which seems to be just about the best
source of locale-sensitive transliteration information available
anywhere.

We include a update script with this commit that's not used by anything
at all -- it will just sit in git.  It is intended to be run manually
from time to time.

https://bugzilla.gnome.org/show_bug.cgi?id=710142
2014-02-20 18:27:24 -05:00
Ryan Lortie
436d77f70a tests: add a test for g_cond_wait_until()
https://bugzilla.gnome.org/show_bug.cgi?id=673607
2014-02-20 17:57:57 -05:00
Ryan Lortie
1de36e7755 Fix g_cond_wait_until() vs. monotonic time
We've had a relatively rocky path with g_cond_wait_until() on systems
that either don't support pthread_condattr_setclock() or where
g_get_monotonic_time() is not based on CLOCK_MONOTONIC (ie: Android and
Mac OS).

Fortunately, both of these platforms seem to share
pthread_cond_timedwait_relative_np() which allows us to implement
g_cond_wait_until() without races.

With this patch, we now require that one of pthread_condattr_setclock()
or pthread_cond_timedwait_relative_np() exists.  A quick look around
suggests that this is true for all platforms that we care about.

This patch removes our use of pthread_cond_timedwait_monotonic() and
pthread_cond_timedwait_monotonic_np() which were Android-only APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=673607
2014-02-20 17:55:09 -05:00
Ryan Lortie
d614312546 gmain: rework g_get_monotonic_time() a bit
We now assume the existence of clock_gettime() and CLOCK_MONOTONIC as
specified by POSIX.1-2001.  This means that we always return truly
monotonic time, which will prevent problems in the case that the user
changes the time.

Mac OS doesn't have clock_gettime() but it does have
mach_absolute_time(), so we can use that there.

We keep our Windows case as well (although we should simplify it once XP
hits EOL later this year).

This patch removes the fallback to gettimeofday() in case of missing
clock_gettime().  We no longer have any way to test this codepath and
therefore it must go.

This patch also restructures the #ifdef a bit so that we repeat the
entire function definition inside of #ifdef instead of just the entire
body of one function.

https://bugzilla.gnome.org/show_bug.cgi?id=724687
2014-02-20 17:52:49 -05:00
William Jon McCann
20f4d1820b docs: use "Returns:" consistently
Instead of "Return value:".
2014-02-19 19:41:52 -05:00
Chun-wei Fan
9cb53851be gio/gresolver.c: Fix build on Windows
Windows does not come with inet_aton(), and this check on IPv4 addresses
is actually not needed on Windows as the getaddrinfo() implementation on
Windows already rejects non-standard and non-real IPv4 numbers-and-dots
addresses.

https://bugzilla.gnome.org/show_bug.cgi?id=724609
2014-02-20 08:36:54 +08:00
Kjartan Maraas
a5ae016359 Updated Norwegian bokmål translation 2014-02-19 23:57:40 +01:00
Xavier Claessens
0ffa1ea8dd Add G_ÂTYPE_VARIANT_DCT into the doc 2014-02-19 15:51:27 -05:00
Ryan Lortie
ec17605d4f GLib 2.39.90 2014-02-17 18:33:34 -05:00
Ryan Lortie
c37cd19fee Work around test failure in gdbus-names
This is caused by g_test_dbus_down() returning too soon.

Add a sleep for now.

https://bugzilla.gnome.org/show_bug.cgi?id=711807
2014-02-17 18:18:20 -05:00
Ryan Lortie
53d5b17f62 GApplication: disable some more tests
Disable some racy GApplication testcases.  We need some better non-hacky
GApplication tests...

https://bugzilla.gnome.org/show_bug.cgi?id=724126
2014-02-17 17:44:58 -05:00
Matthias Clasen
c81834c089 Bump gtk-doc dep to 1.20 2014-02-17 16:57:13 -05:00
Dan Winship
4139b26f3e gsocket: fix g_socket_condition_timed_wait() recovery after EINTR
After getting an EINTR, g_socket_condition_timed_wait() has to adjust
its timeout, but it was trying to convert from nanoseconds to
microseconds by multiplying by 1000 rather than dividing... Oops.

https://bugzilla.gnome.org/show_bug.cgi?id=724239
2014-02-17 11:38:11 -05:00