Skip to content

Commit

Permalink
Merge pull request #1844 from zanzaben/fix1840_ResourceID_FindNext_nu…
Browse files Browse the repository at this point in the history
…ll_check

Fix #1840, Hotfix for strict resource IDs.
  • Loading branch information
astrogeco authored Aug 18, 2021
2 parents b8df511 + e879296 commit 41b0ea2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions modules/core_api/fsw/inc/cfe_resourceid.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ uint32 CFE_ResourceId_GetSerial(CFE_ResourceId_t ResourceId);
* @param[in] TableSize the maximum size of the target table
* @param[in] CheckFunc a function to check if the given ID is available
* @returns Next ID value which does not map to a valid entry
* @retval #CFE_RESOURCEID_UNDEFINED if no open slots.
* @retval #CFE_ES_BAD_ARGUMENT @copybrief CFE_ES_BAD_ARGUMENT
* @retval #CFE_RESOURCEID_UNDEFINED if no open slots or bad arguments.
*
*/
CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableSize,
Expand Down
2 changes: 1 addition & 1 deletion modules/resourceid/fsw/src/cfe_resourceid_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableS

if (CheckFunc == NULL)
{
return CFE_ES_BAD_ARGUMENT;
return CFE_RESOURCEID_UNDEFINED;
}

ResourceType = CFE_ResourceId_GetBase(StartId);
Expand Down
2 changes: 1 addition & 1 deletion modules/resourceid/ut-coverage/test_cfe_resourceid.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void TestResourceID(void)
CFE_ResourceId_ToInteger(Id));

Id = CFE_ResourceId_FindNext(LastId, 0, NULL);
UtAssert_True(CFE_ResourceId_Equal(Id, CFE_ES_BAD_ARGUMENT), "CFE_ResourceId_FindNext() bad input: id=%lx",
UtAssert_True(CFE_ResourceId_Equal(Id, CFE_RESOURCEID_UNDEFINED), "CFE_ResourceId_FindNext() bad input: id=%lx",
CFE_ResourceId_ToInteger(Id));

UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, RefBase, 1, NULL), CFE_ES_BAD_ARGUMENT);
Expand Down

0 comments on commit 41b0ea2

Please sign in to comment.