X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fiso646fi.cpp;h=1874ded8cf9eefd309f6c62fbf1a0ce0ae3bed2b;hp=45c29ffb5dab08d1edc80075152af9b12c1b826f;hb=9da6abdcabec59f4845da256a8ad75a810ed1589;hpb=58384e355b4a78730d69243f1092e47591f2f384 diff --git a/source/iso646fi.cpp b/source/iso646fi.cpp index 45c29ff..1874ded 100644 --- a/source/iso646fi.cpp +++ b/source/iso646fi.cpp @@ -1,11 +1,21 @@ +/* $Id$ + +This file is part of libmspstrings +Copyright © 2006-2007 Mikko Rasa +Distributed under the LGPL +*/ + #include "iso646fi.h" using namespace std; namespace Msp { -void Iso646Fi::Encoder::encode_char(wchar_t c) +void Iso646Fi::Encoder::encode_char(wchar_t c_) { + // Win32 has typedef unsigned short wchar_t + int c=c_; + if((c>=0 && c<=0x5A) || c==0x5F || (c>=0x61 && c<=0x7A)) append(c); else if(c==0xC4) @@ -27,7 +37,7 @@ void Iso646Fi::Encoder::encode_char(wchar_t c) else if(c==0xFC) append(0x7E); else - throw CodecError("Can't express character in ISO-646-FI"); + error("Can't express character in ISO-646-FI"); } void Iso646Fi::Decoder::decode_char(const string &str, string::const_iterator &i) @@ -57,7 +67,7 @@ void Iso646Fi::Decoder::decode_char(const string &str, string::const_iterator &i else if(c<=0x7F) append(c); else - throw CodecError("Invalid ISO-646-FI string (undefined character)"); + error("Invalid ISO-646-FI string (undefined character)"); } }