unichar Ascii::Decoder::decode_char(const string &str, string::const_iterator &i)
{
if(i==str.end())
- return error("No input");
+ return -1;
else if(*i&0x80)
{
unichar result = error("Undefined ASCII character");
unichar Iso2022Jp::Decoder::decode_char(const string &str, string::const_iterator &i)
{
if(i==str.end())
- return error("No input");
+ return -1;
while(i!=str.end())
{
unichar Iso646Fi::Decoder::decode_char(const string &str, string::const_iterator &i)
{
if(i==str.end())
- return error("No input");
+ return -1;
unsigned char ch = *i;
- int tch = (ch<=0x7F ? transform_mapping_or_direct(mapping, map_size, ch, true) : -1);
-
unichar result;
- if(tch==-1)
+ if(ch>=0x80)
result = error("Undefined ISO-646-FI character");
else
- result = tch;
+ result = transform_mapping_or_direct(mapping, map_size, ch, true);
++i;
return result;
unichar Iso88591::Decoder::decode_char(const string &str, string::const_iterator &i)
{
if(i==str.end())
- return error("No input");
+ return -1;
return static_cast<unsigned char>(*i++);
}
unichar Iso885915::Decoder::decode_char(const string &str, string::const_iterator &i)
{
if(i==str.end())
- return error("No input");
+ return -1;
- unsigned char ch = *i;
- int tch = transform_mapping_or_direct(mapping, map_size, ch, true);
-
- unichar result;
- if(tch==-1)
- result = error("Undefined ISO-8859-15 character");
- else
- result = tch;
-
- ++i;
- return result;
+ unsigned char ch = *i++;
+ return transform_mapping_or_direct(mapping, map_size, ch, true);
}
} // namespace StringCodec
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;
unichar JisX0208::Decoder::decode_char(const string &str, string::const_iterator &i)
{
if(i==str.end())
- return error("No input");
+ return -1;
string::const_iterator j = i;
Kuten jis;
unichar Utf8::Decoder::decode_char(const string &str, string::const_iterator &i)
{
if(i==str.end())
- return error("No input");
+ return -1;
if((*i&0xC0)==0x80)
{
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<unsigned char>(*i);
unichar result;