]> git.tdb.fi Git - libs/core.git/blobdiff - source/iso646fi.cpp
More sophisticated error handling
[libs/core.git] / source / iso646fi.cpp
index 45c29ffb5dab08d1edc80075152af9b12c1b826f..171c0a0a82780c1642d46c90e8d2b7b466bb68c2 100644 (file)
@@ -4,8 +4,11 @@ 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 +30,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 +60,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)");
 }
 
 }