From 765957f617ceebfe0147d27e1d60b79dd0a9be34 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 23 Aug 2016 14:26:51 +0200 Subject: [PATCH] yhook: avoid parameters from xml closing tag Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/acf58551a8a426fc9b39432e996e374b14f43176 Author: vanhofen Date: 2016-08-23 (Tue, 23 Aug 2016) Origin message was: ------------------ - yhook: avoid parameters from xml closing tag --- src/nhttpd/yhttpd_core/yhook.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index 56537c057..7838cefa9 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -444,10 +444,11 @@ std::string CyhookHandler::outSingle(std::string _content) { //----------------------------------------------------------------------------- std::string CyhookHandler::outPair(std::string _key, std::string _content, bool _next) { - std::string result = ""; + std::string result = "", _key_close = "", tmp; + ySplitString(_key, " ", _key_close, tmp); switch (outType) { case xml: - result = outIndent() + "<" + _key + ">" + _content + ""; + result = outIndent() + "<" + _key + ">" + _content + ""; break; case json: result = outIndent() + "\"" + _key + "\": \"" + _content + "\""; @@ -466,11 +467,12 @@ std::string CyhookHandler::outPair(std::string _key, std::string _content, bool //----------------------------------------------------------------------------- std::string CyhookHandler::outArray(std::string _key, std::string _content, bool _next) { - std::string result = ""; + std::string result = "", _key_close = "", tmp; + ySplitString(_key, " ", _key_close, tmp); switch (outType) { case xml: //TODO: xml check and DESC check - result = outIndent() + "<" + _key + ">\n" + _content + ""; + result = outIndent() + "<" + _key + ">\n" + _content + ""; result += "\n"; break; case json: @@ -489,11 +491,12 @@ std::string CyhookHandler::outArray(std::string _key, std::string _content, bool //----------------------------------------------------------------------------- std::string CyhookHandler::outArrayItem(std::string _key, std::string _content, bool _next) { - std::string result = ""; + std::string result = "", _key_close = "", tmp; + ySplitString(_key, " ", _key_close, tmp); switch (outType) { case xml: //TODO: xml check and DESC check - result = outIndent() + "<" + _key + ">\n" + _content + ""; + result = outIndent() + "<" + _key + ">\n" + _content + ""; result += "\n"; break; case json: @@ -511,11 +514,12 @@ std::string CyhookHandler::outArrayItem(std::string _key, std::string _content, } //----------------------------------------------------------------------------- std::string CyhookHandler::outObject(std::string _key, std::string _content, bool _next) { - std::string result = ""; + std::string result = "", _key_close = "", tmp; + ySplitString(_key, " ", _key_close, tmp); switch (outType) { case xml: //TODO: xml check and DESC check - result = outIndent() + "<" + _key + ">\n" + _content + ""; + result = outIndent() + "<" + _key + ">\n" + _content + ""; result += "\n"; break; case json: