Commit Graph

122 Commits

Author SHA1 Message Date
Dan Winship
b8c13a01b6 win32: misc warning fixes
https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:06 -05:00
Cosimo Cecchi
4b602940e2 glib: don't quote quark names for G_DEFINE_QUARK 2012-08-28 13:16:24 -04:00
Matthias Clasen
4f12f7c029 Use G_DEFINE_QUARK for GLib's own quarks
This commit just deals with glib/.
gobject/ and gio/ will be handled in separate commits.
2012-08-28 00:08:07 -04:00
Colin Walters
003e7a70e8 Revert unintential IAPI break for g_key_file_load_from_data()
The old (length) annotation actually wasn't being read.  Changing
it to an array was telling g-i that it was an array of utf8, which
is clearly not true.

We *could* add (element-type guint8), but that would change it to a
byte array, as opposed to the original utf8 version.

Just removing the annotation should bring us back to where we
were, which was fine.

https://bugzilla.gnome.org/show_bug.cgi?id=680310
2012-07-20 14:07:39 -04:00
Ryan Lortie
4780ee5d4a glib/: gtk-doc cleanup 2012-06-25 23:23:58 -04:00
Matthias Clasen
defa25f3d0 GKeyFile: Deal better with blank lines
There is no need to store a has_trailing_blank_line boolean for
each group, we can just check this at the time we assemble the data.

This fixes a problem without roundtrips where we would sometimes
add an extra blank line between groups.

The testcase here is inspired by
https://bugzilla.gnome.org/show_bug.cgi?id=677817
2012-06-15 18:53:09 -04:00
Jasper St. Pierre
77695437b3 gkeyfile: Fix annotations for g_key_file_load_from_data
https://bugzilla.gnome.org/show_bug.cgi?id=675309
2012-05-11 19:31:52 -03:00
Robert Ancell
4143842eb4 Add missing allow-none annotations for function parameters.
Found using:
find . -name '*.c' | xargs grep 'or %NULL' | grep ' \* @' | grep -v '@error' | grep -v allow-none
2012-03-31 20:34:28 +11:00
David King
708d4178ce docs: Fix g_key_file_load_from_file error parameter 2012-02-21 01:10:54 +01:00
Giovanni Campagna
d240b88315 GKeyFile: fix annotation of g_key_file_load_from_data
(array) without (element-type) means "array of the same type as
the C type", so gchar* with (array) is interpreted as an array of
strings. Since GKeyFiles must be UTF-8 encoded anyway, just
annotate it as a string.

https://bugzilla.gnome.org/show_bug.cgi?id=658484
2012-02-14 19:05:08 +01:00
Ryan Lortie
9bfde4a53f GKeyFile: allow loading from empty strings
GKeyFile supports empty files and also supports loading from the string
"", but will fail with a critical if you try:

  - explicit length == 0
  - data == NULL

length == 0 should always be valid, and data == NULL should be valid in
the case that length == 0, so add some testcases for those and fix the
code up to allow them.

https://bugzilla.gnome.org/show_bug.cgi?id=668756
2012-01-26 14:40:34 -05:00
Matthias Clasen
e94a5f4f83 GKeyFile: make list separators effective again
We must preserve the list_separator across clear;init
sequences.
2012-01-25 07:32:39 -05:00
Ryan Lortie
fe10b2c966 GKeyFile: remove approximate_size optimisation
This is micro-optimisation of the worst kind and it's causing obscure
bugs in edge cases.  Better just remove this entirely.

