From: Darren S. <ds...@us...> - 2005-01-16 17:57:25
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22799/src Modified Files: key_events.c play_item.c playlist.c Log Message: Escape some text when writing XML. (Unescaping when reading is handled by new code in xine-lib.) Index: key_events.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/key_events.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- key_events.c 15 Jan 2005 04:10:28 -0000 1.52 +++ key_events.c 16 Jan 2005 17:57:14 -0000 1.53 @@ -404,16 +404,17 @@ do { key_binding_t *key_binding = lookup_binding (&iter); - + char *desc = xml_escape_string (key_binding->desc, XML_ESCAPE_NO_QUOTE); + char *cmd = xml_escape_string (key_binding->cmd, XML_ESCAPE_NO_QUOTE); fprintf (f, " <KEYBINDING>\n" " <DESCRIPTION>%s</DESCRIPTION>\n" " <COMMAND>%s</COMMAND>\n" " <KEYVAL>%d</KEYVAL>\n" " <STATE>%d</STATE>\n" " </KEYBINDING>\n", - key_binding->desc, key_binding->cmd, - key_binding->keyval, key_binding->state); - + desc, cmd, key_binding->keyval, key_binding->state); + free (desc); + free (cmd); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (kb_store), &iter)); } Index: play_item.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/play_item.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- play_item.c 12 Jan 2005 00:26:33 -0000 1.16 +++ play_item.c 16 Jan 2005 17:57:15 -0000 1.17 @@ -150,13 +150,27 @@ fprintf (fh, " "); } -void play_item_save (play_item_t *item, FILE *fh, int depth) { - - printf_depth (fh, depth); fprintf (fh, "<ENTRY>\n"); - printf_depth (fh, depth); fprintf (fh, " <TITLE>%s</TITLE>\n", item->title); - printf_depth (fh, depth); fprintf (fh, " <REF HREF=\"%s\"/>\n", item->mrl); - printf_depth (fh, depth); fprintf (fh, " <TIME start=\"%d\"/>\n", item->start_time); - printf_depth (fh, depth); fprintf (fh, "</ENTRY>\n"); +void play_item_save (play_item_t *item, FILE *fh, int depth) +{ + char *title = xml_escape_string (item->title, XML_ESCAPE_NO_QUOTE); + char *mrl = xml_escape_string (item->mrl, XML_ESCAPE_DOUBLE_QUOTE); + char *indent = malloc (depth * 2 + 1); + + memset (indent, ' ', depth * 2); + indent[depth * 2] = 0; + + fprintf (fh, "%s<ENTRY>\n" + "%s <TITLE>%s</TITLE>\n" + "%s <REF HREF=\"%s\"/>\n" + "%s <TIME start=\"%d\"/>\n" + "%s</ENTRY>\n", + indent, + indent, title, + indent, mrl, + indent, item->start_time, + indent); + free (title); + free (mrl); } play_item_t *play_item_load (xml_node_t *node) { Index: playlist.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/playlist.c,v retrieving revision 1.106 retrieving revision 1.107 diff -u -r1.106 -r1.107 --- playlist.c 15 Jan 2005 04:10:28 -0000 1.106 +++ playlist.c 16 Jan 2005 17:57:15 -0000 1.107 @@ -329,16 +329,11 @@ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (pl_store), &iter)) { do { - GValue vi; - play_item_t *play_item; - memset (&vi, 0, sizeof (GValue)); gtk_tree_model_get_value (GTK_TREE_MODEL (pl_store), &iter, 2, &vi); - play_item = g_value_peek_pointer (&vi); - - play_item_save (play_item, f, 2); + play_item_save (g_value_peek_pointer (&vi), f, 1); g_value_unset (&vi); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL(pl_store), &iter)); |