mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-23 12:15:32 +08:00
Fix some compilation warning (#5744)
* Fix some compilation warning * 补充修正一些数据类型的使用错误 Co-authored-by: Meco Man <920369182@qq.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -40,7 +40,7 @@ int dfs_romfs_ioctl(struct dfs_fd *file, int cmd, void *args)
|
||||
rt_inline int check_dirent(struct romfs_dirent *dirent)
|
||||
{
|
||||
if ((dirent->type != ROMFS_DIRENT_FILE && dirent->type != ROMFS_DIRENT_DIR)
|
||||
|| dirent->size == ~0)
|
||||
|| dirent->size == ~0U)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch
|
||||
{
|
||||
if (check_dirent(&dirent[index]) != 0)
|
||||
return NULL;
|
||||
if (rt_strlen(dirent[index].name) == (subpath_end - subpath) &&
|
||||
if (rt_strlen(dirent[index].name) == (rt_size_t)(subpath_end - subpath) &&
|
||||
rt_strncmp(dirent[index].name, subpath, (subpath_end - subpath)) == 0)
|
||||
{
|
||||
dirent_size = dirent[index].size;
|
||||
@@ -295,6 +295,7 @@ static const struct dfs_file_ops _rom_fops =
|
||||
NULL,
|
||||
dfs_romfs_lseek,
|
||||
dfs_romfs_getdents,
|
||||
NULL,
|
||||
};
|
||||
static const struct dfs_filesystem_ops _romfs =
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -10,17 +10,17 @@
|
||||
#include <rtthread.h>
|
||||
#include <dfs_romfs.h>
|
||||
|
||||
const static unsigned char _dummy_dummy_txt[] =
|
||||
static const unsigned char _dummy_dummy_txt[] =
|
||||
{
|
||||
0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x21, 0x0d, 0x0a,
|
||||
};
|
||||
|
||||
const static struct romfs_dirent _dummy[] =
|
||||
static const struct romfs_dirent _dummy[] =
|
||||
{
|
||||
{ROMFS_DIRENT_FILE, "dummy.txt", _dummy_dummy_txt, sizeof(_dummy_dummy_txt)},
|
||||
};
|
||||
|
||||
const static unsigned char _dummy_txt[] =
|
||||
static const unsigned char _dummy_txt[] =
|
||||
{
|
||||
0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x21, 0x0d, 0x0a,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -132,7 +132,7 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd)
|
||||
}
|
||||
|
||||
/* allocate a larger FD container */
|
||||
if (idx == fdt->maxfd && fdt->maxfd < DFS_FD_MAX)
|
||||
if (idx == (int)fdt->maxfd && fdt->maxfd < DFS_FD_MAX)
|
||||
{
|
||||
int cnt, index;
|
||||
struct dfs_fd **fds;
|
||||
@@ -145,7 +145,7 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd)
|
||||
if (fds == NULL) goto __exit; /* return fdt->maxfd */
|
||||
|
||||
/* clean the new allocated fds */
|
||||
for (index = fdt->maxfd; index < cnt; index ++)
|
||||
for (index = (int)fdt->maxfd; index < cnt; index ++)
|
||||
{
|
||||
fds[index] = NULL;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ int fd_new(void)
|
||||
idx = fd_alloc(fdt, 0);
|
||||
|
||||
/* can't find an empty fd entry */
|
||||
if (idx == fdt->maxfd)
|
||||
if (idx == (int)fdt->maxfd)
|
||||
{
|
||||
idx = -(1 + DFS_FD_OFFSET);
|
||||
LOG_E("DFS fd new is failed! Could not found an empty fd entry.");
|
||||
|
||||
Reference in New Issue
Block a user