diff --git a/libraries/SD/src/SD.cpp b/libraries/SD/src/SD.cpp index f92532ca..40d16c86 100644 --- a/libraries/SD/src/SD.cpp +++ b/libraries/SD/src/SD.cpp @@ -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 diff --git a/libraries/SD_MMC/src/SD_MMC.cpp b/libraries/SD_MMC/src/SD_MMC.cpp index d554413b..10476969 100644 --- a/libraries/SD_MMC/src/SD_MMC.cpp +++ b/libraries/SD_MMC/src/SD_MMC.cpp @@ -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