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 MISRA C 2012 deviations #92

Merged
merged 17 commits into from
Mar 5, 2024
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
3 changes: 2 additions & 1 deletion .github/.cSpellWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ decihours
Decihours
DECIHOURS
DNDEBUG
DUNITY
DSIGV
DUNITY
DUNITTEST
Ecjuve
EKHX
getpacketid
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
cmake -S test -B build/ \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_UNIT_TESTS=ON \
-DUNITTEST=ON \
chinglee-iot marked this conversation as resolved.
Show resolved Hide resolved
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG -DLOGGING_LEVEL_DEBUG=1'
make -C build/ all

Expand Down
10 changes: 10 additions & 0 deletions MISRA.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ _Ref 5.4.1_
in use and changing the name will break existing user projects. Thus, for
backwards compatibility, the macro is not modified and kept as is and the
deviation is suppressed.

_Ref 18.2.1_

- MISRA Rule 18.2 states that two pointers may only be subtracted if they point
chinglee-iot marked this conversation as resolved.
Show resolved Hide resolved
to elements of the same array. In this library, array of bytes are used to process
data. Functions which fill the arrays with data update an index to an offset.
To know the amount of data added to the array, the beginning address of the array has
to be subtracted from the index. It is manually verified that the index will always be
within bounds of the array. However, Coverity is flagging this as a deviation. Thus, we
are suppressing it.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ include paths required to build this library.

1. Go to the root directory of this repository.

1. Run the _cmake_ command: `cmake -S test -B build -DBUILD_UNIT_TESTS=ON`.
1. Run the _cmake_ command: `cmake -S test -B build -DUNITTEST=ON`.

1. Run this command to build the library and unit tests: `make -C build all`.

Expand Down
12 changes: 6 additions & 6 deletions source/include/sigv4_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@
*/
typedef struct SigV4DateTime
{
int32_t tm_year; /**< Year (1900 or later) */
int32_t tm_mon; /**< Month (1 to 12) */
int32_t tm_mday; /**< Day of Month (1 to 28/29/30/31) */
int32_t tm_hour; /**< Hour (0 to 23) */
int32_t tm_min; /**< Minutes (0 to 59) */
int32_t tm_sec; /**< Seconds (0 to 60) */
int32_t year; /**< Year (1900 or later) */
int32_t mon; /**< Month (1 to 12) */
int32_t mday; /**< Day of Month (1 to 28/29/30/31) */
int32_t hour; /**< Hour (0 to 23) */
int32_t min; /**< Minutes (0 to 59) */
int32_t sec; /**< Seconds (0 to 60) */
} SigV4DateTime_t;

/**
Expand Down
Loading
Loading