From 4e1f76fae58a7e0db111ec68e616e6ea3222f726 Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周日, 13 10月 2019 16:17:06 +0800 Subject: [PATCH] fix windows tests --- src/library/base/EventRegistry.cpp | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/library/base/EventRegistry.cpp b/src/library/base/EventRegistry.cpp index 8650b96..389ee42 100644 --- a/src/library/base/EventRegistry.cpp +++ b/src/library/base/EventRegistry.cpp @@ -2,7 +2,7 @@ * EventRegistry.cpp * * Created on: Mar 30, 2014 - * Author: devel + * */ #include "EventRegistry.h" @@ -11,6 +11,8 @@ #include <algorithm> namespace license { +using namespace std; + EventRegistry::EventRegistry() { } @@ -33,7 +35,7 @@ void EventRegistry::turnLastEventIntoError() { if (logs.size() > 0) { - logs.back().severity = SEVERITY_ERROR; + logs.back().severity = SVRT_ERROR; } } @@ -41,7 +43,7 @@ bool eventFound = false; for (auto it = logs.begin(); it != logs.end(); ++it) { if (it->event_type == event) { - it->severity = SEVERITY_ERROR; + it->severity = SVRT_ERROR; eventFound = true; } } @@ -49,14 +51,14 @@ } AuditEvent const * EventRegistry::getLastFailure() const { - const AuditEvent* result = NULL; + const AuditEvent* result = nullptr; if (logs.size() == 0) { return result; } auto it = logs.end(); do { --it; - if (it->severity == SEVERITY_ERROR) { + if (it->severity == SVRT_ERROR) { result = &(*it); break; } @@ -68,7 +70,7 @@ bool EventRegistry::isGood() const { bool isGood = true; for (auto it = logs.begin(); it != logs.end(); ++it) { - if (it->severity == SEVERITY_ERROR) { + if (it->severity == SVRT_ERROR) { isGood = false; break; } @@ -77,8 +79,9 @@ } void EventRegistry::addError(EVENT_TYPE event) { - addEvent(event, SEVERITY_ERROR); + this->addEvent(event, SVRT_ERROR); } + void EventRegistry::addEvent(EVENT_TYPE event, SEVERITY severity) { AuditEvent audit; audit.severity = severity; @@ -101,8 +104,8 @@ bool EventRegistry::turnErrosIntoWarnings() { bool eventFound = false; for (auto it = logs.begin(); it != logs.end(); ++it) { - if (it->severity == SEVERITY_ERROR) { - it->severity = SEVERITY_WARN; + if (it->severity == SVRT_ERROR) { + it->severity = SVRT_WARN; eventFound = true; } } @@ -110,7 +113,7 @@ } void EventRegistry::exportLastEvents(AuditEvent* auditEvents, int nlogs) { - int sizeToCopy = std::min(nlogs, (int) logs.size()); + const int sizeToCopy = min(nlogs, (int) logs.size()); std::copy(logs.begin(), logs.begin() + sizeToCopy, auditEvents); } } -- Gitblit v1.9.1