Skip to content

Commit 1b9301d

Browse files
committed
Fix #15: warnings in OSAL unit test code
Qualify all pointers referring to string literals as `const` Eliminate unused local variables Add missing local function prototypes.
1 parent 6ec874a commit 1b9301d

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

src/unit-tests/oscore-test/ut_oscore_test.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ extern UT_OsLogInfo_t g_logInfo;
2929
**--------------------------------------------------------------------------------*/
3030

3131
int32 g_skipTestCase = -1;
32-
char* g_skipTestCaseResult = " ";
32+
const char* g_skipTestCaseResult = " ";
3333

34-
char* g_task_names[UT_OS_TASK_LIST_LEN];
34+
const char* g_task_names[UT_OS_TASK_LIST_LEN];
3535
char g_long_task_name[OS_MAX_API_NAME+5];
3636

3737
/*--------------------------------------------------------------------------------*
@@ -49,6 +49,7 @@ void UT_os_setup_install_delete_handler_test(void);
4949
void UT_os_init_task_exit_test(void);
5050
void UT_os_init_task_delay_test(void);
5151
void UT_os_init_task_set_priority_test(void);
52+
void UT_os_init_task_register_test(void);
5253
void UT_os_init_task_get_id_test(void);
5354
void UT_os_init_task_get_id_by_name_test(void);
5455
void UT_os_init_task_get_info_test(void);

src/unit-tests/osfile-test/ut_osfile_dirio_test.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ char g_dirName[UT_OS_SM_TEXT_LEN];
4040
char g_fileName[UT_OS_SM_TEXT_LEN];
4141

4242
char g_subdirNames[UT_OS_FILE_MAX_DIRS][UT_OS_SM_TEXT_LEN];
43-
char* g_tgtSubdirs[UT_OS_FILE_MAX_DIRS] = {"subdir1", "subdir2"};
43+
const char* g_tgtSubdirs[UT_OS_FILE_MAX_DIRS] = {"subdir1", "subdir2"};
4444

4545
char g_dirItems[UT_OS_FILE_MAX_DIRS][UT_OS_SM_TEXT_LEN];
4646

@@ -520,7 +520,6 @@ void UT_os_readdir_test()
520520
{
521521
int32 idx=0;
522522
uint32 dirh;
523-
os_dirent_t* dirEntry=NULL;
524523
UT_OsApiInfo_t apiInfo;
525524
const char* testDesc=NULL;
526525

src/unit-tests/osfile-test/ut_osfile_fileio_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,7 +2091,7 @@ void UT_os_outputtofile_test()
20912091
{
20922092
int32 idx=0;
20932093
UT_OsApiInfo_t apiInfo;
2094-
char* cmd=NULL;
2094+
const char* cmd=NULL;
20952095
const char* testDesc=NULL;
20962096

20972097
UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx)
@@ -2236,7 +2236,7 @@ void UT_os_getfdinfo_test()
22362236
UT_OsApiInfo_t apiInfo;
22372237
OS_file_prop_t fdProps;
22382238
const char* testDesc=NULL;
2239-
char* fileName="GetInfo_Nom.txt";
2239+
const char* fileName="GetInfo_Nom.txt";
22402240

22412241
UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx)
22422242

src/unit-tests/osfile-test/ut_osfile_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ extern UT_OsLogInfo_t g_logInfo;
3131
char* g_fsAddrPtr = NULL;
3232

3333
int32 g_skipTestCase = -1;
34-
char* g_skipTestCaseResult = " ";
34+
const char* g_skipTestCaseResult = " ";
3535

3636
char g_longPathName[OS_MAX_PATH_LEN+5];
3737
char g_longFileName[OS_MAX_PATH_LEN];
3838
char g_invalidPath[OS_MAX_PATH_LEN];
3939

40-
char* g_devName = "/ramdev3";
41-
char* g_mntName = "/drive3";
40+
const char* g_devName = "/ramdev3";
41+
const char* g_mntName = "/drive3";
4242

4343
/*--------------------------------------------------------------------------------*
4444
** External function prototypes

src/unit-tests/osfilesys-test/ut_osfilesys_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int32 g_blkSize = UT_OS_FS_BLOCK_SIZE;
3737
int32 g_blkCnt = UT_OS_FS_MAX_BLOCKS;
3838

3939
int32 g_skipTestCase = -1;
40-
char* g_skipTestCaseResult = " ";
40+
const char* g_skipTestCaseResult = " ";
4141

4242
char g_fsLongName[OS_MAX_PATH_LEN+5];
4343
char g_physDriveName[OS_MAX_PATH_LEN];

src/unit-tests/ostimer-test/ut_ostimer_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ extern UT_OsLogInfo_t g_logInfo;
2929
**--------------------------------------------------------------------------------*/
3030

3131
int32 g_skipTestCase = -1;
32-
char* g_skipTestCaseResult = " ";
32+
const char* g_skipTestCaseResult = " ";
3333

34-
char* g_timerNames[UT_OS_TIMER_LIST_LEN];
34+
const char* g_timerNames[UT_OS_TIMER_LIST_LEN];
3535
char g_longTimerName[OS_MAX_API_NAME+5];
3636

3737
uint32 g_cbLoopCntMax = 5;

0 commit comments

Comments
 (0)