Simplify.

This commit is contained in:
Steve Checkoway
2006-09-19 04:47:09 +00:00
parent 32c209a322
commit ea1e408b24
+3 -6
View File
@@ -11,9 +11,6 @@
/* Convert from the given codepage to UTF-8. Return true if successful. */ /* Convert from the given codepage to UTF-8. Return true if successful. */
static bool CodePageConvert( RString &sText, int iCodePage ) static bool CodePageConvert( RString &sText, int iCodePage )
{ {
if( sText.size() == 0 )
return true;
int iSize = MultiByteToWideChar( iCodePage, MB_ERR_INVALID_CHARS, sText.data(), sText.size(), NULL, 0 ); int iSize = MultiByteToWideChar( iCodePage, MB_ERR_INVALID_CHARS, sText.data(), sText.size(), NULL, 0 );
if( iSize == 0 ) if( iSize == 0 )
{ {
@@ -41,9 +38,6 @@ static bool AttemptJapaneseConversion( RString &sText ) { return CodePageConvert
static bool ConvertFromCharset( RString &sText, const char *szCharset ) static bool ConvertFromCharset( RString &sText, const char *szCharset )
{ {
if( sText.size() == 0 )
return true;
iconv_t converter = iconv_open( "UTF-8", szCharset ); iconv_t converter = iconv_open( "UTF-8", szCharset );
if( converter == (iconv_t) -1 ) if( converter == (iconv_t) -1 )
{ {
@@ -130,6 +124,9 @@ static bool AttemptJapaneseConversion( RString &sText ) { return false; }
bool ConvertString( RString &str, const RString &encodings ) bool ConvertString( RString &str, const RString &encodings )
{ {
if( str.empty() )
return true;
vector<RString> lst; vector<RString> lst;
split( encodings, ",", lst ); split( encodings, ",", lst );