Commit Graph

22 Commits

Author SHA1 Message Date
Zvika Haramaty 41f3d4b488 COMMON: Encoding::convertIconv - check errors on last call to iconv
There was a bug when trying to convert the Hebrew string "\e0\e1\e2"
from WINDOWS-1255 to UTF-32LE, because there was a last call to
`iconv` with `NULL`s, without error checking, and buffer needed to
be extended for that last one call.

Now this call is inserted to the main `iconv` loop, with error checking.
2020-06-09 23:01:47 +02:00
Eugene Sandulenko 34180fe8cf JANITORIAL: Fix code formatting 2020-04-27 18:51:33 +02:00
lolbot-iichan 3e738f7734 COMMON: Fix conversion to UTF32 for short strings
Testcase: convert 1-byte encoded single character string from 125X to
UTF32, e.g. "=".

Expected result: got widestring, first dword contains "=", next dword
contains "\0"

Actual result: got widestring, first dword contains "=", second dword
contains garbage, next dword contains "\0"

Reference implementation:
http://www-personal.umich.edu/~bazald/l/api/_s_d_l__iconv_8c_source.html
, line 887
2020-02-24 09:18:38 +01:00
Eugene Sandulenko 5825a30b67 JANITORIAL: Whitespace fixes 2019-12-13 00:02:38 +01:00
Thierry Crozat 06acfd515f COMMON: Fix memory leaks in iconv error case
This fixes coverity CID 1405783 and CID 1405784.
2019-09-30 22:04:27 +01:00
Jaromir Wysoglad 8f930126e7 COMMON: Add string size computation to Encoding. 2019-09-05 23:52:46 +01:00
Jaromir Wysoglad d4a98dcadb COMMON: Add CP437 encoding conversion table. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad 291360a280 COMMON: Add CP850 conversion.
CP850 is used by the mortevielle engine (and apparently by other
engines too). Anytime an engine using CP850 encoding wants to use
the TTS, the encoding has to be converted, so this is pretty
important encoding conversion to support. Unfortunately SDL
(when compiled without iconv) doesn't support this encoding
(which means, there might not be a way to convert this encoding
on some platforms), so I added a conversion table for this.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad b0c8b368a9 COMMON: Don't include iconv.h in common/encoding.h
Move #include<iconv.h> from common/encoding.h to
common/encoding.cpp and change the methods accordingly.

This resulted in not saving the iconvHandle if using the
"non-static" version of conversion, but it simplified the code
and hopefuly resolved issues with forbidden symbols on some
platforms.
2019-08-25 13:46:16 +03:00
Jaromir Wysoglad fcbf59f5ba COMMON: Convert endianity when needed in Encoding. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad 0c74a7f27e COMMON: Fix typos 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad f8ac40af7c COMMON: Encoding refactoring 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad 96270d4bf2 JANITORIAL: Remove debuging code. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad a0564bc564 COMMON: Resolve endianity in Encoding 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad 613613568c COMMON: Rename methods in Common::Encoding 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad 24d35df476 COMMON: Refactor convertIconv 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad 9fa09eeefe COMMON: Check for return values in Encoding 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad 5043dec13c COMMON: Add propper Encoding setters 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad 61cf628bfb COMMON: Add cyrilic transliteration to Encoding. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad 888f3e4d30 COMMON: Add transMan mapping encoding conversion. 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad bfdff38d01 COMMON: Use backend specific encoding conversion 2019-08-24 18:12:45 +03:00
Jaromir Wysoglad dfbbd228e6 COMMON: Add encoding conversion using iconv 2019-08-24 18:12:45 +03:00