]> gitweb.hhaalo.de Git - discspan.git/commitdiff
change stdint library
authorBastian Dehn <hhaalo@arcor.de>
Sat, 6 Sep 2025 10:23:06 +0000 (12:23 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 6 Sep 2025 10:23:06 +0000 (12:23 +0200)
libs/spandisc/src/filehandler.c
libs/spandisc/src/logic.c
libs/spandisc/src/spandisc.c
libs/spandisc/src/spandisc.h
libs/spandisc/src/splitter.c
src/discspan.c

index 437e97a806d7b10d6350d56a767a007e74bf49b2..016d8a981f7737c1aabcb41660b77e69ef502f19 100644 (file)
@@ -2,6 +2,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 
 #include "filehandler.h"
 
@@ -46,7 +47,7 @@ void write_output_file(const char *output, medium_t* disc)
 {
        FILE *out = fopen(output, "w");
 
-       for (int i = 0; i < disc->length; i++) {
+       for (uint32_t i = 0; i < disc->length; i++) {
                fprintf(out, "%s\n", disc->filearray[i]->name);
        }
 
index 33644398edf6fcc5ff85702f98adc3ca2c9db5fe..3ea18eac5a984c625d45695092d216e9462e8c7e 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 
 #include "config_spandisc.h"
 #include "logic.h"
@@ -32,7 +33,7 @@ void span(const char *input, const char *output, unsigned long long split)
        split_all(srcdata, col);
 
        char* outname = malloc(sizeof(char) * (strlen(output) + NUM_LEN));
-       for (int i = 0; i < col->length; i++) {
+       for (uint32_t i = 0; i < col->length; i++) {
                sprintf(outname, "%s%04d", output, col->disc[i]->nr);
                on_status_print(outname, col->disc[i]);
                write_output_file(outname, col->disc[i]);
index a220b6d24c111665bd719067145917aadbbe52b6..1f64f088e7a1d458c90e2dc39039964d4822e70d 100644 (file)
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include <stdint.h>
 #include "spandisc.h"
 
 collection_t* init_collection()
@@ -52,7 +53,7 @@ void free_medium_complete(medium_t* medium)
 
 void free_collection(collection_t *col)
 {
-       for (int i = 0; i < col->length; i++) {
+       for (uint32_t i = 0; i < col->length; i++) {
                free_medium_complete(col->disc[i]);
                col->disc[i] = NULL;
        }
index 10486c396bd9e82cdfbec448f1ffc655c55665eb..62e2abe098d9bd64e6386f2897bbe4306610ddf7 100644 (file)
@@ -3,19 +3,19 @@
 
 typedef struct {
        char* name;
-       unsigned long long fsize;
-       unsigned int type;
+       uint64_t fsize;
+       uint32_t type;
 } file_size_t;
 
 typedef struct {
-       int nr;
-       unsigned long long freespace;
-       int length;
+       int16_t nr;
+       uint64_t freespace;
+       uint32_t length;
        file_size_t **filearray;
 } medium_t;
 
 typedef struct {
-       int length;
+       uint32_t length;
        medium_t **disc;
 } collection_t;
 
index 30b54d91f2d5e44830ff4b83f44a8ae6b9a0a6dc..414ae5040012a68dce7d749d19d1a9eda09159d5 100644 (file)
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdbool.h>
+#include <stdint.h>
 
 #include "splitter.h"
 
@@ -10,8 +11,8 @@
 
 int cmpfunc(const void *filea, const void *fileb)
 {
-       unsigned long long a = (*(const file_size_t**)filea)->fsize;
-       unsigned long long b = (*(const file_size_t**)fileb)->fsize;
+       uint64_t a = (*(const file_size_t**)filea)->fsize;
+       uint64_t b = (*(const file_size_t**)fileb)->fsize;
 
        if (a < b)
                return 1;
@@ -32,7 +33,7 @@ int strcmpfunc(const void *filea, const void *fileb)
 
 bool can_add_file_to_medium(medium_t *disc, file_size_t *file)
 {
-       unsigned long long filesize = ceil(file->fsize / BLOCK_SIZE) * BLOCK_SIZE;
+       uint64_t filesize = ceil(file->fsize / BLOCK_SIZE) * BLOCK_SIZE;
 
        if (disc->freespace < filesize)
                return false;
@@ -43,7 +44,7 @@ bool can_add_file_to_medium(medium_t *disc, file_size_t *file)
 
 bool bigger_file_ignore_medium(medium_t *disc, file_size_t *file)
 {
-       unsigned long long filesize = ceil(file->fsize / BLOCK_SIZE) * BLOCK_SIZE;
+       uint64_t filesize = ceil(file->fsize / BLOCK_SIZE) * BLOCK_SIZE;
 
        if ((file->type & S_IFREG) != S_IFREG)
                return true;
index 41ef495f8ffefb3f83018dd36dbe44815612779e..e69c166c842f2da1d5d63a432e4c297c7076dfea 100644 (file)
@@ -85,7 +85,7 @@ void print_human_read_size(const char *output, medium_t* medium)
        if (i > sizeof(einheit)/sizeof(einheit[0]))
                i = 0;
 
-       fprintf(stdout, "free space on %s: %lld bytes (%ld %c)\n", output,
+       fprintf(stdout, "free space on %s: %ld bytes (%ld %c)\n", output,
                        medium->freespace, humanread, einheit[i]);
 }