Amiga: Fix codesets.library conversion when string specified as zero length

This commit is contained in:
Chris Young 2021-04-12 23:26:17 +01:00
parent 99a3d04d55
commit 81c40ab7c2

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008-2020 Chris Young <chris@unsatisfactorysoftware.co.uk>
* Copyright 2008-2021 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@ -35,7 +35,7 @@
static nserror ami_utf8_codesets(const char *string, size_t len, char **result, bool to_local)
{
char *out;
ULONG utf8_tag, local_tag;
ULONG utf8_tag = CSA_SourceCodeset, local_tag = CSA_DestCodeset, len_tag = CSA_SourceLen;
static struct codeset *utf8_cs = NULL;
static struct codeset *local_cs = NULL;
@ -54,13 +54,12 @@ static nserror ami_utf8_codesets(const char *string, size_t len, char **result,
if(to_local == false) {
local_tag = CSA_SourceCodeset;
utf8_tag = CSA_DestCodeset;
} else {
utf8_tag = CSA_SourceCodeset;
local_tag = CSA_DestCodeset;
}
if(len == 0) len_tag = TAG_IGNORE;
out = CodesetsConvertStr(CSA_Source, string,
CSA_SourceLen, len,
len_tag, len,
#ifdef __amigaos4__
local_tag, local_cs,
#endif