Skip to content

Commit

Permalink
Merge pull request #56 from thnkslprpt/fix-54-update-initializations-…
Browse files Browse the repository at this point in the history
…causing-cppcheck-failure

Fix #54, Update initializations causing Cppcheck failure
  • Loading branch information
dzbaker authored Jan 12, 2023
2 parents db5717d + 5a447ae commit b824250
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 46 deletions.
7 changes: 4 additions & 3 deletions fsw/src/mm_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extern MM_AppData_t MM_AppData;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_PeekCmd(const CFE_SB_Buffer_t *BufPtr)
{
bool Valid = true;
bool Valid;
MM_PeekCmd_t *CmdPtr;
cpuaddr SrcAddress = 0;
uint16 ExpectedLength = sizeof(MM_PeekCmd_t);
Expand Down Expand Up @@ -186,8 +186,8 @@ bool MM_PeekMem(const MM_PeekCmd_t *CmdPtr, cpuaddr SrcAddress)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_DumpMemToFileCmd(const CFE_SB_Buffer_t *BufPtr)
{
bool Valid = false;
int32 OS_Status = OS_SUCCESS;
bool Valid = false;
int32 OS_Status;
osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED;
cpuaddr SrcAddress = 0;
MM_DumpMemToFileCmd_t * CmdPtr;
Expand Down Expand Up @@ -570,6 +570,7 @@ bool MM_FillDumpInEventBuffer(cpuaddr SrcAddress, const MM_DumpInEventCmd_t *Cmd
#if defined(MM_OPT_CODE_MEM8_MEMTYPE) || defined(MM_OPT_CODE_MEM16_MEMTYPE) || defined(MM_OPT_CODE_MEM32_MEMTYPE)
uint32 i;
#endif
/* cppcheck-suppress unusedVariable */
int32 PSP_Status;
bool Valid = true;

Expand Down
8 changes: 4 additions & 4 deletions fsw/src/mm_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ bool MM_PokeEeprom(const MM_PokeCmd_t *CmdPtr, cpuaddr DestAddress)
bool MM_LoadMemWIDCmd(const CFE_SB_Buffer_t *BufPtr)
{
MM_LoadMemWIDCmd_t *CmdPtr;
uint32 ComputedCRC = 0;
uint32 ComputedCRC;
cpuaddr DestAddress = 0;
uint16 ExpectedLength = sizeof(MM_LoadMemWIDCmd_t);
bool CmdResult = false;
Expand Down Expand Up @@ -361,9 +361,9 @@ bool MM_LoadMemWIDCmd(const CFE_SB_Buffer_t *BufPtr)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_LoadMemFromFileCmd(const CFE_SB_Buffer_t *BufPtr)
{
bool Valid = false;
osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED;
int32 OS_Status = OS_SUCCESS;
bool Valid = false;
osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED;
int32 OS_Status;
cpuaddr DestAddress = 0;
MM_LoadMemFromFileCmd_t *CmdPtr;
CFE_FS_Header_t CFEFileHeader;
Expand Down
30 changes: 15 additions & 15 deletions fsw/src/mm_mem16.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ extern MM_AppData_t MM_AppData;
bool MM_LoadMem16FromFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader,
cpuaddr DestAddress)
{
uint32 i = 0;
int32 ReadLength = 0;
uint32 i;
int32 ReadLength;
int32 PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
Expand Down Expand Up @@ -134,10 +134,10 @@ bool MM_LoadMem16FromFile(osal_id_t FileHandle, const char *FileName, const MM_L
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_DumpMem16ToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader)
{
bool Valid = true;
int32 OS_Status = OS_ERROR;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i = 0;
bool Valid = true;
int32 OS_Status;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint16 *DataPointer16 = (uint16 *)(FileHeader->SymAddress.Offset);
Expand Down Expand Up @@ -220,15 +220,15 @@ bool MM_DumpMem16ToFile(osal_id_t FileHandle, const char *FileName, const MM_Loa
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_FillMem16(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr)
{
uint32 i = 0;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint32 NewBytesRemaining = 0;
uint16 FillPattern16 = (uint16)CmdPtr->FillPattern;
uint16 *DataPointer16 = (uint16 *)DestAddress;
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;
uint32 i;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint32 NewBytesRemaining;
uint16 FillPattern16 = (uint16)CmdPtr->FillPattern;
uint16 *DataPointer16 = (uint16 *)DestAddress;
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;

/* Check fill size and warn if not a multiple of 2 */
if ((BytesRemaining % 2) != 0)
Expand Down
30 changes: 15 additions & 15 deletions fsw/src/mm_mem32.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ extern MM_AppData_t MM_AppData;
bool MM_LoadMem32FromFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader,
cpuaddr DestAddress)
{
uint32 i = 0;
int32 ReadLength = 0;
uint32 i;
int32 ReadLength;
int32 PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
Expand Down Expand Up @@ -134,10 +134,10 @@ bool MM_LoadMem32FromFile(osal_id_t FileHandle, const char *FileName, const MM_L
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_DumpMem32ToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader)
{
bool Valid = true;
int32 OS_Status = OS_ERROR;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i = 0;
bool Valid = true;
int32 OS_Status;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint32 *DataPointer32 = (uint32 *)(FileHeader->SymAddress.Offset);
Expand Down Expand Up @@ -221,15 +221,15 @@ bool MM_DumpMem32ToFile(osal_id_t FileHandle, const char *FileName, const MM_Loa
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_FillMem32(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr)
{
uint32 i = 0;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint32 NewBytesRemaining = 0;
uint32 FillPattern32 = CmdPtr->FillPattern;
uint32 *DataPointer32 = (uint32 *)(DestAddress);
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;
uint32 i;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint32 NewBytesRemaining;
uint32 FillPattern32 = CmdPtr->FillPattern;
uint32 *DataPointer32 = (uint32 *)(DestAddress);
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;

/* Check fill size and warn if not a multiple of 4 */
if ((BytesRemaining % 4) != 0)
Expand Down
14 changes: 7 additions & 7 deletions fsw/src/mm_mem8.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ extern MM_AppData_t MM_AppData;
bool MM_LoadMem8FromFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader,
cpuaddr DestAddress)
{
uint32 i = 0;
int32 ReadLength = 0;
uint32 i;
int32 ReadLength;
int32 PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
Expand Down Expand Up @@ -134,10 +134,10 @@ bool MM_LoadMem8FromFile(osal_id_t FileHandle, const char *FileName, const MM_Lo
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_DumpMem8ToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader)
{
bool Valid = true;
int32 OS_Status = OS_ERROR;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i = 0;
bool Valid = true;
int32 OS_Status;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint8 *DataPointer8 = (uint8 *)(FileHeader->SymAddress.Offset);
Expand Down Expand Up @@ -220,7 +220,7 @@ bool MM_DumpMem8ToFile(osal_id_t FileHandle, const char *FileName, const MM_Load
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_FillMem8(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr)
{
uint32 i = 0;
uint32 i;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/mm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ bool MM_Verify16Aligned(cpuaddr Address, uint32 Size)

bool MM_ResolveSymAddr(MM_SymAddr_t *SymAddr, cpuaddr *ResolvedAddr)
{
bool Valid = false;
int32 OS_Status = OS_SUCCESS;
bool Valid = false;
int32 OS_Status;

/*
** NUL terminate the very end of the symbol name string array as a
Expand Down

0 comments on commit b824250

Please sign in to comment.