]> gitweb.hhaalo.de Git - discspan.git/commitdiff
change: reduce splitter parameter
authorBastian Dehn <hhaalo@arcor.de>
Mon, 26 Jul 2021 18:51:38 +0000 (20:51 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 26 Jul 2021 18:51:38 +0000 (20:51 +0200)
discspan.c
splitter.c
splitter.h

index 7bb1f70ee00ea54c384af5dc3080ebdacf05c68b..e3d5547e9cf469334f1a770534564890ce956319 100644 (file)
@@ -12,7 +12,7 @@ extern void (*printEvent)(const char *output, unsigned long long splitgroesse);
 extern void useage();
 extern file_size_t * read_input_file();
 extern file_size_t * splitter(file_size_t *input, const char *output,
-                       unsigned long long splitgroesse, int length);
+                       unsigned long long splitgroesse);
 
 int struct_array_length = 0;
 unsigned long long split = 0;
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
        int num = 1;
        while (struct_array_length > 0) {
                sprintf(outname, "%s%03d", output, num++);
-               fs = splitter(fs, outname, split, struct_array_length);
+               fs = splitter(fs, outname, split);
        }
 
        free(fs);
index 98b60d39ff97340cd4480a2c049813751754f94a..f2eb2351b63079fa48c1a8ee44cb9558a96ae493 100644 (file)
@@ -26,18 +26,18 @@ void onPrintEvent(const char *output, unsigned long long splitgroesse)
 }
 
 file_size_t * splitter(file_size_t *input, const char *output,
-               unsigned long long splitgroesse, int length)
+               unsigned long long splitgroesse)
 {
        file_size_t *rest = (file_size_t *)
-               malloc(length * sizeof(file_size_t));
+               malloc(struct_array_length * sizeof(file_size_t));
        file_size_t *disc = (file_size_t *)
-               malloc(length * sizeof(file_size_t));
+               malloc(struct_array_length * sizeof(file_size_t));
 
        unsigned long long filesize = 0;
        int restcount = 0;
        int disccount = 0;
 
-       for (int i = 0; i < length; i++) {
+       for (int i = 0; i < struct_array_length; i++) {
                // ISO9660 filesystem overhead
                filesize = ceil(input[i].fsize / 2048.0) * 2048;
 
index da7f3ae562ea5d83fb73cef534718bf44afeb689..77614a44a35c78ce17be03c2fd61faf96e30d4ec 100644 (file)
@@ -22,6 +22,6 @@ void (*printEvent)(const char *output, unsigned long long splitgroesse);
  * @return Restlaenge des neuen Arrays
  */
 file_size_t * splitter(file_size_t *input, const char *output,
-               unsigned long long splitgroesse, int length);
+               unsigned long long splitgroesse);
 
 #endif