diff --git a/Code/tests/DNP3Port_tests/TestDNP3EventHandling.cpp b/Code/tests/DNP3Port_tests/TestDNP3EventHandling.cpp index a01cbc63..cf37df7b 100644 --- a/Code/tests/DNP3Port_tests/TestDNP3EventHandling.cpp +++ b/Code/tests/DNP3Port_tests/TestDNP3EventHandling.cpp @@ -51,7 +51,7 @@ std::pair,std::shared_ptr> MakePorts(const m for(size_t idx = 0; idx < num_indexes; ++idx) { Json::Value point = Json::objectValue; - point["Index"] = idx; + point["Index"] = Json::UInt(idx); conf[PointType].append(point); } } @@ -65,10 +65,10 @@ std::pair,std::shared_ptr> MakePorts(const m conf["UnsolClass2"] = true; conf["UnsolClass3"] = true; conf["DoUnsolOnStartup"] = true; - conf["IntegrityScanRatems"] = 0; - conf["EventClass1ScanRatems"] = 0; - conf["EventClass2ScanRatems"] = 0; - conf["EventClass3ScanRatems"] = 0; + conf["IntegrityScanRatems"] = Json::UInt(0); + conf["EventClass1ScanRatems"] = Json::UInt(0); + conf["EventClass2ScanRatems"] = Json::UInt(0); + conf["EventClass3ScanRatems"] = Json::UInt(0); //make an outstation port diff --git a/include/opendatacon/IOTypes.h b/include/opendatacon/IOTypes.h index 7bc6c11a..fd0c5b9c 100644 --- a/include/opendatacon/IOTypes.h +++ b/include/opendatacon/IOTypes.h @@ -384,7 +384,10 @@ inline EventType EventTypeFromString(const std::string StrEventType) do { EventTypeResult = EventTypeResult+1; - if (StrEventType.find(ToString(EventTypeResult)) != std::string::npos) + auto FindStr = ToString(EventTypeResult); + if(FindStr.length() > StrEventType.length()) + continue; + if (StrEventType.find(FindStr, StrEventType.length()-FindStr.length()) != std::string::npos) break; } while (EventTypeResult != EventType::AfterRange); return EventTypeResult;