Skip to content
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 #217, use size_t in PSP stubs #219

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void *PCS_malloc(size_t sz)
cpuaddr PoolEnd;
cpuaddr NextBlock;
size_t NextSize;
uint32 PoolSize;
size_t PoolSize;
uint32 CallCnt;
struct MPOOL_REC *Rec;

Expand Down Expand Up @@ -156,7 +156,7 @@ void PCS_free(void *ptr)
int32 Status;
cpuaddr BlockAddr;
void *PoolPtr;
uint32 PoolSize;
size_t PoolSize;
struct MPOOL_REC *Rec;

/*
Expand Down
40 changes: 27 additions & 13 deletions ut-stubs/ut_psp_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite,
uint32 NumBytes)
{
uint8 *BufPtr;
uint32 CdsSize;
uint32 Position;
size_t CdsSize;
size_t Position;
int32 status;

status = UT_DEFAULT_IMPL(CFE_PSP_WriteToCDS);
Expand Down Expand Up @@ -276,8 +276,8 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead,
uint32 NumBytes)
{
uint8 *BufPtr;
uint32 CdsSize;
uint32 Position;
size_t CdsSize;
size_t Position;
int32 status;

status = UT_DEFAULT_IMPL(CFE_PSP_ReadFromCDS);
Expand Down Expand Up @@ -313,14 +313,14 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead,
int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS)
{
int32 status;
void *BufPtr;
uint32 Position;
size_t TempSize;

status = UT_DEFAULT_IMPL(CFE_PSP_GetCDSSize);

if (status >= 0)
{
UT_GetDataBuffer(UT_KEY(CFE_PSP_GetCDSSize), &BufPtr, SizeOfCDS, &Position);
UT_GetDataBuffer(UT_KEY(CFE_PSP_GetCDSSize), NULL, &TempSize, NULL);
*SizeOfCDS = TempSize;
}

return status;
Expand All @@ -345,13 +345,17 @@ int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS)
int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk)
{
int32 status;
uint32 Position;
size_t TempSize;
void *TempAddr;

status = UT_DEFAULT_IMPL(CFE_PSP_GetVolatileDiskMem);

if (status >= 0)
{
UT_GetDataBuffer(UT_KEY(CFE_PSP_GetVolatileDiskMem), (void**)PtrToVolDisk, SizeOfVolDisk, &Position);
UT_GetDataBuffer(UT_KEY(CFE_PSP_GetVolatileDiskMem), &TempAddr, &TempSize, NULL);

*PtrToVolDisk = (cpuaddr)TempAddr;
*SizeOfVolDisk = TempSize;
}

return status;
Expand Down Expand Up @@ -426,13 +430,17 @@ void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32* Tbl)
int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea)
{
int32 status;
uint32 Position;
size_t TempSize;
void *TempAddr;

status = UT_DEFAULT_IMPL(CFE_PSP_GetResetArea);

if (status >= 0)
{
UT_GetDataBuffer(UT_KEY(CFE_PSP_GetResetArea), (void**)PtrToResetArea, SizeOfResetArea, &Position);
UT_GetDataBuffer(UT_KEY(CFE_PSP_GetResetArea), &TempAddr, &TempSize, NULL);

*PtrToResetArea = (cpuaddr)TempAddr;
*SizeOfResetArea = TempSize;
}

return status;
Expand Down Expand Up @@ -553,19 +561,25 @@ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment,
{
static uint32 LocalTextSegment;
int32 status;
uint32 Position;
void *TempAddr;
size_t TempSize;

status = UT_DEFAULT_IMPL(CFE_PSP_GetCFETextSegmentInfo);

if (status >= 0)
{
UT_GetDataBuffer(UT_KEY(CFE_PSP_GetCFETextSegmentInfo), (void**)PtrToCFESegment, SizeOfCFESegment, &Position);
UT_GetDataBuffer(UT_KEY(CFE_PSP_GetCFETextSegmentInfo), &TempAddr, &TempSize, NULL);
if (*PtrToCFESegment == 0)
{
/* Backup -- Set the pointer and size to anything */
*PtrToCFESegment = (cpuaddr)&LocalTextSegment;
*SizeOfCFESegment = sizeof(LocalTextSegment);
}
else
{
*PtrToCFESegment = (cpuaddr)TempAddr;
*SizeOfCFESegment = TempSize;
}
}

return status;
Expand Down