]> gitweb.hhaalo.de Git - discspan.git/commitdiff
fix: count line bug
authorBastian Dehn <hhaalo@arcor.de>
Sat, 23 Dec 2017 20:50:10 +0000 (21:50 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 23 Dec 2017 20:50:10 +0000 (21:50 +0100)
discspan.c

index f3e523906edbf72a3bf6e1697a6525aa49a9fbc0..9bea7897fadf31f302647306306efb60dd177c6d 100644 (file)
@@ -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];
                }