diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2020-10-09 13:01:48 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2020-10-09 13:01:48 +0100 |
commit | 12fba46d3e738ad6b865500012f85cb0c35cd45d (patch) | |
tree | 41f52080f84bcba932b4ed2024a8ef4dadeaa0e1 /frontends | |
parent | 06c721c5bb6cd06fc35bd0a36a98415758501df8 (diff) | |
download | netsurf-12fba46d3e738ad6b865500012f85cb0c35cd45d.tar.gz netsurf-12fba46d3e738ad6b865500012f85cb0c35cd45d.tar.bz2 |
Cache codesets structure ourselves
attempt to speed up conversion as apparently codesets is being very slow
Diffstat (limited to 'frontends')
-rwxr-xr-x | frontends/amiga/utf8.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/frontends/amiga/utf8.c b/frontends/amiga/utf8.c index f16cbba6c..af5af126b 100755 --- a/frontends/amiga/utf8.c +++ b/frontends/amiga/utf8.c @@ -36,21 +36,35 @@ static nserror ami_utf8_codesets(const char *string, size_t len, char **result, { char *out; ULONG utf8_tag, local_tag; + static struct codeset *utf8_cs = NULL; + static struct codeset *local_cs = NULL; + + if(local_cs == NULL) CodesetsFind(NULL, +#ifdef __amigaos4__ + CSA_MIBenum, nsoption_int(local_codeset), +#else + NULL, +#endif + TAG_DONE); + + if(utf8_cs == NULL) CodesetsFind(NULL, + CSA_MIBenum, CS_MIBENUM_UTF_8, + TAG_DONE); if(to_local == false) { - local_tag = CSA_SourceMIBenum; - utf8_tag = CSA_DestMIBenum; + local_tag = CSA_SourceCodeset; + utf8_tag = CSA_DestCodeset; } else { - utf8_tag = CSA_SourceMIBenum; - local_tag = CSA_DestMIBenum; + utf8_tag = CSA_SourceCodeset; + local_tag = CSA_DestCodeset; } out = CodesetsConvertStr(CSA_Source, string, CSA_SourceLen, len, #ifdef __amigaos4__ - local_tag, nsoption_int(local_codeset), + local_tag, local_cs, #endif - utf8_tag, CS_MIBENUM_UTF_8, + utf8_tag, utf8_cs, CSA_MapForeignChars, TRUE, TAG_DONE); |