]> git.tdb.fi Git - libs/core.git/blobdiff - source/iso2022jp.cpp
Added reset function for StringCodec::Decoder
[libs/core.git] / source / iso2022jp.cpp
index 6a6bd1dc7970b28c367fbfad07d5719c505bc0ad..ab31456245b449c861a4c69b98dab62af77d4f40 100644 (file)
@@ -72,7 +72,7 @@ void Iso2022Jp::Decoder::decode_char(const string &str, string::const_iterator &
        {
                if(escape)
                {
-                       escape=escape<<8 | (unsigned char)*i;
+                       escape=escape<<8 | static_cast<unsigned char>(*i);
                        if(*i>='@' && *i<='Z')
                        {
                                switch(escape)
@@ -110,6 +110,12 @@ void Iso2022Jp::Decoder::sync()
        dec->flush();
 }
 
+void Iso2022Jp::Decoder::reset()
+{
+       switch_mode(ASCII);
+       escape=0;
+}
+
 void Iso2022Jp::Decoder::switch_mode(Mode m)
 {
        append(dec->get());