Skip to content

Commit 1411b6b

Browse files
committed
cleanup
1 parent a94cf20 commit 1411b6b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Marlin/src/sd/SdBaseFile.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,7 @@ bool SdBaseFile::openNext(SdBaseFile *dirFile, uint8_t oflag) {
10131013
* \return false if the dirname is a short file name 8.3 (SFN)
10141014
*/
10151015
bool SdBaseFile::isDirNameLFN(const char *dirname) {
1016-
uint8_t length = strlen(dirname);
1017-
uint8_t idx = length;
1016+
uint8_t length = strlen(dirname), idx = length;
10181017
bool dotFound = false;
10191018
if (idx > 12) return true; // LFN due to filename length > 12 ("filename.ext")
10201019
// Check dot(s) position
@@ -1517,22 +1516,22 @@ int8_t SdBaseFile::readDir(dir_t *dir, char *longFilename) {
15171516
if (longFilename) {
15181517
// Reset n to the start of the long name
15191518
n = 0;
1520-
for (uint16_t idx = 0; idx < (LONG_FILENAME_LENGTH); idx += 2) { // idx is fixed since FAT LFN always contains UTF-16LE encoding
1519+
for (uint16_t idx = 0; idx < LONG_FILENAME_LENGTH; idx += 2) { // idx is fixed since FAT LFN always contains UTF-16LE encoding
15211520
const uint16_t utf16_ch = longFilename[idx] | (longFilename[idx + 1] << 8);
1522-
if (0xD800 == (utf16_ch & 0xF800)) // Surrogate pair - encode as '_'
1521+
if (0xD800 == (utf16_ch & 0xF800)) // Surrogate pair - encode as '_'
15231522
longFilename[n++] = '_';
1524-
else if (0 == (utf16_ch & 0xFF80)) // Encode as 1-byte UTF-8 char
1523+
else if (0 == (utf16_ch & 0xFF80)) // Encode as 1-byte UTF-8 char
15251524
longFilename[n++] = utf16_ch & 0x007F;
1526-
else if (0 == (utf16_ch & 0xF800)) { // Encode as 2-byte UTF-8 char
1525+
else if (0 == (utf16_ch & 0xF800)) { // Encode as 2-byte UTF-8 char
15271526
longFilename[n++] = 0xC0 | ((utf16_ch >> 6) & 0x1F);
15281527
longFilename[n++] = 0x80 | ( utf16_ch & 0x3F);
15291528
}
15301529
else {
1531-
#if LONG_FILENAME_CHARSIZE > 2 // Encode as 3-byte UTF-8 char
1530+
#if LONG_FILENAME_CHARSIZE > 2 // Encode as 3-byte UTF-8 char
15321531
longFilename[n++] = 0xE0 | ((utf16_ch >> 12) & 0x0F);
15331532
longFilename[n++] = 0xC0 | ((utf16_ch >> 6) & 0x3F);
15341533
longFilename[n++] = 0xC0 | ( utf16_ch & 0x3F);
1535-
#else // Encode as '_'
1534+
#else // Encode as '_'
15361535
longFilename[n++] = '_';
15371536
#endif
15381537
}

0 commit comments

Comments
 (0)