summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <arch@njw.me.uk>2007-07-02 22:15:11 +0000
committerNick White <arch@njw.me.uk>2007-07-02 22:15:11 +0000
commit8e189aaac36056e58b08573c6c57f8dabf1ef905 (patch)
tree74e16450f4a5040221ecdfdd9707ce0f4c47b44c
parent5b4f728bc58d137dd946030d8c11b309b1216743 (diff)
Fixed xml encoding bug
Removed defunct entry in BUGS re: clearmed Fixed bug caused by attempting to read the ISO-8859-1 xml file as UTF-8 git-archimport-id: getht@sv.gnu.org/getht--mainline--0.1--patch-30
-rw-r--r--BUGS35
-rw-r--r--src/mediarev.c5
-rw-r--r--src/tocxml.c3
-rw-r--r--src/xml.c3
4 files changed, 40 insertions, 6 deletions
diff --git a/BUGS b/BUGS
index fb483d5..bd23d3a 100644
--- a/BUGS
+++ b/BUGS
@@ -1,2 +1,33 @@
-getht.c
- running clearmed clears unrelated title in update media section
+!! BIG BUG !!
+read media xml crashes, as cannot find any issue info, so sets issue & leaves an item with all blank fields
+a few things to fix with this:
+
+ read rev:
+ at the moment looks for
+ set the filename of player \"player1\" to \"%s\"
+ set the filename of player \"player1\" to \"
+ however, "player1" has now been changed to "PubDesk"
+ therefore change scanning routine to along the lines of
+ set the filename of player \"*\" to \"%s\"
+ more complex but worthwhile
+ -also-
+ if no url is found inside a "on mouseUp" clause, do not keep a blank media entry
+ best way to do this would be to:
+ dealloc the media item,
+ realloc the pointer array,
+ and -1 to no_of_media
+
+ read media xml:
+ should not segfault if it finds an empty item
+ prob needs to check that string is not blank before trying to copy info
+
+further progress:
+- main obstacle is that "on mouseUp" no longer necessarily follows a newline - file now less organised still
+ therefore we'll have to scan each line (except when already in useful clause (check this) char by char for the occurance
+ best way to do this would be to scan char by char, and if one worthwhile is found to copy from the start to a new string for parsing
+ worth spending a few minutes checking if there's a library function out there to do this, if not create a simple generic one, using pointers, roughly of the form:
+ int containstring(char * toparse, char * match), returning 1 if found and 0 otherwise
+- change of scanning routine has been done, but is untested
+ consider changing for an improved getquote which can take the nth quote
+ this is due to it being best not to rely on end of lines at end of bit we're interested in
+- 2nd clause of above (if no url is found) is very important now, as majority are unuseful
diff --git a/src/mediarev.c b/src/mediarev.c
index e8dd3e6..b81d8c6 100644
--- a/src/mediarev.c
+++ b/src/mediarev.c
@@ -75,10 +75,11 @@ med ** parsemediagz(char * media_path, int * no_of_media)
removeleadingspace(cur_line);
- if(!strncmp(cur_line,"set the filename of player \"player1\" to \"",41))
+ if(!strncmp(cur_line,"set the filename of player \"", 28))
{
/* todo: check if smil, if so follow to find uri */
- sscanf(cur_line,"set the filename of player \"player1\" to \"%s\"",cur_media->uri);
+ //sscanf(cur_line,"set the filename of player \"player1\" to \"%s\"",cur_media->uri);
+ sscanf(cur_line,"set the filename of player \"%[^\"] to \"%s\"",NULL,cur_media->uri);
cur_media->uri[strlen(cur_media->uri)-1] = '\0'; /* workaround extra character */
}
else if(!strncmp(cur_line,"set the label of this stack to \"",32))
diff --git a/src/tocxml.c b/src/tocxml.c
index 5fc7166..08ca12b 100644
--- a/src/tocxml.c
+++ b/src/tocxml.c
@@ -206,7 +206,8 @@ int cur_identifiers(char * filepath, char * title, issdates * date)
{
xmlDocPtr file;
- if((file = xmlParseFile(filepath)) == NULL)
+// if((file = xmlParseFile(filepath)) == NULL)
+ if((file = xmlReadFile(filepath, "ISO-8859-1", 0)) == NULL)
{
return 1;
}
diff --git a/src/xml.c b/src/xml.c
index 1a3ea3c..d822040 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -34,7 +34,8 @@ int ready_xml(char * filepath, char * rootnode, xmlDocPtr * file, xmlNodePtr * n
if(access(filepath, R_OK) != 0)
return 1;
- if((*file = xmlParseFile(filepath)) == NULL)
+// if((*file = xmlParseFile(filepath)) == NULL)
+ if((*file = xmlReadFile(filepath, "ISO-8859-1", 0)) == NULL)
{
fprintf(stderr, "Error: cannot open xml file %s\n", filepath);
return 1;