Fix wrong size reported for cards above 16GB

Fixes: https://github.com/espressif/arduino-esp32/issues/803
This commit is contained in:
me-no-dev 2017-11-06 16:20:42 +02:00
parent 45d5d9b360
commit 1b994d54be
2 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,7 @@ uint64_t SDFS::totalBytes()
FATFS* fsinfo;
DWORD fre_clust;
if(f_getfree("0:",&fre_clust,&fsinfo)!= 0) return 0;
uint64_t size = (fsinfo->csize)*(fsinfo->n_fatent - 2)
uint64_t size = ((uint64_t)(fsinfo->csize))*(fsinfo->n_fatent - 2)
#if _MAX_SS != 512
*(fsinfo->ssize);
#else
@ -94,7 +94,7 @@ uint64_t SDFS::usedBytes()
FATFS* fsinfo;
DWORD fre_clust;
if(f_getfree("0:",&fre_clust,&fsinfo)!= 0) return 0;
uint64_t size = (fsinfo->csize)*((fsinfo->n_fatent - 2) - (fsinfo->free_clst))
uint64_t size = ((uint64_t)(fsinfo->csize))*((fsinfo->n_fatent - 2) - (fsinfo->free_clst))
#if _MAX_SS != 512
*(fsinfo->ssize);
#else

View File

@ -104,7 +104,7 @@ uint64_t SDMMCFS::totalBytes()
FATFS* fsinfo;
DWORD fre_clust;
if(f_getfree("0:",&fre_clust,&fsinfo)!= 0) return 0;
uint64_t size = (fsinfo->csize)*(fsinfo->n_fatent - 2)
uint64_t size = ((uint64_t)(fsinfo->csize))*(fsinfo->n_fatent - 2)
#if _MAX_SS != 512
*(fsinfo->ssize);
#else
@ -118,7 +118,7 @@ uint64_t SDMMCFS::usedBytes()
FATFS* fsinfo;
DWORD fre_clust;
if(f_getfree("0:",&fre_clust,&fsinfo)!= 0) return 0;
uint64_t size = (fsinfo->csize)*((fsinfo->n_fatent - 2) - (fsinfo->free_clst))
uint64_t size = ((uint64_t)(fsinfo->csize))*((fsinfo->n_fatent - 2) - (fsinfo->free_clst))
#if _MAX_SS != 512
*(fsinfo->ssize);
#else