Skip to content

Commit bab0061

Browse files
committed
Restructure for RTOS use, getName mods, bug fixes
1 parent fb74151 commit bab0061

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+678
-283
lines changed

doc/html.zip

24.6 KB
Binary file not shown.

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name=SdFat
2-
version=2.1.1
2+
version=2.1.2
33
license=MIT
44
author=Bill Greiman <fat16lib@sbcglobal.net>
55
maintainer=Bill Greiman <fat16lib@sbcglobal.net>
6-
sentence=FAT16/FAT32/exFAT file system.
7-
paragraph=FAT16/FAT32/exFAT file system.
6+
sentence=Provides access to SD memory cards.
7+
paragraph=The SdFat library supports FAT16, FAT32, and exFAT file systems on Standard SD, SDHC, and SDXC cards.
88
category=Data Storage
99
url=https://github.com/greiman/SdFat
1010
repository=https://github.com/greiman/SdFat.git

src/ExFatLib/ExFatConfig.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#define ExFatConfig_h
2727
#include "SdFatConfig.h"
2828

29-
#ifndef READ_ONLY
30-
#define READ_ONLY 0
31-
#endif // READ_ONLY
29+
#ifndef EXFAT_READ_ONLY
30+
#define EXFAT_READ_ONLY 0
31+
#endif // EXFAT_READ_ONLY
3232

3333
#endif // ExFatConfig_h