https://bugzilla.gnome.org/show_bug.cgi?id=634232
2012-01-24 17:16:48 -05:00
Javier Jardón
2ae83e116b glib/*: Use g_list_free_full() 2012-01-03 16:53:47 +01:00
Simon McVittie
6457677b7d g_key_file_get_string_list: don't leak the pieces on error
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666113
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-14 18:09:48 +00:00
Simon McVittie
90baa7e460 GKeyFile: free group comments when the group is removed
These were leaked. Valgrind was sad.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666113
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-14 12:26:16 +00:00
Jürg Billeter
fcffe6abbb GKeyFile: Accept empty files
It already accepts files consisting solely of whitespace.

https://bugzilla.gnome.org/show_bug.cgi?id=663432
2011-11-17 23:11:41 -05:00
Giovanni Campagna
94accc2d78 GKeyFile: improve introspection annotations
Ensure that all methods that take or return arrays are annotated
(including length). Mark ref, unref and free methods as (skip).

https://bugzilla.gnome.org/show_bug.cgi?id=590808
2011-10-15 17:54:41 -04:00
Christian Persch
a57c9148cf GKeyFile: Add refcounting API
Adds g_key_file_ref and g_key_file_unref, to be used by a future
GKeyFile boxed type for language bindings.

Based on the patch by Christian Persch and Emmanuele Bassi.

Author: Christian Persch
Signed-off-by: Johan Dahlin
Signed-off-by: Giovanni Campagna

https://bugzilla.gnome.org/show_bug.cgi?id=590808
2011-10-15 17:44:45 -04:00
Matthias Clasen
9d3b37ac3f Move keyfile docs inline 2011-10-01 21:03:14 -04:00
Matthias Clasen
0db179e75e GKeyFile: Unify error messsages a bit
This marks a few forgotten error messages for translation, and
makes some other strings more uniform. String change!

https://bugzilla.gnome.org/show_bug.cgi?id=658715
2011-09-10 16:10:49 -04:00
Kushal Das
7a45dde4fe g_key_file_parse_value_as_integer: Integers can have trailing whitespaces or tabs
Now it can parse integer values with trailing whitespaces or tabs before CR.
Using g_ascii_isspace() as suggested.

https://bugzilla.gnome.org/show_bug.cgi?id=653987
2011-09-08 20:20:02 -04:00
Colin Walters
8b061e023c Revert addition of g_key_file_has_key_full
Per IRC discussion, we can just ask bindings to use
g_key_file_get_value() to test for the existence of a key.

I left the "fixed" code in the source tree as static because it makes
more sense to me.
2011-07-22 10:56:54 -04:00
Ryan Lortie
a0ed253718 move 'Since:' tags down
gtk-doc wants the Since: tag to be the absolute last thing in the docs
comment.
2011-07-22 15:47:24 +02:00
Dan Williams
7b22a8308f Document how to free return values from g_key_file_get_*_list
Makes the docs consistent with the string list getters.  Add
GOI annotations while we're at it.
2011-07-21 11:03:32 -05:00
Colin Walters
f0620902b2 Update annotations from gobject-introspection/gir/glib-2.0.c
This covers most of them.
2011-06-07 17:07:46 -04:00
Hanro
16bdb12e6d gkeyfile: Only test file descriptors against -1
Windows CE at least will return other (valid) negative values.
2011-06-02 15:44:19 -04:00
Matthias Clasen
807d41b89b Documentation fixups 2011-05-29 00:05:07 -04:00
Matthias Clasen
c38b7d769e Revert "g_key_file_has_key_full: Clarify the docs"
This reverts commit 4ddb84999d.
2011-05-21 11:14:05 -04:00
Matthias Clasen
4ddb84999d g_key_file_has_key_full: Clarify the docs 2011-05-21 11:12:08 -04:00
Colin Walters
9966fe4493 g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics
See https://bugzilla.gnome.org/show_bug.cgi?id=649657 for discussion
of why it's bad for bindings for gerror return values to both signal
errors and carry meaning.

https://bugzilla.gnome.org/show_bug.cgi?id=650345
2011-05-18 11:53:21 -04:00
John Lindgren
aeac5de2f8 keyfile: fill parse buffer in line sized chunks
When loading a keyfile the incoming bytes are fed
to a line buffer to get parsed each time a new line
is encountered.

The code that fills the line buffer does it inefficiently,
one byte at a time.

This commit changes that code to look ahead at the incoming
bytes for the next '\n' character and then fill the line buffer
all at once.

https://bugzilla.gnome.org/show_bug.cgi?id=650211
2011-05-16 23:41:55 -04:00
John Lindgren
9c1a44cf32 keyfile: avoid needless allocations on file load
When loading a key file, the keys and values of individual lines
are allocated once when copied and trimmed from the parse buffer
and allocated/copied again when added to the lookup map.

This commit avoids the second pair of allocations by introducing
a new function g_key_file_add_key_value_pair that gives the
lookup map direct ownership of the key and value copied from the
parse buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=650211
2011-05-16 23:36:39 -04:00
Benjamin Gilbert
440e6f4a61 Ensure g_key_file_load_from_file() strips a \r on a 4 KB boundary
When g_key_file_parse_data() encountered \n, it was checking the previous
character in the current input buffer for a \r to erase, rather than the
previous character in the parse buffer.  If g_key_file_load_from_file()
was given a file with a \r\n sequence straddling a 4 KB boundary, the \n
would be the first character in the input buffer, so the \r would not be
properly stripped.

Bug #640695.

Found-by: Jan Harkes <jaharkes@cs.cmu.edu>
2011-01-27 23:06:15 -05:00
Christian Persch
3d824065b8 Add g_get_locale_variants()
Make _g_compute_locale_variants() public as g_get_locale_variants().

Bug #635998.
2011-01-05 22:57:20 +01:00
Christian Persch
be8899bfe6 Make _g_compute_locale_variants return a char** directly
Bug #635998.
2011-01-05 22:49:21 +01:00
Ryan Lortie
2e53e50244 glib/: fully remove galias hacks 2010-07-07 19:34:35 -04:00
Simon McVittie
6bea235c8b Support 64bit integers in GKeyFile 2010-05-08 21:30:27 -04:00
Tor Lillqvist
5589d2b455 Internally use the _stati64 API explicitly on Windows
Avoids warnings and confusion when compiling with MSVC.
2010-02-04 19:58:55 +02:00
Matthias Clasen
53fc10d269 Fix a lot of clang complaints
Mostly dead assignments.
2009-09-18 19:20:06 -04:00
Hans Breuer
4a50bab276 Define fstat() for msvc build 2009-05-30 15:33:14 +02:00
Christian Persch
37bd225d7b Fix grammar in error message
Bug #583198.
2009-05-23 18:00:06 +02:00
Matthias Clasen
2dfce32422 Accept NULL as empty string list
Fixes bug 580656.
2009-05-02 22:41:19 -04:00
Matthias Clasen
0f6b25ca96 Fix some compiler warnings
svn path=/trunk/; revision=7755
2008-12-31 05:51:47 +00:00
Matthias Clasen
20bc7adfb8 Some more documentation additions
svn path=/trunk/; revision=7726
2008-12-02 05:53:48 +00:00
Matthias Clasen
0be828b4f8 Explain the difference to g_key_file_get_value(). Pointed out by Mart
* glib/gkeyfile.c (g_key_file_get_string): Explain the difference
        to g_key_file_get_value(). Pointed out by Mart Raudsepp.



svn path=/trunk/; revision=7705
2008-11-28 21:22:21 +00:00
Matthias Clasen
a2830c774d Improve docs
svn path=/trunk/; revision=7704
2008-11-28 20:29:42 +00:00
Christian Persch
da8591c7a8 Bug 560568 – gkeyfile docs buglet
svn path=/trunk/; revision=7674
2008-11-23 21:16:01 +00:00
Christian Persch
47d6d6a451 Bug 560569 – gkeyfile doesn't use the set list_separator in some cases
svn path=/trunk/; revision=7673
2008-11-23 21:15:57 +00:00
Christian Persch
9c17697b56 Use g_set_error_literal where appropriate. Patch from bug #535947.
svn path=/trunk/; revision=7051
2008-06-16 16:53:58 +00:00