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 #7, added function to verify the given state of a file #54

Merged
merged 1 commit into from
Oct 3, 2022

Conversation

havencarlson
Copy link
Contributor

Checklist (Please check before submitting)

Describe the contribution
Fix #7, created function to verify the given state of a file or sends an error event message.

Testing performed
Unit testing

Expected behavior changes
no impact to behavior

System(s) tested on
Ubuntu 18.04

Contributor Info - All information REQUIRED for consideration of pull request
Haven Carlson - NASA

/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool FM_VerifyFileClosed(char *Filename, uint32 BufferSize, uint32 EventID, const char *CmdText)
bool FM_VerifyFileState(FM_File_States State, char *Filename, uint32 BufferSize, uint32 EventID, const char *CmdText)

Check notice

Code scanning / CodeQL-coding-standard

Long function without assertion

All functions of more than 10 lines should have at least one assertion.
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool FM_VerifyFileClosed(char *Filename, uint32 BufferSize, uint32 EventID, const char *CmdText)
bool FM_VerifyFileState(FM_File_States State, char *Filename, uint32 BufferSize, uint32 EventID, const char *CmdText)

Check notice

Code scanning / CodeQL-coding-standard

Function too long

FM_VerifyFileState has too many lines (98, while 60 are allowed).
Filename[BufferSize - 1] = '\0';
CFE_EVS_SendEvent((EventID + FM_FNAME_INVALID_EID_OFFSET), CFE_EVS_EventType_ERROR,
"%s error: filename is invalid: name = %s", CmdText, Filename);
CFE_EVS_SendEvent((EventID + ErrorCode), CFE_EVS_EventType_ERROR, Spec, CmdText, Filename);

Check failure

Code scanning / CodeQL-security

Non-constant format string

The format string argument to CFE_EVS_SendEvent should be constant to prevent security issues and other potential errors.
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.

Reduce redundant code in fm_cmd_utils.c
3 participants