X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstringcodec%2Fjisx0201.cpp;h=4c8cd4804901e0332a4b458f51bf2dbc79b27857;hp=307a681fdbcea1a42f8a4bed5b021e67a687ddb7;hb=242a4a9abe1e1113b5eb39aa751aa054f696d7be;hpb=02794ef3620d0d9cc3b8f1c0d8f2995c825fdf4f diff --git a/source/stringcodec/jisx0201.cpp b/source/stringcodec/jisx0201.cpp index 307a681..4c8cd48 100644 --- a/source/stringcodec/jisx0201.cpp +++ b/source/stringcodec/jisx0201.cpp @@ -16,7 +16,7 @@ void JisX0201::Encoder::encode_char(unichar ch, string &buf) else if(ch>=0xFF61 && ch<=0xFF9F) buf += ch-0xFEC0; else - error(ch, buf, "Can't express character in JIS X 0201"); + error(ch, buf, invalid_character(ch, "JIS X 0201")); } void JisX0201::Encoder::transliterate(unichar, string &buf) @@ -28,7 +28,7 @@ void JisX0201::Encoder::transliterate(unichar, string &buf) unichar JisX0201::Decoder::decode_char(const string &str, string::const_iterator &i) { if(i==str.end()) - return error("No input"); + return -1; unsigned char ch = *i; unichar result; @@ -41,7 +41,7 @@ unichar JisX0201::Decoder::decode_char(const string &str, string::const_iterator else if(ch>=0xA1 && ch<=0xDF) result = ch+0xFEC0; else - result = error("Undefined JIS X 0201 character"); + result = error(invalid_sequence(i, i+1, "undefined JIS X 0201 character")); ++i; return result;