[libgda/LIBGDA_4.0] Bug fix in gda_connection_string_split()
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_4.0] Bug fix in gda_connection_string_split()
- Date: Sat, 11 Sep 2010 16:44:59 +0000 (UTC)
commit 8c08ed3b579cd41327948d39b14976da57072603
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun Aug 29 21:33:35 2010 +0200
Bug fix in gda_connection_string_split()
libgda/gda-util.c | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index b2996b1..eaad030 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -2223,35 +2223,35 @@ gda_connection_string_split (const gchar *string, gchar **out_cnc_params, gchar
for (ptr = pos + 9; ptr && *ptr != '\0' && *ptr != ';'; ptr++);
if (ptr != pos + 9)
*out_username = g_strndup (pos + 9, ptr - (pos + 9));
+
+ if (*ptr)
+ g_memmove (pos, ptr + 1, strlen (ptr));
+ else
+ *pos = 0;
gchar *tmp;
- gint lastpos;
- tmp = g_strndup (*out_cnc_params, pos - *out_cnc_params);
- *out_cnc_params = g_strconcat (tmp,
- (ptr ? (ptr + 1 ? ptr + 1 : ptr) : ""),
- NULL);
- g_free (tmp);
+ gint len;
tmp = *out_cnc_params;
- lastpos = strlen(tmp) - 1;
- if (tmp [lastpos] == ';')
- tmp [lastpos] = 0;
+ len = strlen (tmp) - 1;
+ if (tmp [len] == ';')
+ tmp [len] = 0;
}
-
+
pos = g_strrstr (*out_cnc_params, "PASSWORD=");
if (pos) {
for (ptr = pos + 9; ptr && *ptr != '\0' && *ptr != ';'; ptr++);
if (ptr != pos + 9)
*out_password = g_strndup (pos + 9, ptr - (pos + 9));
+
+ if (*ptr)
+ g_memmove (pos, ptr + 1, strlen (ptr));
+ else
+ *pos = 0;
gchar *tmp;
- gint lastpos;
- tmp = g_strndup (*out_cnc_params, pos - *out_cnc_params);
- *out_cnc_params = g_strconcat (tmp,
- (ptr ? (ptr + 1 ? ptr + 1 : ptr) : ""),
- NULL);
- g_free (tmp);
+ gint len;
tmp = *out_cnc_params;
- lastpos = strlen(tmp) - 1;
- if (tmp [lastpos] == ';')
- tmp [lastpos] = 0;
+ len = strlen (tmp) - 1;
+ if (tmp [len] == ';')
+ tmp [len] = 0;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]