From: Bastian Dehn Date: Sat, 23 Dec 2017 20:50:10 +0000 (+0100) Subject: fix: count line bug X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=8d9b06e586f28e8d46e78edee58fc3e875074082;p=discspan.git fix: count line bug --- diff --git a/discspan.c b/discspan.c index f3e5239..9bea789 100644 --- a/discspan.c +++ b/discspan.c @@ -89,6 +89,7 @@ unsigned long fill_array_from_file(FILE *in, struct file_size *fs, fprintf(ignore, "%s\n", pfad); } } + lines--; fs = (struct file_size *)realloc(fs, lines * sizeof(struct file_size)); @@ -125,12 +126,8 @@ int splitter(struct file_size *input, const char *output, for(int i = 0; i <= length; i++) { // filesize inklusive overhead if(splitgroesse >= input[i].fsize) { - if(i < length) { - splitgroesse -= input[i].fsize; - fprintf(out, "%s\n", input[i].name); - } else { - fprintf(out, "%s", input[i].name); - } + splitgroesse -= input[i].fsize; + fprintf(out, "%s\n", input[i].name); } else { rest[restcount++] = input[i]; }