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 #113, Use size_t for size parameters and variables #114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thnkslprpt
Copy link
Contributor

@thnkslprpt thnkslprpt commented Jun 14, 2023

Checklist

Describe the contribution

  • Fixes Use size_t for size parameters/variables #113
    • Updated a few parameters and local variables which represent size to use the more expressive size_t typedef.
      • DS_TableEntryUnused() parameter BufferSize was signed previous to this change, but it is actually used in DS with size_t types being passed in to that parameter
      • Updated loop counter variable i in DS_TableEntryUnused() to unsigned for clarity/defensiveness

Note: there is a signed/unsigned comparison in DS_FileWriteData(), but I know there are many other cases of this in cFS currently.

Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.).

Expected behavior changes
No change to overall behavior.
Code is more compliant with relevant coding standards (JPL, MISRA etc. which all prefer the more expressive typedefs where possible).

Contributor Info
Avi Weiss @thnkslprpt

@@ -340,7 +340,7 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void DS_FileWriteData(int32 FileIndex, const void *FileData, uint32 DataLength)
void DS_FileWriteData(int32 FileIndex, const void *FileData, size_t DataLength)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@@ -639,11 +639,11 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool DS_TableEntryUnused(const void *TableEntry, int32 BufferSize)
bool DS_TableEntryUnused(const void *TableEntry, size_t BufferSize)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@thnkslprpt thnkslprpt force-pushed the fix-113-use-size-t-for-size-parameters-and-variables branch from 55a463d to e4be2f2 Compare June 15, 2023 08:03
@thnkslprpt thnkslprpt force-pushed the fix-113-use-size-t-for-size-parameters-and-variables branch from e4be2f2 to 59fa75d Compare April 19, 2024 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use size_t for size parameters/variables
2 participants