Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ECSS Services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AcubeSat-OBC
ECSS Services
Commits
6baa4696
Unverified
Commit
6baa4696
authored
5 years ago
by
Grigoris Pavlakis
Committed by
kongr45gpen
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix some of the last MISRA infractions
Finish fixing Message errors Fix 3 of the last 4 errors of TimeHelper
parent
44fabef2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
src/Helpers/TimeHelper.cpp
+6
-6
6 additions, 6 deletions
src/Helpers/TimeHelper.cpp
src/Message.cpp
+5
-5
5 additions, 5 deletions
src/Message.cpp
with
12 additions
and
11 deletions
CMakeLists.txt
+
1
−
0
View file @
6baa4696
...
@@ -11,6 +11,7 @@ add_custom_target(check
...
@@ -11,6 +11,7 @@ add_custom_target(check
COMMAND ./cppcheck.sh
COMMAND ./cppcheck.sh
COMMAND ./vera.sh
COMMAND ./vera.sh
COMMAND ./clang-tidy.sh
COMMAND ./clang-tidy.sh
COMMAND ./cppcheck-misra.sh
WORKING_DIRECTORY
"
${
PROJECT_SOURCE_DIR
}
/ci"
)
WORKING_DIRECTORY
"
${
PROJECT_SOURCE_DIR
}
/ci"
)
# Specify the .cpp files common across all targets
# Specify the .cpp files common across all targets
...
...
This diff is collapsed.
Click to expand it.
src/Helpers/TimeHelper.cpp
+
6
−
6
View file @
6baa4696
...
@@ -122,14 +122,14 @@ uint64_t TimeHelper::generateCDStimeFormat(TimeAndDate &TimeInfo) {
...
@@ -122,14 +122,14 @@ uint64_t TimeHelper::generateCDStimeFormat(TimeAndDate &TimeInfo) {
}
}
TimeAndDate
TimeHelper
::
parseCDStimeFormat
(
const
uint8_t
*
data
)
{
TimeAndDate
TimeHelper
::
parseCDStimeFormat
(
const
uint8_t
*
data
)
{
uint16_t
elapsedDays
=
(
static_cast
<
uint16_t
>
(
data
[
0
]))
<<
8
)
|
(
static_cast
<
uint16_t
>
uint16_t
elapsedDays
=
(
(
static_cast
<
uint16_t
>
(
data
[
0
]))
<<
8
)
|
(
static_cast
<
uint16_t
>
(
data
[
1
]));
(
data
[
1
]));
uint32_t
msOfDay
=
(
static_cast
<
uint32_t
>
(
data
[
2
]))
<<
24
|
uint32_t
msOfDay
=
(
(
static_cast
<
uint32_t
>
(
data
[
2
]))
<<
24
)
|
(
static_cast
<
uint32_t
>
(
data
[
3
]))
<<
16
|
(
(
static_cast
<
uint32_t
>
(
data
[
3
]))
)
<<
16
|
(
static_cast
<
uint32_t
>
(
data
[
4
]))
<<
8
|
(
(
static_cast
<
uint32_t
>
(
data
[
4
]))
)
<<
8
|
static_cast
<
uint32_t
>
(
data
[
5
]);
(
static_cast
<
uint32_t
>
(
data
[
5
])
)
;
uint32_t
seconds
=
elapsedDays
*
SECONDS_PER_DAY
+
msOfDay
/
1000
;
uint32_t
seconds
=
(
elapsedDays
*
SECONDS_PER_DAY
)
+
(
msOfDay
/
1000
u
)
;
return
secondsToUTC
(
seconds
);
return
secondsToUTC
(
seconds
);
}
}
This diff is collapsed.
Click to expand it.
src/Message.cpp
+
5
−
5
View file @
6baa4696
...
@@ -86,7 +86,7 @@ uint16_t Message::readBits(uint8_t numBits) {
...
@@ -86,7 +86,7 @@ uint16_t Message::readBits(uint8_t numBits) {
if
((
currentBit
+
numBits
)
>=
8
)
{
if
((
currentBit
+
numBits
)
>=
8
)
{
uint8_t
bitsToAddNow
=
static_cast
<
uint8_t
>
(
8
-
currentBit
);
uint8_t
bitsToAddNow
=
static_cast
<
uint8_t
>
(
8
-
currentBit
);
uint8_t
mask
=
((
1
<<
bitsToAddNow
)
-
1
);
uint8_t
mask
=
((
1
u
<<
bitsToAddNow
)
-
1
u
);
uint8_t
maskedData
=
data
[
readPosition
]
&
mask
;
uint8_t
maskedData
=
data
[
readPosition
]
&
mask
;
value
|=
maskedData
<<
(
numBits
-
bitsToAddNow
);
value
|=
maskedData
<<
(
numBits
-
bitsToAddNow
);
...
@@ -113,7 +113,7 @@ uint8_t Message::readByte() {
...
@@ -113,7 +113,7 @@ uint8_t Message::readByte() {
}
}
uint16_t
Message
::
readHalfword
()
{
uint16_t
Message
::
readHalfword
()
{
ASSERT_REQUEST
(
readPosition
+
2
<=
ECSS_MAX_MESSAGE_SIZE
,
ErrorHandler
::
MessageTooShort
);
ASSERT_REQUEST
(
(
readPosition
+
2
)
<=
ECSS_MAX_MESSAGE_SIZE
,
ErrorHandler
::
MessageTooShort
);
uint16_t
value
=
(
data
[
readPosition
]
<<
8
)
|
data
[
readPosition
+
1
];
uint16_t
value
=
(
data
[
readPosition
]
<<
8
)
|
data
[
readPosition
+
1
];
readPosition
+=
2
;
readPosition
+=
2
;
...
@@ -122,7 +122,7 @@ uint16_t Message::readHalfword() {
...
@@ -122,7 +122,7 @@ uint16_t Message::readHalfword() {
}
}
uint32_t
Message
::
readWord
()
{
uint32_t
Message
::
readWord
()
{
ASSERT_REQUEST
(
readPosition
+
4
<=
ECSS_MAX_MESSAGE_SIZE
,
ErrorHandler
::
MessageTooShort
);
ASSERT_REQUEST
(
(
readPosition
+
4
)
<=
ECSS_MAX_MESSAGE_SIZE
,
ErrorHandler
::
MessageTooShort
);
uint32_t
value
=
(
data
[
readPosition
]
<<
24
)
|
(
data
[
readPosition
+
1
]
<<
16
)
|
uint32_t
value
=
(
data
[
readPosition
]
<<
24
)
|
(
data
[
readPosition
+
1
]
<<
16
)
|
(
data
[
readPosition
+
2
]
<<
8
)
|
data
[
readPosition
+
3
];
(
data
[
readPosition
+
2
]
<<
8
)
|
data
[
readPosition
+
3
];
...
@@ -132,7 +132,7 @@ uint32_t Message::readWord() {
...
@@ -132,7 +132,7 @@ uint32_t Message::readWord() {
}
}
void
Message
::
readString
(
char
*
string
,
uint8_t
size
)
{
void
Message
::
readString
(
char
*
string
,
uint8_t
size
)
{
ASSERT_REQUEST
(
readPosition
+
size
<=
ECSS_MAX_MESSAGE_SIZE
,
ErrorHandler
::
MessageTooShort
);
ASSERT_REQUEST
(
(
readPosition
+
size
)
<=
ECSS_MAX_MESSAGE_SIZE
,
ErrorHandler
::
MessageTooShort
);
ASSERT_REQUEST
(
size
<
ECSS_MAX_STRING_SIZE
,
ErrorHandler
::
StringTooShort
);
ASSERT_REQUEST
(
size
<
ECSS_MAX_STRING_SIZE
,
ErrorHandler
::
StringTooShort
);
memcpy
(
string
,
data
+
readPosition
,
size
);
memcpy
(
string
,
data
+
readPosition
,
size
);
...
@@ -142,7 +142,7 @@ void Message::readString(char *string, uint8_t size) {
...
@@ -142,7 +142,7 @@ void Message::readString(char *string, uint8_t size) {
}
}
void
Message
::
readString
(
uint8_t
*
string
,
uint16_t
size
)
{
void
Message
::
readString
(
uint8_t
*
string
,
uint16_t
size
)
{
ASSERT_REQUEST
(
readPosition
+
size
<=
ECSS_MAX_MESSAGE_SIZE
,
ErrorHandler
::
MessageTooShort
);
ASSERT_REQUEST
(
(
readPosition
+
size
)
<=
ECSS_MAX_MESSAGE_SIZE
,
ErrorHandler
::
MessageTooShort
);
ASSERT_REQUEST
(
size
<
ECSS_MAX_STRING_SIZE
,
ErrorHandler
::
StringTooShort
);
ASSERT_REQUEST
(
size
<
ECSS_MAX_STRING_SIZE
,
ErrorHandler
::
StringTooShort
);
memcpy
(
string
,
data
+
readPosition
,
size
);
memcpy
(
string
,
data
+
readPosition
,
size
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment