Merge lp:~tuxator/midori/fix-1184505 into lp:midori

Proposed by Paweł Forysiuk
Status: Merged
Approved by: André Stösel
Approved revision: 6208
Merged at revision: 6208
Proposed branch: lp:~tuxator/midori/fix-1184505
Merge into: lp:midori
Diff against target: 70 lines (+14/-7)
2 files modified
midori/midori-bookmarks.c (+7/-5)
panels/midori-bookmarks.c (+7/-2)
To merge this branch: bzr merge lp:~tuxator/midori/fix-1184505
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Review via email: mp+169257@code.launchpad.net

Commit message

Specify int64 id item as a string in bookmark remove/update queries

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-bookmarks.c'
2--- midori/midori-bookmarks.c 2012-11-25 15:37:41 +0000
3+++ midori/midori-bookmarks.c 2013-06-13 17:00:46 +0000
4@@ -48,19 +48,21 @@
5 {
6 gchar* sqlcmd;
7 char* errmsg = NULL;
8-
9-
10- sqlcmd = sqlite3_mprintf (
11- "DELETE FROM bookmarks WHERE id = %" G_GINT64_FORMAT ";",
12+ gchar* id;
13+
14+ id = g_strdup_printf ("%" G_GINT64_FORMAT,
15 katze_item_get_meta_integer (item, "id"));
16
17+ sqlcmd = sqlite3_mprintf ("DELETE FROM bookmarks WHERE id = %q", id);
18+
19 if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
20 {
21- g_printerr (_("Failed to remove history item: %s\n"), errmsg);
22+ g_printerr (_("Failed to remove bookmark item: %s\n"), errmsg);
23 sqlite3_free (errmsg);
24 }
25
26 sqlite3_free (sqlcmd);
27+ g_free (id);
28 }
29
30 #define _APPEND_TO_SQL_ERRORMSG(custom_errmsg) \
31
32=== modified file 'panels/midori-bookmarks.c'
33--- panels/midori-bookmarks.c 2013-06-04 17:28:05 +0000
34+++ panels/midori-bookmarks.c 2013-06-13 17:00:46 +0000
35@@ -556,6 +556,10 @@
36 char* errmsg = NULL;
37 gchar* parentid;
38 gboolean updated;
39+ gchar* id;
40+
41+ id = g_strdup_printf ("%" G_GINT64_FORMAT,
42+ katze_item_get_meta_integer (item, "id"));
43
44 if (katze_item_get_meta_integer (item, "parentid") > 0)
45 parentid = g_strdup_printf ("%" G_GINT64_FORMAT,
46@@ -566,14 +570,14 @@
47 sqlcmd = sqlite3_mprintf (
48 "UPDATE bookmarks SET "
49 "parentid=%q, title='%q', uri='%q', desc='%q', toolbar=%d, app=%d "
50- "WHERE id = %" G_GINT64_FORMAT ";",
51+ "WHERE id = %q ;",
52 parentid,
53 katze_item_get_name (item),
54 katze_str_non_null (katze_item_get_uri (item)),
55 katze_str_non_null (katze_item_get_meta_string (item, "desc")),
56 katze_item_get_meta_boolean (item, "toolbar"),
57 katze_item_get_meta_boolean (item, "app"),
58- katze_item_get_meta_integer (item, "id"));
59+ id);
60
61 updated = TRUE;
62 if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
63@@ -585,6 +589,7 @@
64
65 sqlite3_free (sqlcmd);
66 g_free (parentid);
67+ g_free (id);
68
69 return updated;
70 }

Subscribers

People subscribed via source and target branches

to all changes: