updated chan_fatfs
Fork of chan_fatfs by
Diff: ff.cpp
- Revision:
- 3:68eaafe726ac
- Parent:
- 2:e8cd708f09ff
--- a/ff.cpp Tue Dec 11 21:46:00 2012 +0000 +++ b/ff.cpp Tue Dec 11 23:02:31 2012 +0000 @@ -210,7 +210,7 @@ #if _FS_REENTRANT static -BOOL lock_fs ( +bool lock_fs ( FATFS *fs /* File system object */ ) { @@ -592,7 +592,7 @@ static FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not streach */ eDIR *dj, /* Pointer to directory object */ - BOOL streach /* FALSE: Do not streach table, TRUE: Streach table if needed */ + bool streach /* FALSE: Do not streach table, TRUE: Streach table if needed */ ) { DWORD clst; @@ -661,7 +661,7 @@ static -BOOL cmp_lfn ( /* TRUE:Matched, FALSE:Not matched */ +bool cmp_lfn ( /* TRUE:Matched, FALSE:Not matched */ WCHAR *lfnbuf, /* Pointer to the LFN to be compared */ BYTE *dir /* Pointer to the directory entry containing a part of LFN */ ) @@ -677,22 +677,22 @@ if (wc) { /* Last char has not been processed */ wc = ff_wtoupper(uc); /* Convert it to upper case */ if (i >= _MAX_LFN || wc != ff_wtoupper(lfnbuf[i++])) /* Compare it */ - return FALSE; /* Not matched */ + return false; /* Not matched */ } else { - if (uc != 0xFFFF) return FALSE; /* Check filler */ + if (uc != 0xFFFF) return false; /* Check filler */ } } while (++s < 13); /* Repeat until all chars in the entry are checked */ if ((dir[LDIR_Ord] & 0x40) && wc && lfnbuf[i]) /* Last segment matched but different length */ - return FALSE; - - return TRUE; /* The part of LFN matched */ + return false; + + return true; /* The part of LFN matched */ } static -BOOL pick_lfn ( /* TRUE:Succeeded, FALSE:Buffer overflow */ +bool pick_lfn ( /* TRUE:Succeeded, FALSE:Buffer overflow */ WCHAR *lfnbuf, /* Pointer to the Unicode-LFN buffer */ BYTE *dir /* Pointer to the directory entry */ ) @@ -707,19 +707,19 @@ do { uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */ if (wc) { /* Last char has not been processed */ - if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */ + if (i >= _MAX_LFN) return false; /* Buffer overflow? */ lfnbuf[i++] = wc = uc; /* Store it */ } else { - if (uc != 0xFFFF) return FALSE; /* Check filler */ + if (uc != 0xFFFF) return false; /* Check filler */ } } while (++s < 13); /* Read all character in the entry */ if (dir[LDIR_Ord] & 0x40) { /* Put terminator if it is the last LFN part */ - if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */ + if (i >= _MAX_LFN) return false; /* Buffer overflow? */ lfnbuf[i] = 0; } - return TRUE; + return true; } @@ -874,7 +874,7 @@ if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */ break; #endif - res = dir_next(dj, FALSE); /* Next entry */ + res = dir_next(dj, false); /* Next entry */ } while (res == FR_OK); return res; @@ -928,7 +928,7 @@ if (c != 0xE5 && (_FS_RPATH || c != '.') && !(dir[DIR_Attr] & AM_VOL)) /* Is it a valid entry? */ break; #endif - res = dir_next(dj, FALSE); /* Next entry */ + res = dir_next(dj, false); /* Next entry */ if (res != FR_OK) break; } @@ -995,7 +995,7 @@ } else { n = 0; /* Not a blank entry. Restart to search */ } - res = dir_next(dj, TRUE); /* Next entry with table streach */ + res = dir_next(dj, true); /* Next entry with table streach */ } while (res == FR_OK); if (res == FR_OK && ne > 1) { /* Initialize LFN entry if needed */ @@ -1008,7 +1008,7 @@ if (res != FR_OK) break; fit_lfn(dj->lfn, dj->dir, (BYTE)ne, sum); dj->fs->wflag = 1; - res = dir_next(dj, FALSE); /* Next entry */ + res = dir_next(dj, false); /* Next entry */ } while (res == FR_OK && --ne); } } @@ -1021,7 +1021,7 @@ if (res != FR_OK) break; c = *dj->dir; if (c == 0xE5 || c == 0) break; /* Is it a blank entry? */ - res = dir_next(dj, TRUE); /* Next entry with table streach */ + res = dir_next(dj, true); /* Next entry with table streach */ } while (res == FR_OK); } #endif @@ -1066,7 +1066,7 @@ *dj->dir = 0xE5; /* Mark the entry "deleted" */ dj->fs->wflag = 1; if (dj->index >= i) break; /* When reached SFN, all entries of the object has been deleted. */ - res = dir_next(dj, FALSE); /* Next entry */ + res = dir_next(dj, false); /* Next entry */ } while (res == FR_OK); if (res == FR_NO_FILE) res = FR_INT_ERR; } @@ -2261,7 +2261,7 @@ } if (res == FR_OK) { /* A valid entry is found */ get_fileinfo(dj, fno); /* Get the object information */ - res = dir_next(dj, FALSE); /* Increment index for next */ + res = dir_next(dj, false); /* Increment index for next */ if (res == FR_NO_FILE) { dj->sect = 0; res = FR_OK;