mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[traffxml] Fix erroneous parsing of event length
Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
@@ -341,7 +341,7 @@ struct TraffEvent
|
|||||||
{
|
{
|
||||||
EventClass m_class = EventClass::Invalid;
|
EventClass m_class = EventClass::Invalid;
|
||||||
EventType m_type = EventType::Invalid;
|
EventType m_type = EventType::Invalid;
|
||||||
std::optional<uint8_t> m_length;
|
std::optional<uint16_t> m_length;
|
||||||
std::optional<uint8_t> m_probability;
|
std::optional<uint8_t> m_probability;
|
||||||
std::optional<uint16_t> m_qDurationMins;
|
std::optional<uint16_t> m_qDurationMins;
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -122,13 +122,13 @@ const boost::bimap<std::string, EventType> kEventTypeMap = MakeBimap<std::string
|
|||||||
* @param attribute The XML attribute to retrieve.
|
* @param attribute The XML attribute to retrieve.
|
||||||
* @return `true` on success, `false` if the attribute is not set or does not contain an integer value.
|
* @return `true` on success, `false` if the attribute is not set or does not contain an integer value.
|
||||||
*/
|
*/
|
||||||
std::optional<uint8_t> OptionalIntegerFromXml(pugi::xml_attribute const & attribute)
|
std::optional<int> OptionalIntegerFromXml(pugi::xml_attribute const & attribute)
|
||||||
{
|
{
|
||||||
if (attribute.empty())
|
if (attribute.empty())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
uint8_t result = std::stoi(attribute.as_string());
|
int result = std::stoi(attribute.as_string());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (std::invalid_argument const& ex)
|
catch (std::invalid_argument const& ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user