Commit Graph

15953 Commits

Author SHA1 Message Date
Ryan Lortie
c8d1047093 Add g_output_stream_write_all_async()
Similar to the previous patch, this commit contains a minor violation of
normal API conventions.  See the explanation in the previous commit
message.

Heavily based on a patch from Ignacio Casal Quinteiro.

https://bugzilla.gnome.org/show_bug.cgi?id=737451
2014-10-21 12:09:57 -04:00
Ryan Lortie
76b890d0f1 Add g_input_stream_read_all_async()
Add an asynchronous version of _read_all().

This API is not fully consistent with the normal expectations of a
non-asynchronous version.  Consistency between the sync and async version is
probably more important.

The API will still bind correctly, but access to all functionality will
not be available: specifically, in the case of an error, higher level
languages will be unable to determine how many bytes were successfully
read before the error.  Most users will probably not want to use this
information anyway, so this is OK -- and if they do need the
information, then they can just write the loop for themselves.

Heavily based on a patch from Ignacio Casal Quinteiro.

https://bugzilla.gnome.org/show_bug.cgi?id=737451
2014-10-21 11:31:45 -04:00
Michael Catanzaro
aabc3a41c3 Fix another ancient docs typo 2014-10-20 19:05:48 -05:00
Ryan Lortie
f4af8d1d00 GApplication: ignore --help if not handling args
If the user didn't register any arguments for parsing, also ignore
--help.  This fixes a regression in meld.

https://bugzilla.gnome.org/show_bug.cgi?id=737869
2014-10-20 15:00:51 +02:00
Ryan Lortie
817f82da6c GOption: stop calling getopt()
We called getopt() to try to find out of the platform on which we are
running defaults to strict POSIX-style argument handling (ie: flags
following the first filename are considered as further filenames rather
than flags).

This is the default case on BSDs, for example.  It is also the case on
GNU systems with the POSIXLY_CORRECT environment variable set.

Unfortunately many of our tools rely on being able to accept commandline
arguments in the non-strict ordering and the code for making these calls
is spread widely (for example in Makefile fragments invoking some of our
build tools).

For this reason we need to revert the getopt() check and only enable
strict POSIX mode in the case that the application explicitly opts into
it using the _set_strict_posix() API.

This also fixs a failure to build on Windows due to missing getopt().

https://bugzilla.gnome.org/show_bug.cgi?id=723160
2014-10-20 14:34:52 +02:00
Ryan Lortie
e9b7c70240 GHashTable: small docs fix
We use g_hash_table_unref() here, not g_object_unref().
2014-10-17 14:39:09 +02:00
Benjamin Berg
18745ff674 Allow hash table destroy notifiers to remove other entries
With this patch it is fine to call g_hash_table_lookup and
g_hash_table_remove from destroy notification functions. Before
this could lead to an infinitie loop if g_hash_table_remove_all
was used.

https://bugzilla.gnome.org/show_bug.cgi?id=695082
2014-10-17 14:29:26 +02:00
Emmanuele Bassi
cb042bf5b5 docs: Add missing get_type() reference to gio.types
GSubprocessLauncher is a GObject, so we need to tell gtk-doc to inspect
it.

https://bugzilla.gnome.org/show_bug.cgi?id=738675
2014-10-17 11:16:16 +01:00
Ryan Lortie
ae52ab3d11 GOption: add strict posix mode
Add a "posixly correct" mode to GOption to stop parsing arguments as
soon as the first non-option argument is encountered.

We determine the default value on the basis of duplicating the behaviour
of the system getopt() implementation (which we directly check the
behaviour of at runtime).  On GNU systems this allows the user to modify
our behaviour using POSIXLY_CORRECT.

The user can change the value by g_option_context_set_strict_posix(),
which might be useful for some usecases of GOptionContext (as mentioned
in the doc string of this new function).

https://bugzilla.gnome.org/show_bug.cgi?id=723160
2014-10-15 23:37:45 +02:00
Matthias Clasen
f2786908a8 GApplication: Plug a memory leak
We were not freeing resource_path.
2014-10-14 23:22:14 -04:00
Jasper St. Pierre
5a0a85e444 gdesktopappinfo: Fix copy/paste typo from e24e89b
Commit e24e89b accidentally ironically introduced a typo when replacing
the code with symbolic contents. Specifically, "Added Associations" was
replaced with "Default Applications" when reading defaults.list, giving
a warning about the file containing a "Default Applications" group.

If this was intended, it should have not been lumped in with a cleanup.
2014-10-14 19:17:53 -07:00
Benjamin Otte
e054bbfe16 gfile: Clarify docs
Clarify corner cases that were unclear while reviewing a GTK patch.
2014-10-12 01:57:02 +02:00
Benjamin Otte
6e994d0656 Bump version to 2.43.0
We have new API.
2014-10-12 01:29:27 +02:00
Benjamin Otte
36d8b941d4 signal: Keep only one list of emissions
There is no need to keep 2 lists.

