- [Stupid] warning fixes.

- Bugfix: CNV_THIS_PART was not returning any value, when in reality it should have returned a pointer to the converted string.

svn path=/trunk/; revision=35082
This commit is contained in:
Aleksey Bragin 2008-08-03 19:09:43 +00:00
parent 663c4cb886
commit 05636664e0
6 changed files with 37 additions and 37 deletions

View file

@ -65,7 +65,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,(char*)b->system_id,8);
id[8] = 0;
printf("System ID \"%s\"\n",id);
}

View file

@ -111,14 +111,14 @@ loff_t alloc_rootdir_entry(DOS_FS *fs, DIR_ENT *de, const char *pattern)
}
memset(de,0,sizeof(DIR_ENT));
while (1) {
sprintf(de->name,pattern,curr_num);
sprintf((char*)de->name,pattern,curr_num);
clu_num = fs->root_cluster;
i = 0;
offset2 = cluster_start(fs,clu_num);
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((char*)d2.name,(char*)de->name,MSDOS_NAME))
break;
i += sizeof(DIR_ENT);
offset2 += sizeof(DIR_ENT);
@ -151,10 +151,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 < (int)fs->root_entries; scan++)
if (scan != next_free &&
!strncmp(root[scan].name,de->name,MSDOS_NAME))
!strncmp((char*)root[scan].name,(char*)de->name,MSDOS_NAME))
break;
if (scan == (int)fs->root_entries) break;
if (++curr_num >= 10000) die("Unable to create unique name");
@ -226,8 +226,8 @@ static int bad_name(unsigned char *name)
/* 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) return 0;
if (strncmp((char*)name,"EA DATA SF",11) == 0 ||
strncmp((char*)name,"WP ROOT SF",11) == 0) return 0;
for (i = 0; i < 8; i++) {
if (name[i] < ' ' || name[i] == 0x7f) return 1;
@ -313,10 +313,10 @@ static void auto_rename(DOS_FILE *file)
first = file->parent ? file->parent->first : root;
number = 0;
while (1) {
sprintf(file->dir_ent.name,"FSCK%04d",number);
strncpy(file->dir_ent.ext,"REN",3);
sprintf((char*)file->dir_ent.name,"FSCK%04d",number);
strncpy((char*)file->dir_ent.ext,"REN",3);
for (walk = first; walk; walk = walk->next)
if (walk != file && !strncmp(walk->dir_ent.name,file->dir_ent.
if (walk != file && !strncmp((char*)walk->dir_ent.name,(char*)file->dir_ent.
name,MSDOS_NAME)) break;
if (!walk) {
fs_write(file->offset,MSDOS_NAME,file->dir_ent.name);
@ -340,9 +340,9 @@ static void rename_file(DOS_FILE *file)
while (1) {
printf("New name: ");
fflush(stdout);
if (fgets(name,45,stdin)) {
if ((here = strchr(name,'\n'))) *here = 0;
for (walk = strrchr(name,0); walk >= name && (*walk == ' ' ||
if (fgets((char*)name,45,stdin)) {
if ((here = (unsigned char*)strchr((char*)name,'\n'))) *here = 0;
for (walk = (unsigned char*)strrchr((char*)name,0); walk >= name && (*walk == ' ' ||
*walk == '\t'); walk--);
walk[1] = 0;
for (walk = name; *walk == ' ' || *walk == '\t'; walk++);
@ -359,7 +359,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((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)
@ -404,7 +404,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((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",
@ -413,7 +413,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((char*)file->dir_ent.name,MSDOS_DOTDOT,
MSDOS_NAME)) {
expect = file->parent->parent ? FSTART(file->parent->parent,fs):0;
if (fs->root_cluster && expect == fs->root_cluster)
@ -569,13 +569,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((char*)(*walk)->dir_ent.name,MSDOS_DOT,MSDOS_NAME) ||
!strncmp((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)) dot++;
if (!strncmp((char*)(*walk)->dir_ent.name,MSDOS_DOT,MSDOS_NAME)) dot++;
else dotdot++;
}
if (!((*walk)->dir_ent.attr & ATTR_VOLUME) &&
@ -609,7 +609,7 @@ static int check_dir(DOS_FS *fs,DOS_FILE **root,int dots)
skip = 0;
while (*scan && !skip) {
if (!((*scan)->dir_ent.attr & ATTR_VOLUME) &&
!strncmp((*walk)->dir_ent.name,(*scan)->dir_ent.name,MSDOS_NAME)) {
!strncmp((char*)(*walk)->dir_ent.name,(char*)(*scan)->dir_ent.name,MSDOS_NAME)) {
printf("%s\n Duplicate directory entry.\n First %s\n",
path_name(*walk),file_stat(*walk));
printf(" Second %s\n",file_stat(*scan));
@ -763,7 +763,7 @@ 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);
@ -793,8 +793,8 @@ static void add_file(DOS_FS *fs,DOS_FILE ***chain,DOS_FILE *parent,
printf("\n");
}
if (offset &&
strncmp(de.name,MSDOS_DOT,MSDOS_NAME) != 0 &&
strncmp(de.name,MSDOS_DOTDOT,MSDOS_NAME) != 0)
strncmp((char*)de.name,MSDOS_DOT,MSDOS_NAME) != 0 &&
strncmp((char*)de.name,MSDOS_DOTDOT,MSDOS_NAME) != 0)
++n_files;
test_file(fs,new,test);
}
@ -834,9 +834,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))) return 1;
if (strncmp((char*)walk->dir_ent.name,MSDOS_DOT,MSDOS_NAME) &&
strncmp((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;
}

View file

@ -17,7 +17,7 @@
#include "check.h"
#include "fat.h"
#pragma warning(disable: 4018)
//#pragma warning(disable: 4018)
static void get_fat(FAT_ENTRY *entry,void *fat,unsigned long cluster,DOS_FS *fs)
{

View file

@ -57,7 +57,7 @@ char *file_name(unsigned char *fixed)
while (j++ < i) *p++ = ' ';
put_char(&p,fixed[i]);
}
if (strncmp(fixed+8," ",3)) {
if (strncmp((char*)fixed+8," ",3)) {
*p++ = '.';
for (i = j = 0; i < 3; i++)
if (fixed[i+8] != ' ') {
@ -138,7 +138,7 @@ void file_add(char *path,FD_TYPE type)
path++;
while (1) {
if ((here = strchr(path,'/'))) *here = 0;
if (!file_cvt(path,name)) exit(2);
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 ==
fdt_undelete && !strncmp(name+1,walk->name+1,MSDOS_NAME-1))))
@ -201,16 +201,16 @@ FD_TYPE file_type(FDSC **curr,char *fixed)
}
void file_modify(FDSC **curr,char *fixed)
void file_modify(FDSC **curr,unsigned char *fixed)
{
FDSC **this,*next;
if (!(this = file_find(curr,fixed)))
if (!(this = file_find(curr,(char *)fixed)))
die("Internal error: file_find failed");
switch ((*this)->type) {
case fdt_drop:
printf("Dropping %s\n",file_name(fixed));
*(unsigned char *) fixed = DELETED_FLAG;
*fixed = DELETED_FLAG;
break;
case fdt_undelete:
*fixed = *(*this)->name;
@ -234,7 +234,7 @@ static void report_unused(FDSC *this)
if (this->first) 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;
}

View file

@ -44,7 +44,7 @@ FD_TYPE file_type(FDSC **curr,char *fixed);
/* Returns the attribute of the file FIXED in directory CURR or FDT_NONE if no
such file exists or if CURR is NULL. */
void file_modify(FDSC **curr,char *fixed);
void file_modify(FDSC **curr,unsigned char *fixed);
/* Performs the necessary operation on the entry of CURR that is named FIXED. */

View file

@ -62,7 +62,7 @@ static __inline char* CNV_THIS_PART(LFN_ENT *lfn)
{ \
char __part_uni[CHARS_PER_LFN*2];
copy_lfn_part( __part_uni, lfn );
cnv_unicode( __part_uni, CHARS_PER_LFN, 0 );
return cnv_unicode( (unsigned char*)__part_uni, CHARS_PER_LFN, 0 );
}
/* Convert name parts collected so far (from previous slots) from unicode to
@ -105,7 +105,7 @@ static char *cnv_unicode( const unsigned char *uni, int maxlen, int use_q )
}
*cp = 0;
return( out );
return (char *)out;
}
@ -322,7 +322,7 @@ void lfn_add_slot( DIR_ENT *de, loff_t dir_offset )
if (lfn_slot != -1) {
lfn_slot--;
offset = lfn_slot * CHARS_PER_LFN*2;
copy_lfn_part( lfn_unicode+offset, lfn );
copy_lfn_part( (char*)lfn_unicode+offset, lfn );
if (lfn->id & LFN_ID_START)
lfn_unicode[offset+26] = lfn_unicode[offset+27] = 0;
lfn_offsets[lfn_parts++] = dir_offset;