Apply loop shorthand macros (#17159)
This commit is contained in:
@@ -204,7 +204,7 @@ bool SdBaseFile::dirEntry(dir_t* dir) {
|
||||
*/
|
||||
void SdBaseFile::dirName(const dir_t& dir, char* name) {
|
||||
uint8_t j = 0;
|
||||
for (uint8_t i = 0; i < 11; i++) {
|
||||
LOOP_L_N(i, 11) {
|
||||
if (dir.name[i] == ' ')continue;
|
||||
if (i == 8) name[j++] = '.';
|
||||
name[j++] = dir.name[i];
|
||||
@@ -345,10 +345,10 @@ int8_t SdBaseFile::lsPrintNext(uint8_t flags, uint8_t indent) {
|
||||
&& DIR_IS_FILE_OR_SUBDIR(&dir)) break;
|
||||
}
|
||||
// indent for dir level
|
||||
for (uint8_t i = 0; i < indent; i++) SERIAL_CHAR(' ');
|
||||
LOOP_L_N(i, indent) SERIAL_CHAR(' ');
|
||||
|
||||
// print name
|
||||
for (uint8_t i = 0; i < 11; i++) {
|
||||
LOOP_L_N(i, 11) {
|
||||
if (dir.name[i] == ' ')continue;
|
||||
if (i == 8) {
|
||||
SERIAL_CHAR('.');
|
||||
@@ -478,7 +478,7 @@ bool SdBaseFile::mkdir(SdBaseFile* parent, const uint8_t dname[11]) {
|
||||
// make entry for '.'
|
||||
memcpy(&d, p, sizeof(d));
|
||||
d.name[0] = '.';
|
||||
for (uint8_t i = 1; i < 11; i++) d.name[i] = ' ';
|
||||
LOOP_S_L_N(i, 1, 11) d.name[i] = ' ';
|
||||
|
||||
// cache block for '.' and '..'
|
||||
block = vol_->clusterStartBlock(firstCluster_);
|
||||
@@ -1088,7 +1088,7 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
|
||||
if (WITHIN(seq, 1, MAX_VFAT_ENTRIES)) {
|
||||
// TODO: Store the filename checksum to verify if a long-filename-unaware system modified the file table.
|
||||
n = (seq - 1) * (FILENAME_LENGTH);
|
||||
for (uint8_t i = 0; i < FILENAME_LENGTH; i++)
|
||||
LOOP_L_N(i, FILENAME_LENGTH)
|
||||
longFilename[n + i] = (i < 5) ? VFAT->name1[i] : (i < 11) ? VFAT->name2[i - 5] : VFAT->name3[i - 11];
|
||||
// If this VFAT entry is the last one, add a NUL terminator at the end of the string
|
||||
if (VFAT->sequenceNumber & 0x40) longFilename[n + FILENAME_LENGTH] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user