Whitespace cleanup in list_files to save one level of indentation

This commit is contained in:
riccardom 2008-11-15 23:11:21 +00:00
parent 4a3c15d11a
commit 604b8f466e
1 changed files with 23 additions and 28 deletions

View File

@ -249,11 +249,11 @@ static void add_file(char *fname, FsEntry * entry, int fileLevel) {
/* List all files and subdirectories recursively */
static void list_files(const char *filepath) {
void * hFind;
FsEntry entry;
char DirSpec[255+1], SubDir[255+1];
u32 dwError;
FsEntry entry;
void * hFind;
char *fname;
u32 dwError;
int fileLevel;
maxLevel++;
@ -263,10 +263,9 @@ static void list_files(const char *filepath) {
DirSpec[255] = 0 ; /* hard limit the string here */
hFind = FsReadFirst(DirSpec, &entry);
if (hFind == NULL) {
if (hFind == NULL)
return;
} else {
fname = (strlen(entry.cAlternateFileName)>0) ? entry.cAlternateFileName : entry.cFileName;
add_file(fname, &entry, fileLevel);
@ -274,11 +273,11 @@ static void list_files(const char *filepath) {
fname = (strlen(entry.cAlternateFileName)>0) ? entry.cAlternateFileName : entry.cFileName;
add_file(fname, &entry, fileLevel);
if (numFiles==MAXFILES-1) break;
if (numFiles==MAXFILES-1)
break;
if ((entry.flags & FS_IS_DIR) && (strcmp(fname, ".")) && (strcmp(fname, ".."))) {
if (strlen(fname)+strlen(filepath)+2 < 256)
{
if (strlen(fname)+strlen(filepath)+2 < 256) {
sprintf(SubDir, "%s%c%s", filepath, FS_SEPARATOR, fname);
list_files(SubDir);
}
@ -287,10 +286,9 @@ static void list_files(const char *filepath) {
dwError = FsError();
FsClose(hFind);
if (dwError != FS_ERR_NO_MORE_FILES) {
if (dwError != FS_ERR_NO_MORE_FILES)
return;
}
}
if (numFiles < MAXFILES) {
fileLink[numFiles].parent = fileLevel;
files[numFiles++].name[0] = 0;
@ -299,9 +297,6 @@ static void list_files(const char *filepath) {
/* Set up the MBR, FAT and DIR_ENTs */
static BOOL cflash_build_fat( void) {
int i,j,k,l,