This simplifies the code and gets rid of the only user inside glib of
G_HAVE_GROWING_STACK.

https://bugzilla.gnome.org/show_bug.cgi?id=736284
2014-10-12 00:27:06 +02:00
Matthias Clasen
58ec89ea7c Fix a return_if_fail confusion
This slipped through my editing of the patch.
2014-10-11 15:53:13 -04:00
Owen W. Taylor
011bf876e7 Add simple instance count facility
Add GOBJECT_DEBUG=instance-count which enables internal accounting
of the number of instances of each GType, and g_type_get_instance_count()
to retrieve the result.

https://bugzilla.gnome.org/show_bug.cgi?id=354457
2014-10-11 13:54:29 -04:00
Krasimir Chonov
aa401aef87 Updated Bulgarian translation 2014-10-11 08:19:43 +03:00
Matthias Clasen
26c66ab1b9 Clarify g_propagate_error docs
I just ran into a bug that was caused by having src being a
persistent GError* that was not cleared after propagating it.
2014-10-10 14:17:56 -04:00
Benjamin Gilbert
0bfea5e772 Fix g_cond_timed_wait() timeout with !CLOCK_MONOTONIC
g_get_monotonic_time() and g_get_real_time() now always use different
clocks, so we cannot avoid correcting for their offset.  Fixes failure
to time out on Mac OS X.

https://bugzilla.gnome.org/show_bug.cgi?id=738197
2014-10-10 06:41:55 -04:00
Aleksander Morgado
549e7b0de6 garray: initialize allocated size in g_byte_array_new_take()
Internal allocation size (array->alloc) was being kept to 0 when a new
GByteArray was created from an already existing heap-allocated buffer.

Among other things, this was making g_byte_array_set_size() fully clear all
the buffer contents (not just the newly allocated memory) when
G_DEBUG=gc-friendly was being used...

  if (G_UNLIKELY (g_mem_gc_friendly))
    memset (array->data + array->alloc, 0, want_alloc - array->alloc);

https://bugzilla.gnome.org/show_bug.cgi?id=738170
2014-10-08 20:51:47 +02:00
Matthias Clasen
de82b641b0 Add advice on g_cancellable_reset
Don't use it at home.
2014-10-06 22:41:06 -04:00
Aleix Conchillo Flaqué
da053e345b tlscertificate: add support for certificate chains
This patch changes the behavior of the following functions:

   g_tls_certificate_new_from_pem
   g_tls_certificate_new_from_file
   g_tls_certificate_new_from_files

If more than one certificate is found it will try to load the chain.

It is assumed that the chain will be in the right order (top-level
certificate will be the last one in the file). If the chain cannot be
verified, the first certificate in the file will be returned as before.

https://bugzilla.gnome.org/show_bug.cgi?id=729739
2014-10-06 10:19:48 -07:00
Michael Catanzaro
4454b81536 Fix typo 2014-10-05 12:11:21 -05:00
Milo Casagrande
6cd13d34fe Updated Italian translation 2014-10-05 13:07:12 +00:00
Matthias Clasen
5cbc94d829 GDataSet: Add more tests
These tests exercise the NULL key fix from the previous commit.
2014-10-02 14:41:01 -04:00
Matthias Clasen
f6a9d04796 GDataSet: silently accept NULL/0 as keys
This used to be the behaviour before we made these functions
threadsafe; keep it that way.

https://bugzilla.gnome.org/show_bug.cgi?id=737741
2014-10-02 14:40:16 -04:00
Bastien Nocera
e24e89bc07 gdesktopappinfo: Use symbolic names in the code
We have #defines for the key file groups, so use them to avoid typos.

https://bugzilla.gnome.org/show_bug.cgi?id=736273
2014-09-30 14:41:43 +02:00
Ting-Wei Lan
45344f3622 GCredentials: Fix ABI break when adding NetBSD support
https://bugzilla.gnome.org/show_bug.cgi?id=728256
2014-09-30 00:42:00 +08:00
Ryan Lortie
682bca0950 Add version macros for 2.44 2014-09-29 11:40:10 -04:00
Philip Withnall
a4612a922b tests: Fix some minor leaks in the unit tests
https://bugzilla.gnome.org/show_bug.cgi?id=737446
2014-09-27 10:30:39 +01:00
Sébastien Wilmet
cb2c6eef0a gslist: indentation fix 2014-09-27 00:04:55 +02:00
Sébastien Wilmet
66ef10eec9 docs: syntax highlighting for the code examples
In the sections Concepts, Tools and Tutorial.

https://bugzilla.gnome.org/show_bug.cgi?id=736914
2014-09-26 23:36:26 +02:00
Philip Withnall
1c6df7aaeb gmain: Unref child sources when finalising a GSource
If a GSource is created, *not* attached to a GMainContext, and then has
child sources added, dropping the last reference to the parent GSource
will leak its references to its child sources. Currently, child sources
are only unreffed when g_source_destroy() is called on the parent.

