[libgda] Misc. corrections
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Misc. corrections
- Date: Thu, 5 May 2011 12:17:51 +0000 (UTC)
commit 1ae9a4bc3fdf3b38c7ef41ba25cdbe3807277ed2
Author: Vivien Malerba <malerba gnome-db org>
Date: Tue May 3 16:28:46 2011 +0200
Misc. corrections
libgda/gda-attributes-manager.c | 2 +-
libgda/gda-connection.c | 17 +++++++++++------
libgda/gda-tree-node.c | 10 +++++-----
tools/browser/auth-dialog.c | 2 +-
4 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/libgda/gda-attributes-manager.c b/libgda/gda-attributes-manager.c
index 8124814..bd89108 100644
--- a/libgda/gda-attributes-manager.c
+++ b/libgda/gda-attributes-manager.c
@@ -250,7 +250,7 @@ manager_real_set (GdaAttributesManager *mgr, gpointer ptr,
* @mgr: a #GdaAttributesManager
* @ptr: a pointer to the resources to which the attribute will apply
* @att_name: an attribute's name
- * @value: a #GValue, or %NULL
+ * @value: (transfer none): a #GValue, or %NULL
*
* Associates an attribute named @att_name to @ptr, with the value @value. Any previous association is replaced by
* this one, and if @value is %NULL then the association is removed.
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 7ff4e5d..5da6358 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -2705,6 +2705,11 @@ gda_connection_statement_prepare (GdaConnection *cnc, GdaStatement *stmt, GError
}
}
+/*
+ * @args is consumed as a succession of (column number, GType) arguments
+ * which ends with a column number of -1. The returned array is always terminated by G_TYPE_NONE,
+ * and contains 0 where no column type information has been provided
+ */
static GType *
make_col_types_array (va_list args)
{
@@ -2712,16 +2717,16 @@ make_col_types_array (va_list args)
gint max = 10;
gint col;
- types = g_new (GType, max + 1);
- for (col = 0; col <= max; col ++)
- types[col] = G_TYPE_NONE;
+ types = g_new0 (GType, max + 1);
+ types [max] = G_TYPE_NONE;
for (col = va_arg (args, gint); col >= 0; col = va_arg (args, gint)) {
- if (col > max) {
+ if (col >= max) {
gint i;
types = g_renew (GType, types, col + 5 + 1);
- for (i = max; col <= col + 5; i ++)
- types[i] = G_TYPE_NONE;
+ for (i = max; i <= col + 5; i ++)
+ types[i] = 0;
max = col + 5;
+ types [max] = G_TYPE_NONE;
}
types [col] = va_arg (args, GType);
}
diff --git a/libgda/gda-tree-node.c b/libgda/gda-tree-node.c
index f40eef0..b8e9f81 100644
--- a/libgda/gda-tree-node.c
+++ b/libgda/gda-tree-node.c
@@ -1,5 +1,5 @@
-/* GDA library
- * Copyright (C) 2009 - 2010 The GNOME Foundation.
+/*
+ * Copyright (C) 2009 - 2011 The GNOME Foundation.
*
* AUTHORS:
* Vivien Malerba <malerba gnome-db org>
@@ -724,7 +724,7 @@ gda_tree_node_get_node_attribute (GdaTreeNode *node, const gchar *attribute)
* gda_tree_node_set_node_attribute:
* @node: a #GdaTreeNode
* @attribute: attribute name
- * @value: a #GValue, or %NULL
+ * @value: (transfer none): a #GValue, or %NULL
* @destroy: a function to be called when @attribute is not needed anymore, or %NULL
*
* Set the value associated to a named attribute. The @attribute string is used AS IT IS by this method (eg.
@@ -738,8 +738,8 @@ gda_tree_node_get_node_attribute (GdaTreeNode *node, const gchar *attribute)
* For example one would use it as:
*
* <code>
- * gda_tree_node_set_node_attribute (node, g_strdup (my_attribute), g_free, my_value);
- * gda_tree_node_set_node_attribute (node, GDA_ATTRIBUTE_NAME, NULL, my_value);
+ * gda_tree_node_set_node_attribute (node, g_strdup (my_attribute), my_value, g_free);
+ * gda_tree_node_set_node_attribute (node, GDA_ATTRIBUTE_NAME, my_value, NULL);
* </code>
*
* If there is already an attribute named @attribute set, then its value is replaced with the new value (@value is
diff --git a/tools/browser/auth-dialog.c b/tools/browser/auth-dialog.c
index 744aec8..37ade6f 100644
--- a/tools/browser/auth-dialog.c
+++ b/tools/browser/auth-dialog.c
@@ -622,7 +622,7 @@ auth_dialog_run (AuthDialog *dialog)
const GValue *cvalue = NULL;
if (gda_holder_is_valid (holder))
cvalue = gda_holder_get_value (holder);
- if (cvalue) {
+ if (cvalue && (G_VALUE_TYPE (cvalue) != GDA_TYPE_NULL)) {
gchar *r1, *r2;
r1 = gda_value_stringify (cvalue);
r2 = gda_rfc1738_encode (r1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]