From 3d78e7d65743e54855239dc75f14caf3c3059bb7 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 21 Feb 2016 21:41:24 +0100 Subject: [PATCH] - yhook: rename unused checkOutput() -> getOutType() and use it --- src/nhttpd/yhttpd_core/yhook.cpp | 22 +++++++++------------- src/nhttpd/yhttpd_core/yhook.h | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index da238ce81..c8f437b7d 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -73,7 +73,7 @@ THandleStatus CyhookHandler::Hooks_SendResponse() { //----------------------------------------------------------------------------- THandleStatus CyhookHandler::Hooks_PrepareResponse() { log_level_printf(4, "PrepareResponse Hook-List Start\n"); - outType = checkOutput(); + outType = getOutType(); THandleStatus _status = HANDLED_NONE; THookList::iterator i = HookList.begin(); for (; i != HookList.end(); ++i) { @@ -392,28 +392,24 @@ void CyhookHandler::printf(const char *fmt, ...) { Write(outbuf); } //----------------------------------------------------------------------------- -TOutType CyhookHandler::checkOutput() { - // get outType - outType = plain; // plain +TOutType CyhookHandler::getOutType() { + TOutType _outType = plain; if(!(ParamList.empty())) { if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "json") || (ParamList.find("json") != ParamList.end() && !(ParamList["json"].empty())) ) - outType = json; + _outType = json; else if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "xml") || (ParamList.find("xml") != ParamList.end() && !(ParamList["xml"].empty())) ) - outType = xml; + _outType = xml; } - return outType; + return _outType; } //----------------------------------------------------------------------------- TOutType CyhookHandler::outStart(bool single) { - outSingle = single; // for compatibility + // for compatibility + outSingle = single; // get outType - outType = plain; // plain - if (ParamList["format"] == "json") - outType = json; - else if (ParamList["format"] == "xml" || !(ParamList["xml"].empty()) ) - outType = xml; + outType = getOutType(); // set response header if (outType == xml) SetHeader(HTTP_OK, "text/xml; charset=UTF-8"); diff --git a/src/nhttpd/yhttpd_core/yhook.h b/src/nhttpd/yhttpd_core/yhook.h index 66c4fb362..986e016b8 100644 --- a/src/nhttpd/yhttpd_core/yhook.h +++ b/src/nhttpd/yhttpd_core/yhook.h @@ -202,7 +202,7 @@ public: int _outIndent; TOutType outType; // Outputtpe = plain (default)|xml|json TOutType outStart(bool single = false); - TOutType checkOutput(); + TOutType getOutType(); std::string outIndent(); std::string outPair(std::string _key, std::string _content, bool _next); std::string outArray(std::string _key, std::string _content);