X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstringcodec%2Fwindows1252.cpp;h=a6bde2407bad5cdcb5fa3a2cb458b911b0ebd9b5;hp=dc03172ce42063df056a005b6025e9d94e7cba77;hb=HEAD;hpb=056dc68dfc606a2c14126a70321045d6d9f12e0e diff --git a/source/stringcodec/windows1252.cpp b/source/stringcodec/windows1252.cpp index dc03172..a6bde24 100644 --- a/source/stringcodec/windows1252.cpp +++ b/source/stringcodec/windows1252.cpp @@ -18,7 +18,7 @@ unsigned short table[32]= namespace Msp { namespace StringCodec { -void Windows1252::Encoder::encode_char(UnicodeChar ch, string &buf) +void Windows1252::Encoder::encode_char(unichar ch, string &buf) { if((ch>=0 && ch<=0x7F) || (ch>=0xA0 && ch<=0xFF)) buf += ch; @@ -31,28 +31,28 @@ void Windows1252::Encoder::encode_char(UnicodeChar ch, string &buf) return; } - error(ch, buf, "Can't express character in Windows-1252"); + error(ch, buf, invalid_character(ch, "Windows-1252")); } } -void Windows1252::Encoder::transliterate(UnicodeChar, string &buf) +void Windows1252::Encoder::transliterate(unichar, string &buf) { buf += '?'; } -UnicodeChar Windows1252::Decoder::decode_char(const string &str, string::const_iterator &i) +unichar Windows1252::Decoder::decode_char(const string &str, string::const_iterator &i) { if(i==str.end()) - return error("No input"); + return -1; int ch = static_cast(*i); - UnicodeChar result; + unichar result; if(ch>=0x80 && ch<=0x9F) { result = table[ch-0x80]; if(result==0) - result = error("Undefined Windows-1252 character"); + result = error(invalid_sequence(i, i+1, "undefined Windows-1252 character")); } else result = ch;