-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #67, Use size_t
for 'size' variables
#68
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,8 +87,7 @@ typedef struct | |
{ | ||
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ | ||
|
||
uint8 DataSize; /**< \brief Size of the data to be read */ | ||
uint8 Padding[3]; /**< \brief Structure padding */ | ||
size_t DataSize; /**< \brief Size of the data to be read */ | ||
MM_MemType_t MemType; /**< \brief Memory type to peek data from */ | ||
MM_SymAddr_t SrcSymAddress; /**< \brief Symbolic source peek address */ | ||
} MM_PeekCmd_t; | ||
|
@@ -102,8 +101,7 @@ typedef struct | |
{ | ||
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ | ||
|
||
uint8 DataSize; /**< \brief Size of the data to be written */ | ||
uint8 Padding1[3]; /**< \brief Structure padding */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Padding omission looks appropriate given the new variable, DataSize. |
||
size_t DataSize; /**< \brief Size of the data to be written */ | ||
MM_MemType_t MemType; /**< \brief Memory type to poke data to */ | ||
uint32 Data; /**< \brief Data to be written */ | ||
uint8 Padding2[4]; /**< \brief Structure padding */ | ||
|
@@ -253,7 +251,7 @@ typedef struct | |
MM_MemType_t MemType; /**< \brief Memory type for last command */ | ||
cpuaddr Address; /**< \brief Fully resolved address used for last command */ | ||
uint32 DataValue; /**< \brief Last command data (fill pattern or peek/poke value) */ | ||
uint32 BytesProcessed; /**< \brief Bytes processed for last command */ | ||
size_t BytesProcessed; /**< \brief Bytes processed for last command */ | ||
char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of the data file used for last command, where applicable */ | ||
} MM_HkPacket_t; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ bool MM_PeekCmd(const CFE_SB_Buffer_t *BufPtr) | |
bool Valid; | ||
const MM_PeekCmd_t *CmdPtr; | ||
cpuaddr SrcAddress = 0; | ||
uint16 ExpectedLength = sizeof(MM_PeekCmd_t); | ||
size_t ExpectedLength = sizeof(MM_PeekCmd_t); | ||
bool Result = false; | ||
MM_SymAddr_t SrcSymAddress; | ||
|
||
|
@@ -103,9 +103,9 @@ bool MM_PeekMem(const MM_PeekCmd_t *CmdPtr, cpuaddr SrcAddress) | |
uint16 WordValue = 0; | ||
uint32 DWordValue = 0; | ||
int32 PSP_Status = 0; | ||
uint32 BytesProcessed = 0; | ||
size_t BytesProcessed = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Later on line 168, this gets assigned to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes Justin - great addition. |
||
uint32 DataValue = 0; | ||
uint8 DataSize = 0; | ||
size_t DataSize = 0; | ||
uint32 EventID = 0; | ||
|
||
/* | ||
|
@@ -169,14 +169,14 @@ bool MM_PeekMem(const MM_PeekCmd_t *CmdPtr, cpuaddr SrcAddress) | |
MM_AppData.HkPacket.DataValue = DataValue; | ||
|
||
CFE_EVS_SendEvent(EventID, CFE_EVS_EventType_INFORMATION, | ||
"Peek Command: Addr = %p Size = %d bits Data = 0x%08X", (void *)SrcAddress, DataSize, | ||
(unsigned int)DataValue); | ||
"Peek Command: Addr = %p Size = %u bits Data = 0x%08X", (void *)SrcAddress, | ||
(unsigned int)DataSize, (unsigned int)DataValue); | ||
} | ||
else | ||
{ | ||
CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR, | ||
"PSP read memory error: RC=%d, Address=%p, MemType=MEM%d", PSP_Status, (void *)SrcAddress, | ||
DataSize); | ||
"PSP read memory error: RC=%d, Address=%p, MemType=MEM%u", PSP_Status, (void *)SrcAddress, | ||
(unsigned int)DataSize); | ||
} | ||
|
||
return ValidPeek; | ||
|
@@ -198,7 +198,7 @@ bool MM_DumpMemToFileCmd(const CFE_SB_Buffer_t *BufPtr) | |
const MM_DumpMemToFileCmd_t *CmdPtr; | ||
CFE_FS_Header_t CFEFileHeader; | ||
MM_LoadDumpFileHeader_t MMFileHeader; | ||
uint16 ExpectedLength = sizeof(MM_DumpMemToFileCmd_t); | ||
size_t ExpectedLength = sizeof(MM_DumpMemToFileCmd_t); | ||
|
||
/* Verify command packet length */ | ||
if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) | ||
|
@@ -376,8 +376,8 @@ bool MM_DumpMemToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadD | |
bool ValidDump = false; | ||
int32 OS_Status; | ||
uint32 BytesRemaining = FileHeader->NumOfBytes; | ||
uint32 BytesProcessed = 0; | ||
uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; | ||
size_t BytesProcessed = 0; | ||
size_t SegmentSize = MM_MAX_DUMP_DATA_SEG; | ||
uint8 *SourcePtr = (uint8 *)(FileHeader->SymAddress.Offset); | ||
uint8 *ioBuffer = (uint8 *)&MM_AppData.DumpBuffer[0]; | ||
|
||
|
@@ -407,8 +407,8 @@ bool MM_DumpMemToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadD | |
{ | ||
BytesRemaining = 0; | ||
CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR, | ||
"OS_write error received: RC = %d, Expected = %d, File = '%s'", OS_Status, | ||
(int)SegmentSize, FileName); | ||
"OS_write error received: RC = %d, Expected = %u, File = '%s'", OS_Status, | ||
(unsigned int)SegmentSize, FileName); | ||
} | ||
} | ||
|
||
|
@@ -461,8 +461,8 @@ bool MM_WriteFileHeaders(const char *FileName, osal_id_t FileHandle, CFE_FS_Head | |
/* We either got an error or didn't read as much data as expected */ | ||
Valid = false; | ||
CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR, | ||
"OS_write error received: RC = %d Expected = %d File = '%s'", OS_Status, | ||
(int)sizeof(MM_LoadDumpFileHeader_t), FileName); | ||
"OS_write error received: RC = %d Expected = %u File = '%s'", OS_Status, | ||
(unsigned int)sizeof(MM_LoadDumpFileHeader_t), FileName); | ||
|
||
} /* end OS_write if */ | ||
|
||
|
@@ -483,7 +483,7 @@ bool MM_DumpInEventCmd(const CFE_SB_Buffer_t *BufPtr) | |
uint32 i; | ||
int32 EventStringTotalLength = 0; | ||
cpuaddr SrcAddress = 0; | ||
uint16 ExpectedLength = sizeof(MM_DumpInEventCmd_t); | ||
size_t ExpectedLength = sizeof(MM_DumpInEventCmd_t); | ||
uint8 * BytePtr; | ||
char TempString[MM_DUMPINEVENT_TEMP_CHARS]; | ||
const char HeaderString[] = "Memory Dump: "; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Padding omission looks appropriate given the new variable, DataSize.