Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix #3, Add enum to remove magic number error codes from GetDwellData() #38

Conversation

thnkslprpt
Copy link
Contributor

Checklist

Describe the contribution
Fixes #3
Adds enum to represent error return codes from dwell address read functions.

Testing performed
GitHub CI actions (incl. build + run, MD unit tests) all passing successfully.

Expected behavior changes
No change in logic.
Removes magic number error codes, making error types easier to identify.

Contributor Info
Avi Weiss @thnkslprpt

@@ -158,27 +158,27 @@
switch (NumBytes)
{
case 1:
if (CFE_PSP_MemRead8(DwellAddress, (uint8 *)&MemReadVal) != CFE_SUCCESS)
if (CFE_PSP_MemRead8(DwellAddress, (uint8 *)&MemReadVal) != CFE_PSP_SUCCESS)

Check warning

Code scanning / CodeQL-coding-standard

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
}
break;
case 2:
if (CFE_PSP_MemRead16(DwellAddress, (uint16 *)&MemReadVal) != CFE_SUCCESS)
if (CFE_PSP_MemRead16(DwellAddress, (uint16 *)&MemReadVal) != CFE_PSP_SUCCESS)

Check warning

Code scanning / CodeQL-coding-standard

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
}
break;
case 4:
if (CFE_PSP_MemRead32(DwellAddress, &MemReadVal) != CFE_SUCCESS)
if (CFE_PSP_MemRead32(DwellAddress, &MemReadVal) != CFE_PSP_SUCCESS)

Check warning

Code scanning / CodeQL-coding-standard

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
@dzbaker
Copy link
Contributor

dzbaker commented Oct 27, 2022

CCB 27 October 2022: Approved pending workflow failure resolution.

@dzbaker dzbaker added this to the Fornax milestone Nov 21, 2022
@dzbaker dzbaker modified the milestones: Fornax, Equuleus Dec 7, 2022
@thnkslprpt thnkslprpt force-pushed the fix-3-remove-magic-number-error-codes-in-getdwelldata branch from 2ce471c to 48ba9eb Compare March 14, 2023 07:42
@thnkslprpt
Copy link
Contributor Author

CCB 27 October 2022: Approved pending workflow failure resolution.

All passing now @dzbaker ;-)

@dzbaker dzbaker merged commit 116d298 into nasa:main Mar 14, 2023
@thnkslprpt thnkslprpt deleted the fix-3-remove-magic-number-error-codes-in-getdwelldata branch March 14, 2023 11:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider using an enum for MD error codes
2 participants