Closes #16
This commit is contained in:
1 parent
7022c84941
commit
c3d3bd51fb
72 files changed
+3703
-2484
No files matched your search
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include "dbc_statement_handler.h"
|
||||
#include "text_utils.h"
|
||||
#include "signal_layout.h"
|
||||
#include <charconv>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
@@ -356,13 +357,9 @@ void DbcSignalHandler::Handle(const std::string &line, DbcParseContext &context)
|
||||
if (FindSignalByName(*context.currentFrame, signal.name) != nullptr)
|
||||
throw std::runtime_error("Duplicate signal name '" + signal.name +
|
||||
"' in frame '" + context.currentFrame->name + "'.");
|
||||
const std::uint64_t payloadBits = static_cast<std::uint64_t>(context.currentFrame->dlc) * 8U;
|
||||
std::uint64_t bit = signal.startBit;
|
||||
for (std::uint32_t index = 0U; index < signal.length; ++index) {
|
||||
if (bit >= payloadBits)
|
||||
throw std::runtime_error("Signal exceeds the frame payload length.");
|
||||
bit = NextSignalBit(bit, signal.isLittleEndian);
|
||||
}
|
||||
if (!IsValidSignalLayout(signal.startBit, signal.length, signal.isLittleEndian,
|
||||
context.currentFrame->dlc))
|
||||
throw std::runtime_error("Signal exceeds the frame payload length.");
|
||||
context.currentFrame->signals.push_back(std::move(signal));
|
||||
context.signalLines.back().push_back(context.lineNumber);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user