diff --git a/File.cpp b/File.cpp index 9ef8196..4d7cf1e 100644 --- a/File.cpp +++ b/File.cpp @@ -97,7 +97,10 @@ int File::read(void *buf, uint16_t nbyte) { int File::available() { if (! _file) return 0; - return size() - position(); + + uint32_t n = size() - position(); + + return n > 0X7FFF ? 0X7FFF : n; } void File::flush() {