[traffxml] Fix erroneous parsing of event length

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-06-20 18:13:15 +03:00
parent 81a31d6b42
commit 247f88254e
2 changed files with 3 additions and 3 deletions

View File

@@ -341,7 +341,7 @@ struct TraffEvent
{
EventClass m_class = EventClass::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<uint16_t> m_qDurationMins;
/*

View File

@@ -122,13 +122,13 @@ const boost::bimap<std::string, EventType> kEventTypeMap = MakeBimap<std::string
* @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.
*/
std::optional<uint8_t> OptionalIntegerFromXml(pugi::xml_attribute const & attribute)
std::optional<int> OptionalIntegerFromXml(pugi::xml_attribute const & attribute)
{
if (attribute.empty())
return std::nullopt;
try
{
uint8_t result = std::stoi(attribute.as_string());
int result = std::stoi(attribute.as_string());
return result;
}
catch (std::invalid_argument const& ex)