Skip to content

Commit b4d9834

Browse files
Restore size_t, make it limit, add size64
Because size() is used in many printf()s, we can't just change its return type to uint64. Instead, when size is > size-max, return size-max. Add size64 which can be used by new apps who care about >4GB cards.
1 parent 2626a98 commit b4d9834

File tree

1 file changed

+6
-1
lines changed
  • libraries/SD/src

1 file changed

+6
-1
lines changed

libraries/SD/src/SD.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ class SDClass {
115115
return blocksPerCluster() * blockSize();
116116
}
117117

118-
uint64_t size() {
118+
size_t size() {
119+
uint64_t sz = size64();
120+
return (size_t)std::min( (uint64_t)SIZE_MAX, sz );
121+
}
122+
123+
uint64_t size64() {
119124
return ((uint64_t)clusterSize() * (uint64_t)totalClusters());
120125
}
121126

0 commit comments

Comments
 (0)