Fixing compiler warnings related to the mismatch of types "char *" / "unsigned
char *". These warnings appear when you compile the project with the option "-Wall", what is done with the current default Makefile. Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This commit is contained in:
parent
4a8f8a6645
commit
0390c4c1c1
@ -89,7 +89,7 @@ static void dump_boot(DOS_FS * fs, struct boot_sector *b, unsigned lss)
|
||||
printf("Boot sector contents:\n");
|
||||
if (!atari_format) {
|
||||
char id[9];
|
||||
strncpy(id, b->system_id, 8);
|
||||
strncpy(id, (const char*)b->system_id, 8);
|
||||
id[8] = 0;
|
||||
printf("System ID \"%s\"\n", id);
|
||||
} else {
|
||||
|
||||
49
src/check.c
49
src/check.c
@ -139,7 +139,7 @@ loff_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern)
|
||||
while (clu_num > 0 && clu_num != -1) {
|
||||
fs_read(offset2, sizeof(DIR_ENT), &d2);
|
||||
if (offset2 != offset &&
|
||||
!strncmp(d2.name, de->name, MSDOS_NAME))
|
||||
!strncmp((const char*)d2.name, (const char*)de->name, MSDOS_NAME))
|
||||
break;
|
||||
i += sizeof(DIR_ENT);
|
||||
offset2 += sizeof(DIR_ENT);
|
||||
@ -173,10 +173,10 @@ loff_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern)
|
||||
offset = fs->root_start + next_free * sizeof(DIR_ENT);
|
||||
memset(de, 0, sizeof(DIR_ENT));
|
||||
while (1) {
|
||||
sprintf(de->name, pattern, curr_num);
|
||||
sprintf((char*)de->name, pattern, curr_num);
|
||||
for (scan = 0; scan < fs->root_entries; scan++)
|
||||
if (scan != next_free &&
|
||||
!strncmp(root[scan].name, de->name, MSDOS_NAME))
|
||||
!strncmp((const char*)root[scan].name, (const char*)de->name, MSDOS_NAME))
|
||||
break;
|
||||
if (scan == fs->root_entries)
|
||||
break;
|
||||
@ -262,8 +262,8 @@ static int bad_name(DOS_FILE * file)
|
||||
|
||||
/* Do not complain about (and auto-correct) the extended attribute files
|
||||
* of OS/2. */
|
||||
if (strncmp(name, "EA DATA SF", 11) == 0 ||
|
||||
strncmp(name, "WP ROOT SF", 11) == 0)
|
||||
if (strncmp((const char*)name, "EA DATA SF", 11) == 0 ||
|
||||
strncmp((const char*)name, "WP ROOT SF", 11) == 0)
|
||||
return 0;
|
||||
|
||||
/* don't complain about the dummy 11 bytes used by patched Linux
|
||||
@ -322,7 +322,6 @@ static int bad_name(DOS_FILE * file)
|
||||
|
||||
static void lfn_remove(loff_t from, loff_t to)
|
||||
{
|
||||
int i;
|
||||
DIR_ENT empty;
|
||||
|
||||
/* New dir entry is zeroed except first byte, which is set to 0xe5.
|
||||
@ -387,13 +386,13 @@ static void auto_rename(DOS_FILE * file)
|
||||
memcpy(file->dir_ent.ext, num + 4, 3);
|
||||
for (walk = first; walk; walk = walk->next)
|
||||
if (walk != file
|
||||
&& !strncmp(walk->dir_ent.name, file->dir_ent.name, MSDOS_NAME))
|
||||
&& !strncmp((const char*)walk->dir_ent.name, (const char*)file->dir_ent.name, MSDOS_NAME))
|
||||
break;
|
||||
if (!walk) {
|
||||
fs_write(file->offset, MSDOS_NAME, file->dir_ent.name);
|
||||
if (file->lfn)
|
||||
lfn_fix_checksum(file->lfn_offset, file->offset,
|
||||
file->dir_ent.name);
|
||||
(const char*)file->dir_ent.name);
|
||||
return;
|
||||
}
|
||||
number++;
|
||||
@ -416,10 +415,10 @@ static void rename_file(DOS_FILE * file)
|
||||
while (1) {
|
||||
printf("New name: ");
|
||||
fflush(stdout);
|
||||
if (fgets(name, 45, stdin)) {
|
||||
if ((here = strchr(name, '\n')))
|
||||
if (fgets((char*)name, 45, stdin)) {
|
||||
if ((here = (unsigned char*)strchr((const char*)name, '\n')))
|
||||
*here = 0;
|
||||
for (walk = strrchr(name, 0); walk >= name && (*walk == ' ' ||
|
||||
for (walk = (unsigned char*)strrchr((const char*)name, 0); walk >= name && (*walk == ' ' ||
|
||||
*walk == '\t');
|
||||
walk--) ;
|
||||
walk[1] = 0;
|
||||
@ -428,7 +427,7 @@ static void rename_file(DOS_FILE * file)
|
||||
fs_write(file->offset, MSDOS_NAME, file->dir_ent.name);
|
||||
if (file->lfn)
|
||||
lfn_fix_checksum(file->lfn_offset, file->offset,
|
||||
file->dir_ent.name);
|
||||
(const char*)file->dir_ent.name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -439,7 +438,7 @@ static int handle_dot(DOS_FS * fs, DOS_FILE * file, int dots)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = strncmp(file->dir_ent.name, MSDOS_DOT, MSDOS_NAME) ? ".." : ".";
|
||||
name = strncmp((const char*)file->dir_ent.name, MSDOS_DOT, MSDOS_NAME) ? ".." : ".";
|
||||
if (!(file->dir_ent.attr & ATTR_DIR)) {
|
||||
printf("%s\n Is a non-directory.\n", path_name(file));
|
||||
if (interactive)
|
||||
@ -484,7 +483,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file)
|
||||
path_name(file));
|
||||
MODIFY(file, size, CT_LE_L(0));
|
||||
}
|
||||
if (file->parent && !strncmp(file->dir_ent.name, MSDOS_DOT, MSDOS_NAME)) {
|
||||
if (file->parent && !strncmp((const char*)file->dir_ent.name, MSDOS_DOT, MSDOS_NAME)) {
|
||||
expect = FSTART(file->parent, fs);
|
||||
if (FSTART(file, fs) != expect) {
|
||||
printf("%s\n Start (%ld) does not point to parent (%ld)\n",
|
||||
@ -493,7 +492,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (file->parent && !strncmp(file->dir_ent.name, MSDOS_DOTDOT,
|
||||
if (file->parent && !strncmp((const char*)file->dir_ent.name, MSDOS_DOTDOT,
|
||||
MSDOS_NAME)) {
|
||||
expect =
|
||||
file->parent->parent ? FSTART(file->parent->parent, fs) : 0;
|
||||
@ -678,13 +677,13 @@ static int check_dir(DOS_FS * fs, DOS_FILE ** root, int dots)
|
||||
dot = dotdot = redo = 0;
|
||||
walk = root;
|
||||
while (*walk) {
|
||||
if (!strncmp((*walk)->dir_ent.name, MSDOS_DOT, MSDOS_NAME) ||
|
||||
!strncmp((*walk)->dir_ent.name, MSDOS_DOTDOT, MSDOS_NAME)) {
|
||||
if (!strncmp((const char*)((*walk)->dir_ent.name), MSDOS_DOT, MSDOS_NAME) ||
|
||||
!strncmp((const char*)((*walk)->dir_ent.name), MSDOS_DOTDOT, MSDOS_NAME)) {
|
||||
if (handle_dot(fs, *walk, dots)) {
|
||||
*walk = (*walk)->next;
|
||||
continue;
|
||||
}
|
||||
if (!strncmp((*walk)->dir_ent.name, MSDOS_DOT, MSDOS_NAME))
|
||||
if (!strncmp((const char*)((*walk)->dir_ent.name), MSDOS_DOT, MSDOS_NAME))
|
||||
dot++;
|
||||
else
|
||||
dotdot++;
|
||||
@ -921,10 +920,10 @@ static void add_file(DOS_FS * fs, DOS_FILE *** chain, DOS_FILE * parent,
|
||||
de.start = CT_LE_W(fs->root_cluster & 0xffff);
|
||||
de.starthi = CT_LE_W((fs->root_cluster >> 16) & 0xffff);
|
||||
}
|
||||
if ((type = file_type(cp, de.name)) != fdt_none) {
|
||||
if ((type = file_type(cp, (char*)de.name)) != fdt_none) {
|
||||
if (type == fdt_undelete && (de.attr & ATTR_DIR))
|
||||
die("Can't undelete directories.");
|
||||
file_modify(cp, de.name);
|
||||
file_modify(cp, (char*)de.name);
|
||||
fs_write(offset, 1, &de);
|
||||
}
|
||||
if (IS_FREE(de.name)) {
|
||||
@ -953,8 +952,8 @@ static void add_file(DOS_FS * fs, DOS_FILE *** chain, DOS_FILE * parent,
|
||||
}
|
||||
/* Don't include root directory, '.', or '..' in the total file count */
|
||||
if (offset &&
|
||||
strncmp(de.name, MSDOS_DOT, MSDOS_NAME) != 0 &&
|
||||
strncmp(de.name, MSDOS_DOTDOT, MSDOS_NAME) != 0)
|
||||
strncmp((const char*)de.name, MSDOS_DOT, MSDOS_NAME) != 0 &&
|
||||
strncmp((const char*)de.name, MSDOS_DOTDOT, MSDOS_NAME) != 0)
|
||||
++n_files;
|
||||
test_file(fs, new, test); /* Bad cluster check */
|
||||
}
|
||||
@ -1003,9 +1002,9 @@ static int subdirs(DOS_FS * fs, DOS_FILE * parent, FDSC ** cp)
|
||||
|
||||
for (walk = parent ? parent->first : root; walk; walk = walk->next)
|
||||
if (walk->dir_ent.attr & ATTR_DIR)
|
||||
if (strncmp(walk->dir_ent.name, MSDOS_DOT, MSDOS_NAME) &&
|
||||
strncmp(walk->dir_ent.name, MSDOS_DOTDOT, MSDOS_NAME))
|
||||
if (scan_dir(fs, walk, file_cd(cp, walk->dir_ent.name)))
|
||||
if (strncmp((const char*)walk->dir_ent.name, MSDOS_DOT, MSDOS_NAME) &&
|
||||
strncmp((const char*)walk->dir_ent.name, MSDOS_DOTDOT, MSDOS_NAME))
|
||||
if (scan_dir(fs, walk, file_cd(cp, (char*)walk->dir_ent.name)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
10
src/file.c
10
src/file.c
@ -75,7 +75,7 @@ char *file_name(unsigned char *fixed)
|
||||
*p++ = ' ';
|
||||
put_char(&p, fixed[i]);
|
||||
}
|
||||
if (strncmp(fixed + 8, " ", 3)) {
|
||||
if (strncmp((const char*)(fixed + 8), " ", 3)) {
|
||||
*p++ = '.';
|
||||
for (i = j = 0; i < 3; i++)
|
||||
if (fixed[i + 8] != ' ') {
|
||||
@ -162,7 +162,7 @@ void file_add(char *path, FD_TYPE type)
|
||||
while (1) {
|
||||
if ((here = strchr(path, '/')))
|
||||
*here = 0;
|
||||
if (!file_cvt(path, name))
|
||||
if (!file_cvt((unsigned char*)path, (unsigned char*)name))
|
||||
exit(2);
|
||||
for (walk = *current; walk; walk = walk->next)
|
||||
if (!here && (!strncmp(name, walk->name, MSDOS_NAME) || (type ==
|
||||
@ -245,12 +245,12 @@ void file_modify(FDSC ** curr, char *fixed)
|
||||
die("Internal error: file_find failed");
|
||||
switch ((*this)->type) {
|
||||
case fdt_drop:
|
||||
printf("Dropping %s\n", file_name(fixed));
|
||||
printf("Dropping %s\n", file_name((unsigned char*)fixed));
|
||||
*(unsigned char *)fixed = DELETED_FLAG;
|
||||
break;
|
||||
case fdt_undelete:
|
||||
*fixed = *(*this)->name;
|
||||
printf("Undeleting %s\n", file_name(fixed));
|
||||
printf("Undeleting %s\n", file_name((unsigned char*)fixed));
|
||||
break;
|
||||
default:
|
||||
die("Internal error: file_modify");
|
||||
@ -270,7 +270,7 @@ static void report_unused(FDSC * this)
|
||||
report_unused(this->first);
|
||||
else if (this->type != fdt_none)
|
||||
printf("Warning: did not %s file %s\n", this->type == fdt_drop ?
|
||||
"drop" : "undelete", file_name(this->name));
|
||||
"drop" : "undelete", file_name((unsigned char*)this->name));
|
||||
free(this);
|
||||
this = next;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ static unsigned char fat_uni2esc[64] = {
|
||||
/* Convert name part in 'lfn' from unicode to ASCII */
|
||||
#define CNV_THIS_PART(lfn) \
|
||||
({ \
|
||||
char __part_uni[CHARS_PER_LFN*2]; \
|
||||
unsigned char __part_uni[CHARS_PER_LFN*2]; \
|
||||
copy_lfn_part( __part_uni, lfn ); \
|
||||
cnv_unicode( __part_uni, CHARS_PER_LFN, 0 ); \
|
||||
})
|
||||
@ -120,10 +120,10 @@ static char *cnv_unicode(const unsigned char *uni, int maxlen, int use_q)
|
||||
}
|
||||
*cp = 0;
|
||||
|
||||
return (out);
|
||||
return (char*)out;
|
||||
}
|
||||
|
||||
static void copy_lfn_part(char *dst, LFN_ENT * lfn)
|
||||
static void copy_lfn_part(unsigned char *dst, LFN_ENT *lfn)
|
||||
{
|
||||
memcpy(dst, lfn->name0_4, 10);
|
||||
memcpy(dst + 10, lfn->name5_10, 12);
|
||||
|
||||
@ -760,7 +760,7 @@ static void setup_tables(void)
|
||||
* :-), then 6 bytes filler (ignored), then 3 byte serial number. */
|
||||
memcpy(bs.system_id - 1, "mkdosf", 6);
|
||||
else
|
||||
strcpy(bs.system_id, "mkdosfs");
|
||||
strcpy((char*)bs.system_id, "mkdosfs");
|
||||
if (sectors_per_cluster)
|
||||
bs.cluster_size = (char)sectors_per_cluster;
|
||||
if (size_fat == 32) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user