Changed the code according to xoft's suggestions.
This commit is contained in:
parent
f7c9230106
commit
0677872d88
@ -400,35 +400,35 @@ AString cWebAdmin::GetBaseURL( const AString& a_URL )
|
|||||||
AString cWebAdmin::GetHTMLEscapedString( const AString& a_Input )
|
AString cWebAdmin::GetHTMLEscapedString( const AString& a_Input )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Define a stringstream to write the output to.
|
// Define a string to write the output to.
|
||||||
std::stringstream dst;
|
AString dst = "";
|
||||||
|
|
||||||
// Loop over input and substitute HTML characters for their alternatives.
|
// Loop over input and substitute HTML characters for their alternatives.
|
||||||
for (int i = 0; i < a_Input.length(); i++) {
|
for (size_t i = 0; i < a_Input.length(); i++) {
|
||||||
switch ( a_Input[i] )
|
switch ( a_Input[i] )
|
||||||
{
|
{
|
||||||
case '&':
|
case '&':
|
||||||
dst << "&";
|
dst =+ "&";
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
dst << "'";
|
dst =+ "'";
|
||||||
break;
|
break;
|
||||||
case '"':
|
case '"':
|
||||||
dst << """;
|
dst =+ """;
|
||||||
break;
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
dst << "<";
|
dst =+ "<";
|
||||||
break;
|
break;
|
||||||
case '>':
|
case '>':
|
||||||
dst << ">";
|
dst =+ ">";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dst << a_Input[i];
|
dst =+ a_Input[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dst.str();
|
return dst();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user