]> git.tdb.fi Git - libs/core.git/blobdiff - source/jisx0208.cpp
Added reset function for StringCodec::Decoder
[libs/core.git] / source / jisx0208.cpp
index 0f0e73d7545afdba78e5ddc68f3ad92686bd28c0..4d46f709f89df5f739aa7c11a6a298505f41ed45 100644 (file)
@@ -42,6 +42,10 @@ void JisX0208::Decoder::sync()
                throw CodecError("Sync in middle of JIS X 0208 character");
 }
 
+void JisX0208::Decoder::reset()
+{
+       high=0;
+}
 
 wchar_t jisx0208_to_ucs(unsigned short jis)
 {
@@ -60,11 +64,11 @@ unsigned short ucs_to_jisx0208(wchar_t c)
        {
                if(i+bit>=ucs_to_jisx0208_table_size)
                        continue;
-               if(ucs_to_jisx0208_table[i+bit].ucs<=(unsigned short)c)
+               if(ucs_to_jisx0208_table[i+bit].ucs<=static_cast<unsigned short>(c))
                        i+=bit;
        }
 
-       if(ucs_to_jisx0208_table[i].ucs==(unsigned short)c)
+       if(ucs_to_jisx0208_table[i].ucs==static_cast<unsigned short>(c))
                return ucs_to_jisx0208_table[i].jis;
        return 0;
 }