Sorry, at the moment I'm not in the state to provide patches but here are some small things that I want to mention.
Too much zeroes (remove last two) in initializers:
Code: Select all
src/fat.c:591:13: warning: excess elements in struct initializer
0,0,0,0,0
^
src/fat.c:601:13: warning: excess elements in struct initializer
0,0,0,0,0
^
src/fat.c:611:13: warning: excess elements in struct initializer
0,0,0,0,0
^
3 warnings generated.
Sizes of some types are a piece of nightmare:
Code: Select all
bin/generate.c:62:43: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
printf(" Image file created with CHS: %ld %ld %ld\n", im->cylinders, im->heads, im->sectors);
~~^ ~~~~~~~~~~~~~
%zd
bin/generate.c:62:47: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
printf(" Image file created with CHS: %ld %ld %ld\n", im->cylinders, im->heads, im->sectors);
~~^ ~~~~~~~~~
%zd
bin/generate.c:62:51: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
printf(" Image file created with CHS: %ld %ld %ld\n", im->cylinders, im->heads, im->sectors);
~~^ ~~~~~~~~~~~
%zd
I'm still (several years ago I also had similar problem) not sure what to use as a cross-platform printf specifier for size_t. In this example nothing is broken just because `long' is also 32-bit on my system. Btw, isn't uint32_t enough here?
Prototypes for some functions are missing in `fat.h':
Code: Select all
tests/fat_tests.c:15:13: warning: implicit declaration of function 'fat_bits' is invalid in C99 [-Wimplicit-function-declaration]
mu_assert(fat_bits(fs) == 12, "Wrong FAT type (Not 12)");
^
tests/minunit.h:17:39: note: expanded from macro 'mu_assert'
#define mu_assert(test, message) if(!(test)) { log_err(message); return message; }
^
tests/fat_tests.c:24:36: warning: implicit declaration of function 'fat_read_fat' is invalid in C99 [-Wimplicit-function-declaration]
printf(" Fat table value %x\n", fat_read_fat(fs, 0));
^
tests/fat_tests.c:87:3: warning: implicit declaration of function 'fat_write_fat' is invalid in C99 [-Wimplicit-function-declaration]
fat_write_fat(fs, 14, 0x12);
^
tests/fat_tests.c:104:37: warning: implicit declaration of function 'fat_make_shortname' is invalid in C99 [-Wimplicit-function-declaration]
printf("longfilename.txt : %s\n", fat_make_shortname("longfilename.txt"));
^
tests/fat_tests.c:104:31: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
printf("longfilename.txt : %s\n", fat_make_shortname("longfilename.txt"));
~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%d
tests/fat_tests.c:105:29: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
printf("longfilename.c : %s\n", fat_make_shortname("longfilename.c"));
~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%d
tests/fat_tests.c:106:23: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
printf("name.txt : %s\n", fat_make_shortname("name.txt"));
~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%d
tests/fat_tests.c:107:21: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
printf("name.c : %s\n", fat_make_shortname("name.c"));
~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%d
tests/fat_tests.c:115:3: warning: implicit declaration of function 'fat_write_longname' is invalid in C99 [-Wimplicit-function-declaration]
fat_write_longname(de, "File with very long filename.ext");
^
tests/fat_tests.c:116:34: warning: implicit declaration of function 'fat_read_longname' is invalid in C99 [-Wimplicit-function-declaration]
printf(" Filename read: %s\n", fat_read_longname(de));
^
tests/fat_tests.c:116:28: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
printf(" Filename read: %s\n", fat_read_longname(de));
~^ ~~~~~~~~~~~~~~~~~~~~~
%d