Skip to content

Commit 5ba38fa

Browse files
committed
Applying adafruit SD updates (available() overful fix).
http://code.google.com/p/arduino/issues/detail?id=595
1 parent f3d8628 commit 5ba38fa

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

libraries/SD/File.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ int File::read(void *buf, uint16_t nbyte) {
101101

102102
int File::available() {
103103
if (! _file) return 0;
104-
return size() - position();
104+
105+
uint32_t n = size() - position();
106+
107+
return n > 0X7FFF ? 0X7FFF : n;
105108
}
106109

107110
void File::flush() {

libraries/SD/examples/CardInfo/CardInfo.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void setup()
8080

8181

8282
// print the type and size of the first FAT-type volume
83-
long volumesize;
83+
uint32_t volumesize;
8484
Serial.print("\nVolume type is FAT");
8585
Serial.println(volume.fatType(), DEC);
8686
Serial.println();

0 commit comments

Comments
 (0)