[glib] gkeyfile: Be more specific about error codes in documentation
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gkeyfile: Be more specific about error codes in documentation
- Date: Sun, 5 Feb 2017 14:04:22 +0000 (UTC)
commit edc68f26599392013d6a4ac4cf20924d2f9b4d82
Author: Philip Withnall <withnall endlessm com>
Date: Wed Jan 11 14:01:25 2017 +0000
gkeyfile: Be more specific about error codes in documentation
It’s hard to know whether trying to load a non-existent key file will
result in G_KEY_FILE_ERROR_NOT_FOUND or G_FILE_ERROR_NOENT; try to
improve the documentation to clarify that.
https://bugzilla.gnome.org/show_bug.cgi?id=777135
glib/gkeyfile.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index abad20d..b8a84db 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -828,8 +828,13 @@ g_key_file_load_from_fd (GKeyFile *key_file,
* @error: return location for a #GError, or %NULL
*
* Loads a key file into an empty #GKeyFile structure.
- * If the file could not be loaded then @error is set to
- * either a #GFileError or #GKeyFileError.
+ *
+ * If the OS returns an error when opening or reading the file, a
+ * %G_FILE_ERROR is returned. If there is a problem parsing the file, a
+ * %G_KEY_FILE_ERROR is returned.
+ *
+ * This function will never return a %G_KEY_FILE_ERROR_NOT_FOUND error. If the
+ * @file is not found, %G_FILE_ERROR_NOENT is returned.
*
* Returns: %TRUE if a key file could be loaded, %FALSE otherwise
*
@@ -967,9 +972,13 @@ g_key_file_load_from_bytes (GKeyFile *key_file,
*
* This function looks for a key file named @file in the paths
* specified in @search_dirs, loads the file into @key_file and
- * returns the file's full path in @full_path. If the file could not
- * be loaded then an %error is set to either a #GFileError or
- * #GKeyFileError.
+ * returns the file's full path in @full_path.
+ *
+ * If the file could not be found in any of the @search_dirs,
+ * %G_KEY_FILE_ERROR_NOT_FOUND is returned. If
+ * the file is found but the OS returns an error when opening or reading the
+ * file, a %G_FILE_ERROR is returned. If there is a problem parsing the file, a
+ * %G_KEY_FILE_ERROR is returned.
*
* Returns: %TRUE if a key file could be loaded, %FALSE otherwise
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]