summaryrefslogtreecommitdiff
path: root/components/dfs
diff options
context:
space:
mode:
authortyustli <[email protected]>2019-06-18 20:09:19 +0800
committertyustli <[email protected]>2019-06-18 20:09:19 +0800
commitd8eb0cfc1e119b81290a460883f427a38d572617 (patch)
tree9cf38a4283ea507e3349ecb8c449cb1da0fcc789 /components/dfs
parent34059c40c42c53a541822834d8d9092c640f45b3 (diff)
fix kernel and framework no cast type error
Diffstat (limited to 'components/dfs')
-rw-r--r--components/dfs/filesystems/elmfat/dfs_elm.c12
-rw-r--r--components/dfs/filesystems/elmfat/ff.c2
-rw-r--r--components/dfs/src/dfs.c6
-rw-r--r--components/dfs/src/dfs_file.c4
-rw-r--r--components/dfs/src/dfs_posix.c4
-rw-r--r--components/dfs/src/poll.c2
6 files changed, 15 insertions, 15 deletions
diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c
index a45c15aa03..3825fd9108 100644
--- a/components/dfs/filesystems/elmfat/dfs_elm.c
+++ b/components/dfs/filesystems/elmfat/dfs_elm.c
@@ -202,7 +202,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
int index;
char logic_nbr[2] = {'0', ':'};
- work = rt_malloc(_MAX_SS);
+ work = (BYTE *)rt_malloc(_MAX_SS);
if (RT_NULL == work)
{
return -ENOMEM;
@@ -233,7 +233,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
}
else
{
- fat = rt_malloc(sizeof(FATFS));
+ fat = (FATFS *)rt_malloc(sizeof(FATFS));
if (fat == RT_NULL)
{
rt_free(work); /* release memory */
@@ -340,7 +340,7 @@ int dfs_elm_open(struct dfs_fd *file)
vol = elm_get_vol((FATFS *)fs->data);
if (vol < 0)
return -ENOENT;
- drivers_fn = rt_malloc(256);
+ drivers_fn = (char *)rt_malloc(256);
if (drivers_fn == RT_NULL)
return -ENOMEM;
@@ -648,7 +648,7 @@ int dfs_elm_unlink(struct dfs_filesystem *fs, const char *path)
vol = elm_get_vol((FATFS *)fs->data);
if (vol < 0)
return -ENOENT;
- drivers_fn = rt_malloc(256);
+ drivers_fn = (char *)rt_malloc(256);
if (drivers_fn == RT_NULL)
return -ENOMEM;
@@ -680,7 +680,7 @@ int dfs_elm_rename(struct dfs_filesystem *fs, const char *oldpath, const char *n
if (vol < 0)
return -ENOENT;
- drivers_oldfn = rt_malloc(256);
+ drivers_oldfn = (char *)rt_malloc(256);
if (drivers_oldfn == RT_NULL)
return -ENOMEM;
drivers_newfn = newpath;
@@ -714,7 +714,7 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st)
vol = elm_get_vol((FATFS *)fs->data);
if (vol < 0)
return -ENOENT;
- drivers_fn = rt_malloc(256);
+ drivers_fn = (char *)rt_malloc(256);
if (drivers_fn == RT_NULL)
return -ENOMEM;
diff --git a/components/dfs/filesystems/elmfat/ff.c b/components/dfs/filesystems/elmfat/ff.c
index 4a2f0258b6..19df7450e2 100644
--- a/components/dfs/filesystems/elmfat/ff.c
+++ b/components/dfs/filesystems/elmfat/ff.c
@@ -569,7 +569,7 @@ static WCHAR LfnBuf[_MAX_LFN+1]; /* LFN enabled with static working buffer */
#define FREE_NAMBUF() ff_memfree(lfn)
#else
#define DEF_NAMBUF WCHAR *lfn;
-#define INIT_NAMBUF(fs) { lfn = ff_memalloc((_MAX_LFN+1)*2); if (!lfn) LEAVE_FF(fs, FR_NOT_ENOUGH_CORE); (fs)->lfnbuf = lfn; }
+#define INIT_NAMBUF(fs) { lfn = (WCHAR *)ff_memalloc((_MAX_LFN+1)*2); if (!lfn) LEAVE_FF(fs, FR_NOT_ENOUGH_CORE); (fs)->lfnbuf = lfn; }
#define FREE_NAMBUF() ff_memfree(lfn)
#endif
diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c
index 5bddb96930..32cbbf643b 100644
--- a/components/dfs/src/dfs.c
+++ b/components/dfs/src/dfs.c
@@ -141,7 +141,7 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd)
cnt = fdt->maxfd + 4;
cnt = cnt > DFS_FD_MAX ? DFS_FD_MAX : cnt;
- fds = rt_realloc(fdt->fds, cnt * sizeof(struct dfs_fd *));
+ fds = (struct dfs_fd **)rt_realloc(fdt->fds, cnt * sizeof(struct dfs_fd *));
if (fds == NULL) goto __exit; /* return fdt->maxfd */
/* clean the new allocated fds */
@@ -157,7 +157,7 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd)
/* allocate 'struct dfs_fd' */
if (idx < (int)fdt->maxfd && fdt->fds[idx] == RT_NULL)
{
- fdt->fds[idx] = rt_calloc(1, sizeof(struct dfs_fd));
+ fdt->fds[idx] = (struct dfs_fd *)rt_calloc(1, sizeof(struct dfs_fd));
if (fdt->fds[idx] == RT_NULL)
idx = fdt->maxfd;
}
@@ -393,7 +393,7 @@ char *dfs_normalize_path(const char *directory, const char *filename)
if (filename[0] != '/') /* it's a absolute path, use it directly */
{
- fullpath = rt_malloc(strlen(directory) + strlen(filename) + 2);
+ fullpath = (char *)rt_malloc(strlen(directory) + strlen(filename) + 2);
if (fullpath == NULL)
return NULL;
diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c
index 65fd0c45e8..5f090a7f6b 100644
--- a/components/dfs/src/dfs_file.c
+++ b/components/dfs/src/dfs_file.c
@@ -600,7 +600,7 @@ static void copyfile(const char *src, const char *dst)
rt_uint8_t *block_ptr;
rt_int32_t read_bytes;
- block_ptr = rt_malloc(BUF_SZ);
+ block_ptr = (rt_uint8_t *)rt_malloc(BUF_SZ);
if (block_ptr == NULL)
{
rt_kprintf("out of memory\n");
@@ -715,7 +715,7 @@ static void copydir(const char *src, const char *dst)
static const char *_get_path_lastname(const char *path)
{
char *ptr;
- if ((ptr = strrchr(path, '/')) == NULL)
+ if ((ptr = (char *)strrchr(path, '/')) == NULL)
return path;
/* skip the '/' then return */
diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c
index 6d643e2d4a..69fe56a84e 100644
--- a/components/dfs/src/dfs_posix.c
+++ b/components/dfs/src/dfs_posix.c
@@ -265,11 +265,11 @@ RTM_EXPORT(lseek);
*
* note: the old and new file name must be belong to a same file system.
*/
-int rename(const char *old, const char *new)
+int rename(const char *old_file, const char *new_file)
{
int result;
- result = dfs_file_rename(old, new);
+ result = dfs_file_rename(old_file, new_file);
if (result < 0)
{
rt_set_errno(result);
diff --git a/components/dfs/src/poll.c b/components/dfs/src/poll.c
index aee157eed5..473b1579d2 100644
--- a/components/dfs/src/poll.c
+++ b/components/dfs/src/poll.c
@@ -54,7 +54,7 @@ static void _poll_add(rt_wqueue_t *wq, rt_pollreq_t *req)
struct rt_poll_table *pt;
struct rt_poll_node *node;
- node = rt_malloc(sizeof(struct rt_poll_node));
+ node = (struct rt_poll_node *)rt_malloc(sizeof(struct rt_poll_node));
if (node == RT_NULL)
return;