X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Futils.cpp;h=0318e994e22a6f66eea7a2f03e53660435445b37;hp=9898a07dca5fe52d8511ad71da78c4f5e8b864cb;hb=b254c706617223da1dd1b9543a74715e42a8a5b0;hpb=df1a66180655104af15f9bb6067b4eaa1421f5ff diff --git a/source/utils.cpp b/source/utils.cpp index 9898a07..0318e99 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -6,7 +6,7 @@ Distributed under the LGPL */ #include -#include +#include #include "utils.h" using namespace std; @@ -272,9 +272,9 @@ string c_escape(const string &str, bool escape_8bit) result+="\\\'"; else if(*i=='\\') result+="\\\\"; - else if(*i<' ' || (escape_8bit && (*i&0x80))) + else if(static_cast(*i)<' ' || (escape_8bit && (*i&0x80))) { - char buf[4]={'\\', (*i>>6)&7, (*i>>3)&7, *i&7}; + char buf[4]={'\\', '0'+((*i>>6)&7), '0'+((*i>>3)&7), '0'+(*i&7)}; result.append(buf, 4); } else