]> git.tdb.fi Git - libs/core.git/blobdiff - source/utils.cpp
core/error.h renamed to except.h
[libs/core.git] / source / utils.cpp
index 9898a07dca5fe52d8511ad71da78c4f5e8b864cb..0318e994e22a6f66eea7a2f03e53660435445b37 100644 (file)
@@ -6,7 +6,7 @@ Distributed under the LGPL
 */
 
 #include <list>
-#include <msp/core/error.h>
+#include <msp/core/except.h>
 #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<unsigned char>(*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