[Xfce4-commits] <midori:master> Work around sqlite3_mprintf for bookmark metadata
Christian Dywan
noreply at xfce.org
Sat Jun 26 17:46:01 CEST 2010
Updating branch refs/heads/master
to 7c4263ebca3ccdea14dd0a645ee3c13aed205bc4 (commit)
from a84a077ac84bb43250b09cc657856b128b20d050 (commit)
commit 7c4263ebca3ccdea14dd0a645ee3c13aed205bc4
Author: Alexander Butenko <a.butenka at gmail.com>
Date: Tue Jun 22 13:08:55 2010 -0400
Work around sqlite3_mprintf for bookmark metadata
panels/midori-bookmarks.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c
index cbac36c..225a73d 100644
--- a/panels/midori-bookmarks.c
+++ b/panels/midori-bookmarks.c
@@ -214,13 +214,11 @@ midori_bookmarks_insert_item_db (sqlite3* db,
{
gchar* sqlcmd;
char* errmsg = NULL;
- gint64 type;
+ int type = 0;
gchar* parent;
if (katze_item_get_uri (item))
type = 1;
- else
- type = 0;
if (folder)
parent = g_strdup (folder);
@@ -229,15 +227,18 @@ midori_bookmarks_insert_item_db (sqlite3* db,
else
parent = g_strdup ("");
- sqlcmd = sqlite3_mprintf (
+ /* Workaround a sqlite3_mprintf error with
+ handling of katze_item_get_meta_integer(). */
+ /* FIXME: Need proper single quote escaping. */
+ sqlcmd = g_strdup_printf (
"INSERT into bookmarks (uri, title, folder, type, toolbar, app) values"
- " ('%q', '%q', '%q', %u, %u, %u)",
+ " ('%s', '%s', '%s', %d, %d, %d)",
katze_item_get_uri (item),
katze_item_get_name (item),
parent,
type,
- katze_item_get_meta_integer (item, "toolbar"),
- katze_item_get_meta_integer (item, "app"));
+ (int)katze_item_get_meta_integer (item, "toolbar"),
+ (int)katze_item_get_meta_integer (item, "app"));
if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
{
@@ -246,7 +247,7 @@ midori_bookmarks_insert_item_db (sqlite3* db,
}
g_free (parent);
- sqlite3_free (sqlcmd);
+ g_free (sqlcmd);
}
void
More information about the Xfce4-commits
mailing list