remove compiling warning in dfs_efsl

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@38 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2009-09-06 11:06:26 +00:00
parent b9290bcef4
commit 5931c6d00f
6 changed files with 48 additions and 56 deletions

View File

@ -12,11 +12,14 @@
* 2008-08-16 Yi.Qiu The first version. * 2008-08-16 Yi.Qiu The first version.
*/ */
#include <string.h>
#include "efs.h" #include "efs.h"
#include "dfs_cache.h"
#include "ls.h" #include "ls.h"
#include "ui.h" #include "ui.h"
#include "fat.h" #include "fat.h"
#include <string.h>
#define EFS_MAX 2 #define EFS_MAX 2

View File

@ -217,13 +217,8 @@ euint32 dir_findinBuf(euint8 *buf, eint8 *fatname, FileLocation *loc, euint8 mo
switch(mode){ switch(mode){
case DIRFIND_FILE: case DIRFIND_FILE:
return(dir_findFileinBuf(buf,fatname,loc)); return(dir_findFileinBuf(buf,fatname,loc));
break;
case DIRFIND_FREE: case DIRFIND_FREE:
return(dir_findFreeEntryinBuf(buf,loc)); return(dir_findFreeEntryinBuf(buf,loc));
break;
default:
return(0);
break;
} }
return(0); return(0);
} }
@ -275,9 +270,8 @@ euint32 dir_findinDir(FileSystem *fs, eint8* fatname,euint32 firstcluster, FileL
} }
while(!fat_LogicToDiscCluster(fs,&Cache,c++)){ while(!fat_LogicToDiscCluster(fs,&Cache,c++)){
if((cluster=dir_findinCluster(fs,Cache.DiscCluster,fatname,loc,mode))){ cluster=dir_findinCluster(fs,Cache.DiscCluster,fatname,loc,mode);
return(cluster); if(cluster) return(cluster);
}
} }
return(0); return(0);
} }
@ -297,7 +291,8 @@ euint32 dir_findinRootArea(FileSystem *fs,eint8* fatname, FileLocation *loc, eui
for(c=fs->FirstSectorRootDir;c<(fs->FirstSectorRootDir+fs->volumeId.RootEntryCount/32);c++){ for(c=fs->FirstSectorRootDir;c<(fs->FirstSectorRootDir+fs->volumeId.RootEntryCount/32);c++){
buf = part_getSect(fs->part,c,IOM_MODE_READONLY); buf = part_getSect(fs->part,c,IOM_MODE_READONLY);
if((fclus=dir_findinBuf(buf,fatname,loc,mode))){ fclus=dir_findinBuf(buf,fatname,loc,mode);
if(fclus){
if(loc)loc->Sector=c; if(loc)loc->Sector=c;
part_relSect(fs->part,buf); part_relSect(fs->part,buf);
return(fclus); return(fclus);
@ -323,9 +318,12 @@ esint8 dir_getFatFileName(eint8* filename, eint8* fatfilename)
if(*filename=='/')next++; if(*filename=='/')next++;
while((next=file_normalToFatName(next,ffnamec))){ next=file_normalToFatName(next,ffnamec);
while(next){
memCpy(ffnamec,fatfilename,11); memCpy(ffnamec,fatfilename,11);
nn++; nn++;
next=file_normalToFatName(next,ffnamec);
} }
if(nn)return(1); if(nn)return(1);
return(0); return(0);

View File

@ -51,26 +51,21 @@ euint32 fat_getSectorAddressFatEntry(FileSystem *fs,euint32 cluster_addr)
res=(cluster_addr*3/1024); res=(cluster_addr*3/1024);
if(res>=fs->FatSectorCount){ if(res>=fs->FatSectorCount){
return(0); return(0);
}else{
return(base+res);
} }
break; return(base+res);
case FAT16: case FAT16:
res=cluster_addr/256; res=cluster_addr/256;
if(res>=fs->FatSectorCount){ if(res>=fs->FatSectorCount){
return(0); return(0);
}else{
return(base+res);
} }
break; return(base+res);
case FAT32: case FAT32:
res=cluster_addr/128; res=cluster_addr/128;
if(res>=fs->FatSectorCount){ if(res>=fs->FatSectorCount){
return(0); return(0);
}else{
return(base+res);
} }
break; return(base+res);
} }
return(0); return(0);
} }
@ -241,13 +236,10 @@ euint32 fat_giveEocMarker(FileSystem *fs)
{ {
case FAT12: case FAT12:
return(0xFFF); return(0xFFF);
break;
case FAT16: case FAT16:
return(0xFFFF); return(0xFFFF);
break;
case FAT32: case FAT32:
return(0x0FFFFFFF); return(0x0FFFFFFF);
break;
} }
return(0); return(0);
} }

View File

@ -30,6 +30,7 @@
#endif #endif
/* Device error codes */ /* Device error codes */
#define DFS_STATUS_OK 0 /* no error */
#define DFS_STATUS_ENOENT 2 /* No such file or directory */ #define DFS_STATUS_ENOENT 2 /* No such file or directory */
#define DFS_STATUS_EIO 5 /* I/O error */ #define DFS_STATUS_EIO 5 /* I/O error */
#define DFS_STATUS_ENXIO 6 /* No such device or address */ #define DFS_STATUS_ENXIO 6 /* No such device or address */

View File

@ -513,7 +513,7 @@ int chdir(const char *path)
{ {
char* fullpath, full_path[DFS_PATH_MAX + 1]; char* fullpath, full_path[DFS_PATH_MAX + 1];
if(path == RT_NULL || strlen(path) > DFS_PATH_MAX) if(path == RT_NULL || rt_strlen(path) > DFS_PATH_MAX)
return -1; return -1;
fullpath = (char*)path; fullpath = (char*)path;

View File

@ -262,8 +262,6 @@ char *strrchr(const char *t, int c)
if ((*t == ch)) l=t; if ((*t == ch)) l=t;
if ((!*t)) return (char*)l; ++t; if ((!*t)) return (char*)l; ++t;
} }
return (char*)l;
} }
#endif #endif