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