diff --git a/c-programming/reverse-ramdisk.c b/c-programming/reverse-ramdisk.c index c3fd48d..3756ae9 100644 --- a/c-programming/reverse-ramdisk.c +++ b/c-programming/reverse-ramdisk.c @@ -17,6 +17,7 @@ To-Do: error handling on line 167, function fread() #include #include #include +#include typedef struct { int ID; @@ -45,12 +46,12 @@ int tf_alloc(size_t n, size_t type_size) { size_t file_path_len = len_digit + strlen("tf_.tmp"); char* file_path = malloc((file_path_len + 1) * sizeof(char)); if (file_path == NULL) { - fail_line(-2); + line_fail(-2); return -1; } int res = snprintf(file_path, file_path_len, "tf_%zu.tmp", num_temp_files); if ((size_t) res != file_path_len) { - fail_line(-2); + line_fail(-2); return -1; } @@ -157,7 +158,7 @@ int tf_read(int ID, size_t offset, void* dest, size_t data_size) { void* data = malloc(data_size); if (data == NULL) { fclose(file); - fail_line(-3); + line_fail(-3); return -1; } @@ -178,7 +179,7 @@ int tf_read(int ID, size_t offset, void* dest, size_t data_size) { printf("Read: ID = %d, data = %016" PRIXPTR ", size = %zu -> '", ID, (uintptr_t)dest, data_size); for (size_t i = 0; i < data_size; i++) - printf("0x%02" PRIX8 " ", *((uint8_t*)(dest + i))); + printf("0x%02" PRIX8 " ", *((uint8_t*)((uint8_t*)dest + i))); printf("'\n"); #endif return 0;