From: Alexander A. Klimov Date: Fri, 15 Mar 2019 10:53:56 +0000 (+0100) Subject: Make buildable with VS 2017 X-Git-Tag: v2.11.0-rc1~199^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0cf10c63067a77e55a2a957da57922bf94b1366f;p=icinga2 Make buildable with VS 2017 --- diff --git a/lib/base/json.cpp b/lib/base/json.cpp index 0f2a8de91..c1a47c788 100644 --- a/lib/base/json.cpp +++ b/lib/base/json.cpp @@ -37,19 +37,8 @@ public: Value GetResult(); private: - struct Node - { - union - { - Dictionary *Object; - Array *Aray; - }; - - bool IsObject; - }; - Value m_Root; - std::stack m_CurrentSubtree; + std::stack> m_CurrentSubtree; String m_CurrentKey; void FillCurrentTarget(Value value); @@ -280,7 +269,7 @@ bool JsonSax::start_object(std::size_t) FillCurrentTarget(object); - m_CurrentSubtree.push(Node{{.Object = object}, true}); + m_CurrentSubtree.push({object, nullptr}); return true; } @@ -309,7 +298,7 @@ bool JsonSax::start_array(std::size_t) FillCurrentTarget(array); - m_CurrentSubtree.push(Node{{.Aray = array}, false}); + m_CurrentSubtree.push({nullptr, array}); return true; } @@ -342,10 +331,10 @@ void JsonSax::FillCurrentTarget(Value value) } else { auto& node (m_CurrentSubtree.top()); - if (node.IsObject) { - node.Object->Set(m_CurrentKey, value); + if (node.first) { + node.first->Set(m_CurrentKey, value); } else { - node.Aray->Add(value); + node.second->Add(value); } } }