1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-01 03:47:23 +03:00

Changing from long to ssize_t (int) for write(), print(), println() return.

This commit is contained in:
David A. Mellis
2011-08-26 14:20:41 -04:00
parent 3f0b7f21c2
commit 929597375b
23 changed files with 123 additions and 121 deletions

View File

@ -58,16 +58,16 @@ boolean File::isDirectory(void) {
}
long File::write(uint8_t val) {
ssize_t File::write(uint8_t val) {
return write(&val, 1);
}
long File::write(const char *str) {
ssize_t File::write(const char *str) {
return write((const uint8_t *) str, strlen(str));
}
long File::write(const uint8_t *buf, size_t size) {
long t;
ssize_t File::write(const uint8_t *buf, size_t size) {
ssize_t t;
if (!_file) return -1;
t = _file->write(buf, size);
if (t < 0) return t - 1;

View File

@ -32,9 +32,9 @@ public:
File(SdFile f, char *name); // wraps an underlying SdFile
File(void); // 'empty' constructor
~File(void); // destructor
virtual long write(uint8_t);
virtual long write(const char *str);
virtual long write(const uint8_t *buf, size_t size);
virtual ssize_t write(uint8_t);
virtual ssize_t write(const char *str);
virtual ssize_t write(const uint8_t *buf, size_t size);
virtual int read();
virtual int peek();
virtual int available();

View File

@ -283,9 +283,9 @@ class SdFile : public Print {
}
/** \return SdVolume that contains this file. */
SdVolume* volume(void) const {return vol_;}
long write(uint8_t b);
long write(const void* buf, uint16_t nbyte);
long write(const char* str);
ssize_t write(uint8_t b);
ssize_t write(const void* buf, uint16_t nbyte);
ssize_t write(const char* str);
void write_P(PGM_P str);
void writeln_P(PGM_P str);
//------------------------------------------------------------------------------

View File

@ -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.
*
*/
long SdFile::write(const void* buf, uint16_t nbyte) {
ssize_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);
@ -1219,7 +1219,7 @@ long SdFile::write(const void* buf, uint16_t nbyte) {
*
* Use SdFile::writeError to check for errors.
*/
long SdFile::write(uint8_t b) {
ssize_t SdFile::write(uint8_t b) {
return write(&b, 1);
}
//------------------------------------------------------------------------------
@ -1228,7 +1228,7 @@ long SdFile::write(uint8_t b) {
*
* Use SdFile::writeError to check for errors.
*/
long SdFile::write(const char* str) {
ssize_t SdFile::write(const char* str) {
return write(str, strlen(str));
}
//------------------------------------------------------------------------------