summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--getht.c2
-rw-r--r--mediaxml.c7
-rw-r--r--tocxml.c1
3 files changed, 6 insertions, 4 deletions
diff --git a/getht.c b/getht.c
index a27104c..57d44c3 100644
--- a/getht.c
+++ b/getht.c
@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
med * cur_media;
int newest;
- issue = parsemedia(media_xml, &issue, &no_of_issues);
+ issue = parsemedia(media_xml, issue, &no_of_issues);
if(downlatestmedia)
{
diff --git a/mediaxml.c b/mediaxml.c
index 60d4576..b9631e2 100644
--- a/mediaxml.c
+++ b/mediaxml.c
@@ -190,10 +190,11 @@ iss ** parsemedia(char * filepath, iss ** issue, int * no_of_issues)
strncpy(issue[*no_of_issues]->title, (char *) xmlGetProp(node, "title"), STR_MAX);
- issue[*no_of_issues]->no_of_media = -1;
+ tmp = *no_of_issues;
}
- cur_media = issue[(*no_of_issues)]->media;
+ issue[tmp]->no_of_media = -1;
+ cur_media = issue[tmp]->media;
itnode = node->xmlChildrenNode;
@@ -215,7 +216,7 @@ iss ** parsemedia(char * filepath, iss ** issue, int * no_of_issues)
strncpy(cur_media->title, (char *) xmlNodeListGetString(media_file, itnode->xmlChildrenNode, 1), STR_MAX);
- issue[*no_of_issues]->no_of_media++;
+ issue[tmp]->no_of_media++;
cur_media++;
}
diff --git a/tocxml.c b/tocxml.c
index da0771b..a909d5c 100644
--- a/tocxml.c
+++ b/tocxml.c
@@ -94,6 +94,7 @@ iss ** parsetoc(char *filepath, int * iss_no, int * latest)
issue = tmp;
+ issue[no_of_issues]->no_of_media = -1; /* set default no of media */
issue[no_of_issues]->date.year = atoi( (const char *)(xmlStrsub(node->name,5,4)) );
tokenise_hyphons(xmlStrsub(cnode->name,6,5), &(issue[no_of_issues]->date.firstmonth), &(issue[no_of_issues]->date.lastmonth));
issue[no_of_issues]->no_of_sections = parseissue(file, cnode, issue[no_of_issues], latest);