Skip to content

Commit

Permalink
Fix #15: warnings in OSAL unit test code
Browse files Browse the repository at this point in the history
Qualify all pointers referring to string literals as `const`
Eliminate unused local variables
Add missing local function prototypes.
  • Loading branch information
jphickey committed Sep 18, 2019
1 parent d0f1a39 commit ba82d52
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/unit-tests/oscore-test/ut_oscore_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ extern UT_OsLogInfo_t g_logInfo;
**--------------------------------------------------------------------------------*/

int32 g_skipTestCase = -1;
char* g_skipTestCaseResult = " ";
const char* g_skipTestCaseResult = " ";

char* g_task_names[UT_OS_TASK_LIST_LEN];
const char* g_task_names[UT_OS_TASK_LIST_LEN];
char g_long_task_name[OS_MAX_API_NAME+5];

/*--------------------------------------------------------------------------------*
Expand All @@ -49,6 +49,7 @@ void UT_os_setup_install_delete_handler_test(void);
void UT_os_init_task_exit_test(void);
void UT_os_init_task_delay_test(void);
void UT_os_init_task_set_priority_test(void);
void UT_os_init_task_register_test(void);
void UT_os_init_task_get_id_test(void);
void UT_os_init_task_get_id_by_name_test(void);
void UT_os_init_task_get_info_test(void);
Expand Down
3 changes: 1 addition & 2 deletions src/unit-tests/osfile-test/ut_osfile_dirio_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ char g_dirName[UT_OS_SM_TEXT_LEN];
char g_fileName[UT_OS_SM_TEXT_LEN];

char g_subdirNames[UT_OS_FILE_MAX_DIRS][UT_OS_SM_TEXT_LEN];
char* g_tgtSubdirs[UT_OS_FILE_MAX_DIRS] = {"subdir1", "subdir2"};
const char* g_tgtSubdirs[UT_OS_FILE_MAX_DIRS] = {"subdir1", "subdir2"};

char g_dirItems[UT_OS_FILE_MAX_DIRS][UT_OS_SM_TEXT_LEN];

Expand Down Expand Up @@ -520,7 +520,6 @@ void UT_os_readdir_test()
{
int32 idx=0;
uint32 dirh;
os_dirent_t* dirEntry=NULL;
UT_OsApiInfo_t apiInfo;
const char* testDesc=NULL;

Expand Down
4 changes: 2 additions & 2 deletions src/unit-tests/osfile-test/ut_osfile_fileio_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,7 @@ void UT_os_outputtofile_test()
{
int32 idx=0;
UT_OsApiInfo_t apiInfo;
char* cmd=NULL;
const char* cmd=NULL;
const char* testDesc=NULL;

UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx)
Expand Down Expand Up @@ -2236,7 +2236,7 @@ void UT_os_getfdinfo_test()
UT_OsApiInfo_t apiInfo;
OS_file_prop_t fdProps;
const char* testDesc=NULL;
char* fileName="GetInfo_Nom.txt";
const char* fileName="GetInfo_Nom.txt";

UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx)

Expand Down
6 changes: 3 additions & 3 deletions src/unit-tests/osfile-test/ut_osfile_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ extern UT_OsLogInfo_t g_logInfo;
char* g_fsAddrPtr = NULL;

int32 g_skipTestCase = -1;
char* g_skipTestCaseResult = " ";
const char* g_skipTestCaseResult = " ";

char g_longPathName[OS_MAX_PATH_LEN+5];
char g_longFileName[OS_MAX_PATH_LEN];
char g_invalidPath[OS_MAX_PATH_LEN];

char* g_devName = "/ramdev3";
char* g_mntName = "/drive3";
const char* g_devName = "/ramdev3";
const char* g_mntName = "/drive3";

/*--------------------------------------------------------------------------------*
** External function prototypes
Expand Down
2 changes: 1 addition & 1 deletion src/unit-tests/osfilesys-test/ut_osfilesys_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int32 g_blkSize = UT_OS_FS_BLOCK_SIZE;
int32 g_blkCnt = UT_OS_FS_MAX_BLOCKS;

int32 g_skipTestCase = -1;
char* g_skipTestCaseResult = " ";
const char* g_skipTestCaseResult = " ";

char g_fsLongName[OS_MAX_PATH_LEN+5];
char g_physDriveName[OS_MAX_PATH_LEN];
Expand Down
4 changes: 2 additions & 2 deletions src/unit-tests/ostimer-test/ut_ostimer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ extern UT_OsLogInfo_t g_logInfo;
**--------------------------------------------------------------------------------*/

int32 g_skipTestCase = -1;
char* g_skipTestCaseResult = " ";
const char* g_skipTestCaseResult = " ";

char* g_timerNames[UT_OS_TIMER_LIST_LEN];
const char* g_timerNames[UT_OS_TIMER_LIST_LEN];
char g_longTimerName[OS_MAX_API_NAME+5];

uint32 g_cbLoopCntMax = 5;
Expand Down

0 comments on commit ba82d52

Please sign in to comment.