Permalink
Browse files

Merge pull request #4 from get-a-clue/fixing_event_serialization_issue

Fixing event serialization issue
  • Loading branch information...
get-a-clue committed Mar 4, 2018
2 parents ab9e781 + aa2f444 commit d1d2e244b7714a65206b499e0b833e91d105e9d2
Showing with 24 additions and 8 deletions.
  1. +23 −7 src/utm/event_msg.cpp
  2. +1 −1 src/utm/utm.h
@@ -2,6 +2,8 @@
#include "event_msg.h"
#define FIELDS_IN_EVENT 5
namespace utm {
const char event_msg::this_class_name[] = "event_msg";
@@ -81,16 +83,30 @@ void event_msg::xml_catch_value(const char *keyname, const char *keyvalue)
return;
std::vector<std::string> fields;
stringtools::split(fields, keyvalue, '|');
if (fields.size() != 5)
if (fields.size() < FIELDS_IN_EVENT)
return;
id = boost::lexical_cast<std::uint64_t>(fields[0]);
pane = boost::lexical_cast<int>(fields[1]);
type = boost::lexical_cast<int>(fields[2]);
time.from_string(fields[3].c_str(), utime::format_iso);
message.assign_fromutf8(fields[4].c_str());
size_t k = 0;
id = boost::lexical_cast<std::uint64_t>(fields[k++]);
pane = boost::lexical_cast<int>(fields[k++]);
type = boost::lexical_cast<int>(fields[k++]);
time.from_string(fields[k++].c_str(), utime::format_iso);
// Message may include the character '|' (one is actually separator).
// Therefore, parser should correctly handle this case.
message.clear();
while (k < fields.size())
{
if (k >= FIELDS_IN_EVENT)
{
message.append("|");
}
utm::gstring str;
str.assign_fromutf8(fields[k++].c_str());
message.append(str);
}
if (stringtools::localize != NULL)
{
@@ -6,7 +6,7 @@
#endif
#ifndef UTM_VERSION
#define UTM_VERSION "15.0.104"
#define UTM_VERSION "15.0.106"
#endif
#ifdef UTM_WIN

0 comments on commit d1d2e24

Please sign in to comment.