aboutsummaryrefslogtreecommitdiff
path: root/libraries/SD/utility
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/SD/utility')
-rw-r--r--libraries/SD/utility/SdFat.h8
-rw-r--r--libraries/SD/utility/SdFatUtil.h5
-rw-r--r--libraries/SD/utility/SdFile.cpp17
3 files changed, 16 insertions, 14 deletions
diff --git a/libraries/SD/utility/SdFat.h b/libraries/SD/utility/SdFat.h
index 048fa71..344326f 100644
--- a/libraries/SD/utility/SdFat.h
+++ b/libraries/SD/utility/SdFat.h
@@ -141,7 +141,7 @@ class SdFile : public Print {
* Set writeError to false before calling print() and/or write() and check
* for true after calls to print() and/or write().
*/
- bool writeError;
+ //bool writeError;
/**
* Cancel unbuffered reads for this file.
* See setUnbufferedRead()
@@ -283,9 +283,9 @@ class SdFile : public Print {
}
/** \return SdVolume that contains this file. */
SdVolume* volume(void) const {return vol_;}
- void write(uint8_t b);
- int16_t write(const void* buf, uint16_t nbyte);
- void write(const char* str);
+ size_t write(uint8_t b);
+ size_t write(const void* buf, uint16_t nbyte);
+ size_t write(const char* str);
void write_P(PGM_P str);
void writeln_P(PGM_P str);
//------------------------------------------------------------------------------
diff --git a/libraries/SD/utility/SdFatUtil.h b/libraries/SD/utility/SdFatUtil.h
index c626bfe..283fcb2 100644
--- a/libraries/SD/utility/SdFatUtil.h
+++ b/libraries/SD/utility/SdFatUtil.h
@@ -30,10 +30,11 @@
/** Store and print a string in flash memory followed by a CR/LF.*/
#define PgmPrintln(x) SerialPrintln_P(PSTR(x))
/** Defined so doxygen works for function definitions. */
-#define NOINLINE __attribute__((noinline))
+#define NOINLINE __attribute__((noinline,unused))
+#define UNUSEDOK __attribute__((unused))
//------------------------------------------------------------------------------
/** Return the number of bytes currently free in RAM. */
-static int FreeRam(void) {
+static UNUSEDOK int FreeRam(void) {
extern int __bss_end;
extern int* __brkval;
int free_memory;
diff --git a/libraries/SD/utility/SdFile.cpp b/libraries/SD/utility/SdFile.cpp
index 40444a7..e786f56 100644
--- a/libraries/SD/utility/SdFile.cpp
+++ b/libraries/SD/utility/SdFile.cpp
@@ -590,7 +590,7 @@ void SdFile::printDirName(const dir_t& dir, uint8_t width) {
Serial.print('.');
w++;
}
- Serial.print(dir.name[i]);
+ Serial.write(dir.name[i]);
w++;
}
if (DIR_IS_SUBDIR(&dir)) {
@@ -1121,7 +1121,7 @@ uint8_t SdFile::truncate(uint32_t length) {
* for a read-only file, device is full, a corrupt file system or an I/O error.
*
*/
-int16_t SdFile::write(const void* buf, uint16_t nbyte) {
+size_t SdFile::write(const void* buf, uint16_t nbyte) {
// convert void* to uint8_t* - must be before goto statements
const uint8_t* src = reinterpret_cast<const uint8_t*>(buf);
@@ -1210,8 +1210,9 @@ int16_t SdFile::write(const void* buf, uint16_t nbyte) {
writeErrorReturn:
// return for write error
- writeError = true;
- return -1;
+ //writeError = true;
+ setWriteError();
+ return 0;
}
//------------------------------------------------------------------------------
/**
@@ -1219,8 +1220,8 @@ int16_t SdFile::write(const void* buf, uint16_t nbyte) {
*
* Use SdFile::writeError to check for errors.
*/
-void SdFile::write(uint8_t b) {
- write(&b, 1);
+size_t SdFile::write(uint8_t b) {
+ return write(&b, 1);
}
//------------------------------------------------------------------------------
/**
@@ -1228,8 +1229,8 @@ void SdFile::write(uint8_t b) {
*
* Use SdFile::writeError to check for errors.
*/
-void SdFile::write(const char* str) {
- write(str, strlen(str));
+size_t SdFile::write(const char* str) {
+ return write(str, strlen(str));
}
//------------------------------------------------------------------------------
/**