refactor: fix codecheck

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ib35ca40dc837d78a4c9dc03e44d117088865a5a6
This commit is contained in:
arvinzzz 2023-05-26 15:44:47 +08:00
parent 5de241eb2a
commit 145ff76ab6
2 changed files with 20 additions and 14 deletions

View File

@ -490,14 +490,14 @@ off_t VfsJffs2Seek(struct file *filep, off_t offset, int whence)
filePos = filep->f_pos; filePos = filep->f_pos;
switch (whence) { switch (whence) {
case SEEK_SET:
filePos = offset;
break;
case SEEK_CUR: case SEEK_CUR:
filePos += offset; filePos += offset;
break; break;
case SEEK_SET:
filePos = offset;
break;
case SEEK_END: case SEEK_END:
filePos = node->i_size + offset; filePos = node->i_size + offset;
break; break;

View File

@ -485,29 +485,35 @@ UINT32 OsDevLimitWriteDeny(ProcLimitSet *plimit, const CHAR *buf, UINT32 size)
return DevLimitUpdateAccess(plimit, buf, DEVLIMIT_DENY); return DevLimitUpdateAccess(plimit, buf, DEVLIMIT_DENY);
} }
STATIC VOID DevLimitItemSetAccess(CHAR *acc, INT16 access) STATIC VOID DevLimitItemSetAccess(CHAR *accArray, INT16 access)
{ {
INT32 index = 0; INT32 index = 0;
(VOID)memset_s(acc, ACCLEN, 0, ACCLEN); (VOID)memset_s(acc, ACCLEN, 0, ACCLEN);
if (access & DEVLIMIT_ACC_READ) { if (access & DEVLIMIT_ACC_READ) {
acc[index++] = 'r'; accArray[index] = 'r';
index++;
} }
if (access & DEVLIMIT_ACC_WRITE) { if (access & DEVLIMIT_ACC_WRITE) {
acc[index++] = 'w'; accArray[index] = 'w';
index++;
} }
if (access & DEVLIMIT_ACC_MKNOD) { if (access & DEVLIMIT_ACC_MKNOD) {
acc[index++] = 'm'; accArray[index] = 'm';
index++;
} }
} }
STATIC CHAR DevLimitItemTypeToChar(INT16 type) STATIC CHAR DevLimitItemTypeToChar(INT16 type)
{ {
if (type == DEVLIMIT_DEV_ALL) { switch (type) {
return 'a'; case DEVLIMIT_DEV_ALL:
} else if (type == DEVLIMIT_DEV_CHAR) { return 'a';
return 'c'; case DEVLIMIT_DEV_CHAR:
} else if (type == DEVLIMIT_DEV_BLOCK) { return 'c';
return 'b'; case DEVLIMIT_DEV_BLOCK:
return 'b';
default:
break;
} }
return 'X'; return 'X';
} }