firmware: limit number of files per directory

This commit is contained in:
Maximilian Rehkopf 2012-06-11 01:56:09 +02:00
parent 9c84f01fd5
commit 723bf9eb95
2 changed files with 6 additions and 1 deletions

View File

@ -68,6 +68,9 @@
#define QSORT_MAXELEM 2048
#define CLTBL_SIZE 100
#define DIR_FILE_MAX 16380
#define SSP_REGS LPC_SSP0
#define SSP_PCLKREG PCLKSEL1
// 1: PCLKSEL0

View File

@ -76,6 +76,7 @@ uint32_t scan_dir(char* path, FILINFO* fno_param, char mkdb, uint32_t this_dir_t
char *size_units[3] = {" ", "k", "M"};
uint32_t entry_fsize;
uint8_t entry_unit_idx;
uint16_t entrycnt;
dir_tgt = this_dir_tgt;
if(depth==0) {
@ -130,7 +131,8 @@ uint32_t scan_dir(char* path, FILINFO* fno_param, char mkdb, uint32_t this_dir_t
dir_tgt += 4;
}
len = strlen((char*)path);
for (;;) {
/* scan at most DIR_FILE_MAX entries per directory */
for(entrycnt=0; entrycnt < DIR_FILE_MAX; entrycnt++) {
// toggle_read_led();
res = f_readdir(&dir, &fno);
if (res != FR_OK || fno.fname[0] == 0) {