https://bugzilla.gnome.org/show_bug.cgi?id=737338
2014-09-25 13:59:25 +01:00
Philip Withnall
eaca86801e gmain: Fix some signed/unsigned integer comparisons
Just to shut gcc up.

https://bugzilla.gnome.org/show_bug.cgi?id=737338
2014-09-25 09:52:50 +01:00
Sweta Kothari
42d0dc363e Updated gujarati translations 2014-09-24 23:09:32 +05:30
Krishnababu Krothapalli
0ab9d66b05 Updated Telugu translation 2014-09-23 14:28:34 +00:00
Hib Eris
e1b84e3296 Include <stdint.h> in glib/valgrind.h
This ensures the uintptr_t type is defined on mingw-w64.

Fixes compile error:

make[4]: Entering directory
`/home/abuild/rpmbuild/BUILD/glib-2.42.0/gobject'
  CC       libgobject_2_0_la-gtype.lo
In file included from gtype.c:24:0:
../glib/valgrind.h: In function 'VALGRIND_PRINTF':
../glib/valgrind.h:5601:4: error: unknown type name 'uintptr_t'
    uintptr_t _qzz_res;
    ^

https://bugzilla.gnome.org/show_bug.cgi?id=737143
2014-09-23 09:08:16 -04:00
Saibal Ray
f5ed7d2d3e Updated Bengali (India) translation 2014-09-23 11:27:44 +00:00
Philip Withnall
f41ebebd34 gtask: Ignore errors from g_thread_pool_push()
g_thread_pool_push() only returns an error if it fails to spawn a new
thread. However, it unconditionally adds the task to its worker queue,
so:
 • if _any_ threads exist in the pool, the task will eventually be
   handled; and
 • if _no_ threads exist in the pool, the task will be handled if one
   is eventually successfully spawned.
If no more threads are ever spawned, the process probably has bigger
problems than a single GTask which is taking forever to complete.

https://bugzilla.gnome.org/show_bug.cgi?id=736806
2014-09-23 08:08:45 +01:00
Philip Withnall
925913d8dd gtask: Document signal handler reference counting
Explain why the signal handler holds a reference to the GTask, even
though that causes a reference loop at first glance.

https://bugzilla.gnome.org/show_bug.cgi?id=736806
2014-09-23 08:08:25 +01:00
Philip Withnall
c6838ffaa1 gtask: Fix a signed/unsigned integer comparison
The GSource times assigned to creation_time are always signed.

https://bugzilla.gnome.org/show_bug.cgi?id=736806
2014-09-23 08:08:25 +01:00
Ryan Lortie
26a240fd10 GLib 2.42.0 2014-09-22 13:15:17 -04:00
A S Alam
c8d884da43 update Punjabi Translation for 3.14 release 2014-09-21 08:52:43 -05:00
Rajesh Ranjan
db41a84239 Updated Hindi translation 2014-09-21 04:14:06 +00:00
YunQiang Su
d3c65dcbba Revert "update zh_CN translation"
Add wrong po file
This reverts commit ee3d55573f.
2014-09-21 10:58:01 +08:00
YunQiang Su
ee3d55573f update zh_CN translation 2014-09-21 10:30:53 +08:00
Tong Hui
f550be0c6a update zh_CN translation 2014-09-21 10:24:22 +08:00
Ask H. Larsen
a2d4a612c6 Updated Danish translation 2014-09-20 17:19:18 +02:00
Ryan Lortie
dceff8fc2c gmain: improve g_source_set_name thread safety
Step up thread safety on g_source_set_name() to the same standard as all
other GSource functions: after we are attached to a main context, this
function should be threadsafe.

https://bugzilla.gnome.org/show_bug.cgi?id=736683
2014-09-19 13:39:00 -04:00
Ryan Lortie
1cbdbef772 gsource: clarify restrictions on non-existant IDs
Document that one must not use the "by id" source APIs with non-existent
IDs.  The real justification behind this restriction is that the reuse
of source ids makes it unsafe to call these functions unless you're
absolutely sure that the source exists and it belongs to you.  If you
call one of these functions on a source that may already have been
removed then you run the risk of finding someone else's source (with
your reused id).

This also bails us out of a slightly tricky situation with respect to
the threadsafety of g_main_context_find_source_by_id().  The fact that
this function doesn't return a reference implies that its return value
cannot be safely accessed unless we already know for sure that a
reference is being held elsewhere (by example, by the main context
itself if we know that the source has not been removed).  The function
itself, however, performs an access to the value, which could result in
a crash.

If we mandate that it is only valid to call this function on
known-to-exist source IDs then we dodge this problem.

https://bugzilla.gnome.org/show_bug.cgi?id=736683
2014-09-19 13:39:00 -04:00