summaryrefslogtreecommitdiff
path: root/mediarev.c
diff options
context:
space:
mode:
authorNick White <arch@njw.me.uk>2007-04-30 08:34:43 +0000
committerNick White <arch@njw.me.uk>2007-04-30 08:34:43 +0000
commit1edf37e3b0ad7b0556ba0902b5880044933ced66 (patch)
tree13447080a2c59a6345fa26301e365fcbb7b8ad4d /mediarev.c
parent1f0a1fd57bd1dbddab4ad189a721fbe67f59ca3a (diff)
Removed last of static issue array code, added sorting
Removed defined constants from issue.h previously used to determine size of static arrays Removed unused separate show media structure function Remove clean media & clean issue functions Added issue sorting code git-archimport-id: getht@sv.gnu.org/getht--mainline--0.1--patch-22
Diffstat (limited to 'mediarev.c')
-rw-r--r--mediarev.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/mediarev.c b/mediarev.c
index 777e786..e8dd3e6 100644
--- a/mediarev.c
+++ b/mediarev.c
@@ -30,17 +30,21 @@ int smilurl(char * smilurl, med * cur_media);
void getquote(char * input, char * label);
void removeleadingspace(char * cur_line);
-int parsemediagz(char * media_path, med * cur_media, int * no_of_media)
+med ** parsemediagz(char * media_path, int * no_of_media)
/* Parses gzipped adobe pagemaker files for media urls and metadata,
- * filling cur_media with the information. */
+ * filling media with the information. */
{
char cur_line[STR_MAX];
gzFile mediagz;
+ med ** media = NULL;
+
strcpy(cur_line,""); /* reset cur_line */
mediagz = gzopen(media_path, "r");
+ med * cur_media;
+
while(gzeof(mediagz)==0)
{
gzgets(mediagz, cur_line, STR_MAX);
@@ -49,6 +53,20 @@ int parsemediagz(char * media_path, med * cur_media, int * no_of_media)
if(!strcmp(cur_line,"on mouseUp"))
{
strcpy(cur_line,""); /* reset cur_line */
+
+ /* assign memory for the new media */
+ media = assignnew_med(media, no_of_media);
+
+ cur_media = media[*no_of_media];
+
+ /* setup media globals */
+ cur_media->uri[0] = '\0';
+ cur_media->title[0] = '\0';
+ cur_media->comment[0] = '\0';
+ cur_media->preview_uri[0] = '\0';
+ cur_media->size = 0;
+
+ /* process rev file */
while(strcmp(cur_line,"end mouseUp") && gzeof(mediagz)==0)
{
strcpy(cur_line,""); /* reset cur_line */
@@ -72,16 +90,11 @@ int parsemediagz(char * media_path, med * cur_media, int * no_of_media)
getquote(cur_line,cur_media->comment);
}
}
- *cur_media++;
- (*no_of_media)++;
}
strcpy(cur_line,""); /* reset cur_line */
}
- if(*no_of_media == -1)
- return 1;
-
- return 0;
+ return media;
}
int smilurl(char * smilurl, med * cur_media)