diff options
Diffstat (limited to '')
-rw-r--r-- | source/Globals.h | 1 | ||||
-rw-r--r-- | source/WebAdmin.cpp | 45 |
2 files changed, 18 insertions, 28 deletions
diff --git a/source/Globals.h b/source/Globals.h index 174273bbc..ef79e4cf1 100644 --- a/source/Globals.h +++ b/source/Globals.h @@ -161,7 +161,6 @@ typedef unsigned short UInt16; #include <memory> #include <set> #include <queue> -#include <sstream> diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp index d0b9648d9..3f9bc6c98 100644 --- a/source/WebAdmin.cpp +++ b/source/WebAdmin.cpp @@ -397,47 +397,38 @@ AString cWebAdmin::GetBaseURL( const AString& a_URL ) -AString cWebAdmin::GetHTMLEscapedString( const AString& a_Input ) +AString cWebAdmin::GetHTMLEscapedString(const AString & a_Input) { - - // Define a string to write the output to. - AString dst = ""; + AString dst; dst.reserve(a_Input.length()); - // Loop over input and substitute HTML characters for their alternatives. - for (size_t i = 0; i < a_Input.length(); i++) { - switch ( a_Input[i] ) + // Loop over input and substitute HTML characters for their alternatives: + size_t len = a_Input.length(); + for (size_t i = 0; i < len; i++) + { + switch (a_Input[i]) { - case '&': - dst =+ "&"; - break; - case '\'': - dst =+ "'"; - break; - case '"': - dst =+ """; - break; - case '<': - dst =+ "<"; - break; - case '>': - dst =+ ">"; - break; + case '&': dst.append("&"); break; + case '\'': dst.append("'"); break; + case '"': dst.append("""); break; + case '<': dst.append("<"); break; + case '>': dst.append(">"); break; default: - dst =+ a_Input[i]; + { + dst.push_back(a_Input[i]); break; - } - } + } + } // switch (a_Input[i]) + } // for i - a_Input[] return dst; - } -AString cWebAdmin::GetBaseURL( const AStringVector& a_URLSplit ) +AString cWebAdmin::GetBaseURL(const AStringVector & a_URLSplit) { AString BaseURL = "./"; if (a_URLSplit.size() > 1) |