diff --git a/src/movies.c b/src/movies.c index 3756081..e50e306 100644 --- a/src/movies.c +++ b/src/movies.c @@ -362,11 +362,10 @@ void createMoviesHTML(progConfig *conf, fileList *list) { pthread_create(&threads[i], NULL, movieHTML, (void *) &threadObj[i]); } - i=0; fileList *htmlList=newList(); addData(htmlList, MOVIE_HTML_TOP); - for (fileList *temp=list; temp!=NULL; temp=temp->next, i++) { + for (i--; i>=0; i--) { pthread_join(threads[i], NULL); for (size_t j=0; jdataSize; j++) { addData(htmlList, threadObj[i].list->data[j]); diff --git a/src/tvshow.c b/src/tvshow.c index cafc354..e47c8bc 100755 --- a/src/tvshow.c +++ b/src/tvshow.c @@ -599,7 +599,7 @@ void createShowsHTML(progConfig *conf, fileList *list) { mallocMacro(threads, sizeof(pthread_t)*list->listSize, "createShowsHTML error"); threadStruct *threadObj=NULL; mallocMacro(threadObj, sizeof(threadStruct)*list->listSize, "createShowsHTML error"); - size_t i=0; + int i=0; for (fileList *temp=list; temp!=NULL; temp=temp->next) { threadObj[i].conf=conf; threadObj[i].data=temp->data; @@ -611,12 +611,11 @@ void createShowsHTML(progConfig *conf, fileList *list) { i++; } - i=0; fileList *htmlList=newList(); addData(htmlList, TV_HTML_TOP); char *htmlStr=NULL; - for (fileList *temp=list; temp!=NULL; temp=temp->next) { + for (i--; i>=0; i--) { pthread_join(threads[i], NULL); char *showFile=NULL; char *showPoster=NULL; @@ -650,7 +649,6 @@ void createShowsHTML(progConfig *conf, fileList *list) { freeList(threadObj[i].list); tryFree(showFile); tryFree(showPoster); - i++; } addData(htmlList, TV_HTML_BOT); fileListToFile(htmlList, conf->TVhtml, "", ""); diff --git a/src/tvshow.h b/src/tvshow.h index ae2c204..e867c3a 100644 --- a/src/tvshow.h +++ b/src/tvshow.h @@ -4,7 +4,7 @@ #define TV_HTML_TOP "\n\n\ncmyflix\n\n\n\n\n\n\n\n\n\n\n
\n" -#define TV_HTML_FRAME "
\n\n
\n
\n\n
\n
\n
\n" +#define TV_HTML_FRAME "
\n\n
\n
\n\n
\n
\n
\n" #define TV_HTML_BOT "\n
\n
\n
\n\n"