Change esp_vfs_t.write return value to ssize_t

write() should return ssize_t, not size_t.
This commit is contained in:
Deomid Ryabkov 2017-06-08 17:48:17 +01:00
parent 2427809c9d
commit b8782bdd90
5 changed files with 10 additions and 10 deletions

View file

@ -45,7 +45,7 @@ typedef struct {
static const char* TAG = "vfs_fat";
static size_t vfs_fat_write(void* p, int fd, const void * data, size_t size);
static ssize_t vfs_fat_write(void* p, int fd, const void * data, size_t size);
static off_t vfs_fat_lseek(void* p, int fd, off_t size, int mode);
static ssize_t vfs_fat_read(void* ctx, int fd, void * dst, size_t size);
static int vfs_fat_open(void* ctx, const char * path, int flags, int mode);
@ -290,7 +290,7 @@ out:
return fd;
}
static size_t vfs_fat_write(void* ctx, int fd, const void * data, size_t size)
static ssize_t vfs_fat_write(void* ctx, int fd, const void * data, size_t size)
{
vfs_fat_ctx_t* fat_ctx = (vfs_fat_ctx_t*) ctx;
FIL* file = &fat_ctx->files[fd];

View file

@ -31,7 +31,7 @@ Depending on the way FS driver declares its APIs, either ``read``, ``write``, et
Case 1: API functions are declared without an extra context pointer (FS driver is a singleton)::
size_t myfs_write(int fd, const void * data, size_t size);
ssize_t myfs_write(int fd, const void * data, size_t size);
// In definition of esp_vfs_t:
.flags = ESP_VFS_FLAG_DEFAULT,
@ -43,7 +43,7 @@ Case 1: API functions are declared without an extra context pointer (FS driver i
Case 2: API functions are declared with an extra context pointer (FS driver supports multiple instances)::
size_t myfs_write(myfs_t* fs, int fd, const void * data, size_t size);
ssize_t myfs_write(myfs_t* fs, int fd, const void * data, size_t size);
// In definition of esp_vfs_t:
.flags = ESP_VFS_FLAG_CONTEXT_PTR,

View file

@ -69,8 +69,8 @@ typedef struct
int fd_offset; /*!< file descriptor offset, determined by the FS driver */
int flags; /*!< ESP_VFS_FLAG_CONTEXT_PTR or ESP_VFS_FLAG_DEFAULT */
union {
size_t (*write_p)(void* p, int fd, const void * data, size_t size);
size_t (*write)(int fd, const void * data, size_t size);
ssize_t (*write_p)(void* p, int fd, const void * data, size_t size);
ssize_t (*write)(int fd, const void * data, size_t size);
};
union {
off_t (*lseek_p)(void* p, int fd, off_t size, int mode);

View file

@ -213,7 +213,7 @@ ssize_t esp_vfs_write(struct _reent *r, int fd, const void * data, size_t size)
return -1;
}
int local_fd = translate_fd(vfs, fd);
int ret;
ssize_t ret;
CHECK_AND_CALL(ret, r, vfs, write, local_fd, data, size);
return ret;
}
@ -226,7 +226,7 @@ off_t esp_vfs_lseek(struct _reent *r, int fd, off_t size, int mode)
return -1;
}
int local_fd = translate_fd(vfs, fd);
int ret;
off_t ret;
CHECK_AND_CALL(ret, r, vfs, lseek, local_fd, size, mode);
return ret;
}
@ -239,7 +239,7 @@ ssize_t esp_vfs_read(struct _reent *r, int fd, void * dst, size_t size)
return -1;
}
int local_fd = translate_fd(vfs, fd);
int ret;
ssize_t ret;
CHECK_AND_CALL(ret, r, vfs, read, local_fd, dst, size);
return ret;
}

View file

@ -47,7 +47,7 @@ static void IRAM_ATTR uart_tx_char(uart_dev_t* uart, int c)
}
static size_t IRAM_ATTR uart_write(int fd, const void * data, size_t size)
static ssize_t IRAM_ATTR uart_write(int fd, const void * data, size_t size)
{
assert(fd >=0 && fd < 3);
const char *data_c = (const char *)data;