Merge branch 'bugfix/vfs_write_return_type' into 'master'

Change esp_vfs_t.write return value to ssize_t

See merge request !897
pull/661/merge
Ivan Grokhotkov 2017-06-22 11:48:34 +08:00
commit 45037efc45
5 zmienionych plików z 10 dodań i 10 usunięć

Wyświetl plik

@ -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];

Wyświetl plik

@ -37,7 +37,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,
@ -49,7 +49,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,

Wyświetl plik

@ -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);

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -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;