diff --git a/src/common/PrintBasic.cpp b/extras/attic/PrintBasic.cpp similarity index 100% rename from src/common/PrintBasic.cpp rename to extras/attic/PrintBasic.cpp diff --git a/src/common/PrintBasic.h b/extras/attic/PrintBasic.h similarity index 100% rename from src/common/PrintBasic.h rename to extras/attic/PrintBasic.h diff --git a/src/common/PrintTemplates.h b/extras/attic/PrintTemplates.h similarity index 100% rename from src/common/PrintTemplates.h rename to extras/attic/PrintTemplates.h diff --git a/src/common/SysCallBareUno.cpp b/extras/attic/SysCallBareUno.cpp similarity index 100% rename from src/common/SysCallBareUno.cpp rename to extras/attic/SysCallBareUno.cpp diff --git a/library.properties b/library.properties index f5ee31ab..35c6ddd3 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SdFat -version=2.0.5 +version=2.0.6 license=MIT author=Bill Greiman maintainer=Bill Greiman diff --git a/src/ExFatLib/ExFatFormatter.cpp b/src/ExFatLib/ExFatFormatter.cpp index c465661b..e19282bc 100644 --- a/src/ExFatLib/ExFatFormatter.cpp +++ b/src/ExFatLib/ExFatFormatter.cpp @@ -201,7 +201,7 @@ bool ExFatFormatter::format(BlockDevice* dev, uint8_t* secBuf, print_t* pr) { memset(secBuf, 0, BYTES_PER_SECTOR); // Allocate two reserved clusters, bitmap, upcase, and root clusters. secBuf[0] = 0XF8; - for (size_t i = 0; i < 20; i++) { + for (size_t i = 1; i < 20; i++) { secBuf[i] = 0XFF; } for (uint32_t i = 0; i < ns; i++) { diff --git a/src/FatLib/FatFileLFN.cpp b/src/FatLib/FatFileLFN.cpp index 26e8c49b..bd916a18 100644 --- a/src/FatLib/FatFileLFN.cpp +++ b/src/FatLib/FatFileLFN.cpp @@ -359,7 +359,11 @@ bool FatFile::open(FatFile* dirFile, fname_t* fname, oflag_t oflag) { if ((ldir->order & FAT_ORDER_LAST_LONG_ENTRY) == 0) { continue; } - lfnOrd = order = ldir->order & 0X1F; + order = ldir->order & 0X1F; + if (order != (freeNeed - 1)) { + continue; + } + lfnOrd = order; checksum = ldir->checksum; } else if (ldir->order != --order || checksum != ldir->checksum) { lfnOrd = 0; diff --git a/src/SdFat.h b/src/SdFat.h index 23605270..429682f6 100644 --- a/src/SdFat.h +++ b/src/SdFat.h @@ -38,9 +38,9 @@ #endif // INCLUDE_SDIOS //------------------------------------------------------------------------------ /** SdFat version for cpp use. */ -#define SD_FAT_VERSION 20005 +#define SD_FAT_VERSION 20006 /** SdFat version as string. */ -#define SD_FAT_VERSION_STR "2.0.5" +#define SD_FAT_VERSION_STR "2.0.6" //============================================================================== /** * \class SdBase diff --git a/src/SpiDriver/SdSpiArtemis.cpp b/src/SpiDriver/SdSpiArtemis.cpp index 954db6c8..a6a47a4d 100644 --- a/src/SpiDriver/SdSpiArtemis.cpp +++ b/src/SpiDriver/SdSpiArtemis.cpp @@ -47,7 +47,8 @@ uint8_t SdSpiArduinoDriver::receive() { } //------------------------------------------------------------------------------ uint8_t SdSpiArduinoDriver::receive(uint8_t* buf, size_t count) { - m_spi->transferIn(buf, count); + memset(buf, 0XFF, count); + m_spi->transfer(buf, count); return 0; } //------------------------------------------------------------------------------ diff --git a/src/common/FsCache.cpp b/src/common/FsCache.cpp index e19357e4..2ee269f3 100644 --- a/src/common/FsCache.cpp +++ b/src/common/FsCache.cpp @@ -22,6 +22,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#define DBG_FILE "FsCache.cpp" #include "DebugMacros.h" #include "FsCache.h" //------------------------------------------------------------------------------ diff --git a/src/common/FsCache.h b/src/common/FsCache.h index 76b24385..a9232216 100644 --- a/src/common/FsCache.h +++ b/src/common/FsCache.h @@ -30,7 +30,6 @@ */ #include "SysCall.h" #include "BlockDevice.h" -#include "DebugMacros.h" /** * \class FsCache * \brief Sector cache. diff --git a/src/common/SysCall.h b/src/common/SysCall.h index bad84045..702f6d19 100644 --- a/src/common/SysCall.h +++ b/src/common/SysCall.h @@ -94,6 +94,7 @@ inline void SysCall::yield() {} #endif // defined(PLATFORM_ID) //------------------------------------------------------------------------------ #else // ENABLE_ARDUINO_FEATURES +#error Print not defined #include "PrintBasic.h" /** If not Arduino */ typedef PrintBasic print_t; diff --git a/src/iostream/istream.cpp b/src/iostream/istream.cpp index 8c7c5cc9..5ffbd418 100644 --- a/src/iostream/istream.cpp +++ b/src/iostream/istream.cpp @@ -197,13 +197,13 @@ bool istream::getDouble(double* value) { if (exp & 1) { if (expNeg) { // check for underflow - if (v < FLT_MIN * pow10 && frac != 0) { + if (v < DBL_MIN * pow10 && frac != 0) { goto fail; } v /= pow10; } else { // check for overflow - if (v > FLT_MAX / pow10) { + if (v > DBL_MAX / pow10) { goto fail; } v *= pow10;