Archived
1
0

bugfix: some invalid combinations of init info

This commit is contained in:
Marrub 2015-06-06 08:42:29 -04:00
parent f24aad1d18
commit c9f001c238

View File

@ -81,8 +81,18 @@ void LT_Init(LT_InitInfo initInfo)
{ {
info = initInfo; info = initInfo;
if(info.doConvert) if(info.doConvert && info.fromCode != NULL && info.toCode != NULL)
{ {
if(strcmp(info.fromCode, "UTF8"))
{
info.fromCode = "UTF-8";
}
if(strcmp(info.toCode, "UTF8"))
{
info.toCode = "UTF-8";
}
icDesc = iconv_open(info.toCode, info.fromCode); icDesc = iconv_open(info.toCode, info.fromCode);
if(icDesc == (iconv_t) -1) if(icDesc == (iconv_t) -1)
@ -90,6 +100,15 @@ void LT_Init(LT_InitInfo initInfo)
LT_Assert(true, "LT_Init: Failure opening iconv"); LT_Assert(true, "LT_Init: Failure opening iconv");
} }
} }
else
{
info.doConvert = false;
}
if(info.stripInvalid && info.doConvert)
{
info.stripInvalid = false;
}
gbHead = malloc(sizeof(LT_GarbageList)); gbHead = malloc(sizeof(LT_GarbageList));
gbHead->next = NULL; gbHead->next = NULL;