Преглед на файлове

sdfat: Use dataLength() instead of size() to get correct file size no matter the underlying filesystem. Fixes #258

Eric Helgeson преди 4 месеца
родител
ревизия
9063091b1f
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      src/ImageBackingStore.cpp

+ 2 - 2
src/ImageBackingStore.cpp

@@ -136,7 +136,7 @@ bool ImageBackingStore::_internal_open(const char *filename)
         return false;
     }
 
-    uint32_t sectorcount = m_fsfile.size() / SD_SECTOR_SIZE;
+    uint32_t sectorcount = m_fsfile.dataLength() / SD_SECTOR_SIZE;
     uint32_t begin = 0, end = 0;
     if (m_fsfile.contiguousRange(&begin, &end) && end >= begin + sectorcount - 1)
     {
@@ -236,7 +236,7 @@ uint64_t ImageBackingStore::size()
     }
     else
     {
-        return m_fsfile.size();
+        return m_fsfile.dataLength();
     }
 }