]> git.tdb.fi Git - libs/core.git/blobdiff - source/stringcodec/ascii.cpp
Add move semantics to Variant
[libs/core.git] / source / stringcodec / ascii.cpp
index 9867049a14b6ea03be91d3f4724d97b0b728c080..1d27561498f1de132fee1466e34e84868c66df75 100644 (file)
@@ -24,7 +24,7 @@ namespace StringCodec {
 void Ascii::Encoder::encode_char(unichar ch, string &buf)
 {
        if(ch<0 || ch>0x7F)
-               return error(ch, buf, "Can't express character in ASCII");
+               return error(ch, buf, invalid_character(ch, "ASCII"));
 
        buf += ch;
 }
@@ -91,10 +91,10 @@ void Ascii::Encoder::transliterate(unichar ch, string &buf)
 unichar Ascii::Decoder::decode_char(const string &str, string::const_iterator &i)
 {
        if(i==str.end())
-               return error("No input");
+               return -1;
        else if(*i&0x80)
        {
-               unichar result = error("Undefined ASCII character");
+               unichar result = error(invalid_sequence(i, i+1, "undefined ASCII character"));
                ++i;
                return result;
        }