zserio
zserio copied to clipboard
Fix for MISRA C++ 2023 rule MISRACPP2023-8_2_5-a 'reinterpret_cast' should not be used
Zserio version and language Zserio: latest from master Commit date: 6 days ago (6/4/2024 7:12:28 PM) Commit hash: https://github.com/ndsev/zserio/commit/b8cc6c0df51cfa60740421c719f3dabfd88e0fb7
Describe the bug 2 Misra warnings are getting reported for rule MISRACPP2023-8_2_5-a
- if (!stream.write(reinterpret_cast<const char*>(buffer), static_caststd::streamsize(byteSize)))
- if (!stream.read(reinterpret_cast<char*>(bitBuffer.getBuffer()), static_caststd::streamsize(bitBuffer.getByteSize())))
| SNo | Rule | Severity | Message | Filename | Linenumber |
|---|---|---|---|---|---|
| 1255 | MISRACPP2023-8_2_5-a | 2 | reinterpret_cast' should not be used | zserio_runtime/zserio/FileUtil.cpp | 49 |
| 1247 | MISRACPP2023-8_2_5-a | 2 | 'reinterpret_cast' should not be used | zserio_runtime/zserio/FileUtil.cpp | 19 |
Please check possibility of fixing the same.
Steps to reproduce the behavior: SCA run using MISRA 2023 configuration.
Expected behavior No SCA warnings for MISRA 2023 ruleset
Additional context N.A
@Roland-Homeier @mikir FYI.
This is a duplicate to #586.