src/ExFatLib/ExFatFile.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,13 @@ bool ExFatFile::openPrivate(ExFatFile* dir, ExName_t* fname, oflag_t oflag) {
361361
}
362362
// Write, truncate, or at end is an error for a directory or read-only file.
363363
if ((oflag & (O_TRUNC | O_AT_END)) || (m_flags & FILE_FLAG_WRITE)) {
364-
if (isSubDir() || isReadOnly() || READ_ONLY) {
364+
if (isSubDir() || isReadOnly() || EXFAT_READ_ONLY) {
365365
DBG_FAIL_MACRO;
366366
goto fail;
367367
}
368368
}
369369

370-
#if !READ_ONLY
370+
#if !EXFAT_READ_ONLY
371371
if (oflag & O_TRUNC) {
372372
if (!(m_flags & FILE_FLAG_WRITE)) {
373373
DBG_FAIL_MACRO;
@@ -381,14 +381,14 @@ bool ExFatFile::openPrivate(ExFatFile* dir, ExName_t* fname, oflag_t oflag) {
381381
DBG_FAIL_MACRO;
382382
goto fail;
383383
}
384-
#endif // !READ_ONLY
384+
#endif // !EXFAT_READ_ONLY
385385
return true;
386386

387387
create:
388-
#if READ_ONLY
388+
#if EXFAT_READ_ONLY
389389
DBG_FAIL_MACRO;
390390
goto fail;
391-
#else // READ_ONLY
391+
#else // EXFAT_READ_ONLY
392392
// don't create unless O_CREAT and write
393393
if (!(oflag & O_CREAT) || !(modeFlags & FILE_FLAG_WRITE) || !fname) {
394394
DBG_WARN_MACRO;
@@ -471,7 +471,7 @@ bool ExFatFile::openPrivate(ExFatFile* dir, ExName_t* fname, oflag_t oflag) {
471471
}
472472
}
473473
return sync();
474-
#endif // READ_ONLY
474+
#endif // EXFAT_READ_ONLY
475475

476476
fail:
477477
// close file

src/ExFatLib/ExFatFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class ExFatFile {
250250
return isOpen() ? m_error & WRITE_ERROR : true;
251251
}
252252
/**
253-
* Check for BlockDevice busy.
253+
* Check for FsBlockDevice busy.
254254
*
255255
* \return true if busy else false.
256256
*/

src/ExFatLib/ExFatFileWrite.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "../common/DebugMacros.h"
2727
#include "ExFatLib.h"
2828
//==============================================================================
29-
#if READ_ONLY
29+
#if EXFAT_READ_ONLY
3030
bool ExFatFile::mkdir(ExFatFile* parent, const char* path, bool pFlag) {
3131
(void) parent;
3232
(void)path;
@@ -58,7 +58,7 @@ size_t ExFatFile::write(const void* buf, size_t nbyte) {
5858
return false;
5959
}
6060
//==============================================================================
61-
#else // READ_ONLY
61+
#else // EXFAT_READ_ONLY
6262
//------------------------------------------------------------------------------
6363
static uint16_t exFatDirChecksum(const uint8_t* data, uint16_t checksum) {
6464
bool skip = data[0] == EXFAT_TYPE_FILE;
@@ -753,4 +753,4 @@ size_t ExFatFile::write(const void* buf, size_t nbyte) {
753753
m_error |= WRITE_ERROR;
754754
return 0;
755755
}
756-
#endif // READ_ONLY
756+
#endif // EXFAT_READ_ONLY

src/ExFatLib/ExFatFormatter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const uint32_t ROOT_CLUSTER = 4;
4646
#define writeMsg(pr, str) if (pr) pr->write(str)
4747
#endif // PRINT_FORMAT_PROGRESS
4848
//------------------------------------------------------------------------------
49-
bool ExFatFormatter::format(BlockDevice* dev, uint8_t* secBuf, print_t* pr) {
49+
bool ExFatFormatter::format(FsBlockDevice* dev, uint8_t* secBuf, print_t* pr) {
5050
#if !PRINT_FORMAT_PROGRESS
5151
(void)pr;
5252
#endif // !PRINT_FORMAT_PROGRESS

src/ExFatLib/ExFatFormatter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
#ifndef ExFatFormatter_h
2626
#define ExFatFormatter_h
27-
#include "../common/BlockDevice.h"
27+
#include "../common/FsBlockDevice.h"
2828
/**
2929
* \class ExFatFormatter
3030
* \brief Format an exFAT volume.
@@ -40,7 +40,7 @@ class ExFatFormatter {
4040
*
4141
* \return true for success or false for failure.
4242
*/
43-
bool format(BlockDevice* dev, uint8_t* secBuf, print_t* pr = nullptr);
43+
bool format(FsBlockDevice* dev, uint8_t* secBuf, print_t* pr = nullptr);
4444
private:
4545
bool syncUpcase();
4646
bool writeUpcase(uint32_t sector);
@@ -49,7 +49,7 @@ class ExFatFormatter {
4949
uint32_t m_upcaseSector;
5050
uint32_t m_upcaseChecksum;
5151
uint32_t m_upcaseSize;
52-
BlockDevice* m_dev;
52+
FsBlockDevice* m_dev;
5353
uint8_t* m_secBuf;
5454
};
5555
#endif // ExFatFormatter_h

src/ExFatLib/ExFatName.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,13 @@ size_t ExFatFile::getName7(char* name, size_t count) {
8383
}
8484
for (uint8_t in = 0; in < 15; in++) {
8585
uint16_t c = getLe16(dn->unicode + 2*in);
86-
if (c == 0 || (n + 1) >= count) {
86+
if (c == 0) {
8787
goto done;
8888
}
89+
if ((n + 1) >= count) {
90+
DBG_FAIL_MACRO;
91+
goto fail;
92+
}
8993
name[n++] = c < 0X7F ? c : '?';
9094
}
9195
}
@@ -140,8 +144,8 @@ size_t ExFatFile::getName8(char* name, size_t count) {
140144
// Save space for zero byte.
141145
ptr = FsUtf::cpToMb(cp, str, end - 1);
142146
if (!ptr) {
143-
// Truncate name. Could goto fail.
144-
goto done;
147+
DBG_FAIL_MACRO;
148+
goto fail;
145149
}
146150
str = ptr;
147151
}

src/ExFatLib/ExFatPartition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ uint32_t ExFatPartition::freeClusterCount() {
266266
}
267267
}
268268
//------------------------------------------------------------------------------
269-
bool ExFatPartition::init(BlockDevice* dev, uint8_t part) {
269+
bool ExFatPartition::init(FsBlockDevice* dev, uint8_t part) {
270270
uint32_t volStart = 0;
271271
uint8_t* cache;
272272
pbs_t* pbs;

0 commit comments

Comments
 (0)