X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fjisx0201.cpp;h=49f8b00240463af63b761220df1460c8c079270c;hp=0a8804759aaca8d3d95ab674067f01b4fa442520;hb=9da6abdcabec59f4845da256a8ad75a810ed1589;hpb=58384e355b4a78730d69243f1092e47591f2f384 diff --git a/source/jisx0201.cpp b/source/jisx0201.cpp index 0a88047..49f8b00 100644 --- a/source/jisx0201.cpp +++ b/source/jisx0201.cpp @@ -1,11 +1,20 @@ +/* $Id$ + +This file is part of libmspstrings +Copyright © 2006-2007 Mikko Rasa +Distributed under the LGPL +*/ + #include "jisx0201.h" using namespace std; namespace Msp { -void JisX0201::Encoder::encode_char(wchar_t c) +void JisX0201::Encoder::encode_char(wchar_t c_) { + // Win32 has typedef unsigned short wchar_t + int c=c_; if(c>=0 && c<=0x7F && c!=0x5C && c!=0x7E) append(c); else if(c==0xA5) @@ -15,7 +24,7 @@ void JisX0201::Encoder::encode_char(wchar_t c) else if(c>=0xFF61 && c<=0xFF9F) append(c-0xFEC0); else - throw CodecError("Can't express character in JIS X 0201"); + error("Can't express character in JIS X 0201"); } void JisX0201::Decoder::decode_char(const string &str, string::const_iterator &i) @@ -33,7 +42,7 @@ void JisX0201::Decoder::decode_char(const string &str, string::const_iterator &i else if(c>=0xA1 && c<=0xDF) append(c+0xFEC0); else - throw CodecError("Invalid JIS X 0201 string (undefined character)"); + error("Invalid JIS X 0201 string (undefined character)"); } } // namespace Msp