We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7affa73 commit e802ea7Copy full SHA for e802ea7
src/SD.cpp
@@ -354,10 +354,12 @@ void File::printTwoDigits(uint8_t v)
354
*/
355
int File::read()
356
{
357
- uint8_t byteread;
+ UINT byteread;
358
int8_t data;
359
- f_read(_fil, (void *)&data, 1, (UINT *)&byteread);
360
- return data;
+ if (f_read(_fil, (void *)&data, 1, (UINT *)&byteread) == FR_OK) {
+ return data;
361
+ }
362
+ return -1;
363
}
364
365
/**
@@ -368,11 +370,12 @@ int File::read()
368
370
369
371
int File::read(void *buf, size_t len)
372
- uint8_t bytesread;
-
373
- f_read(_fil, buf, len, (UINT *)&bytesread);
374
- return bytesread;
+ UINT bytesread;
375
+ if (f_read(_fil, buf, len, (UINT *)&bytesread) == FR_OK) {
376
+ return bytesread;
377
378
379
380
381
0 commit comments