]> git.tdb.fi Git - libs/core.git/blobdiff - source/stringcodec/iso2022jp.cpp
Add move semantics to Variant
[libs/core.git] / source / stringcodec / iso2022jp.cpp
index 14a4b99f83196b835b44eba00afb51082760d37a..93c50f489fb8486182a1f2b69711efea71d5e01e 100644 (file)
@@ -1,3 +1,4 @@
+#include <msp/core/except.h>
 #include "ascii.h"
 #include "iso2022jp.h"
 #include "jisx0201.h"
@@ -40,7 +41,9 @@ void Iso2022Jp::Encoder::encode_char(unichar ch, string &buf)
                if(mode!=JISX0208)
                        switch_mode(JISX0208, buf);
 
-               char jbuf[2] = { jis.ku+0x20, jis.ten+0x20 };
+               char jbuf[2];
+               jbuf[0] = jis.ku+0x20;
+               jbuf[1] = jis.ten+0x20;
                buf.append(jbuf, 2);
        }
 }
@@ -78,7 +81,6 @@ void Iso2022Jp::Encoder::transliterate(unichar, string &buf)
 
 Iso2022Jp::Decoder::Decoder(ErrorMode em):
        Codec::Decoder(em),
-       mode(ASCII),
        dec(new Ascii::Decoder)
 { }
 
@@ -89,7 +91,7 @@ unichar Iso2022Jp::Decoder::decode_char(const string &str, string::const_iterato
 
        while(i!=str.end())
        {
-               string::const_iterator j = i;
+               auto j = i;
 
                unichar result = -1;
                if(*j==033)
@@ -121,7 +123,7 @@ unichar Iso2022Jp::Decoder::decode_char(const string &str, string::const_iterato
                else if(dec)
                        return dec->decode_char(str, i);
                else
-                       throw logic_error("no sub-decoder");
+                       throw internal_error("no sub-decoder");
 
                if(result>=0)
                        return result;