diff options
author | Jaromir Wysoglad | 2019-07-31 01:32:53 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-08-24 18:12:45 +0300 |
commit | 5043dec13c4019a858c397b0f2db44a75c2d0adc (patch) | |
tree | d0b2ca5e60ccf65467225c1939960351a1f7b773 | |
parent | 73fa9d921f52045a478f6a79741615987860ca1e (diff) | |
download | scummvm-rg350-5043dec13c4019a858c397b0f2db44a75c2d0adc.tar.gz scummvm-rg350-5043dec13c4019a858c397b0f2db44a75c2d0adc.tar.bz2 scummvm-rg350-5043dec13c4019a858c397b0f2db44a75c2d0adc.zip |
COMMON: Add propper Encoding setters
-rw-r--r-- | common/encoding.cpp | 12 | ||||
-rw-r--r-- | common/encoding.h | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/common/encoding.cpp b/common/encoding.cpp index e0446c0d27..f9dd19395d 100644 --- a/common/encoding.cpp +++ b/common/encoding.cpp @@ -55,6 +55,18 @@ void Encoding::deinitIconv(iconv_t iconvHandle) { #endif // USE_ICONV } +void Encoding::setFrom(const String &from) { + deinitIconv(_iconvHandle); + _from = from; + _iconvHandle = initIconv(_to, _from); +} + +void Encoding::setTo(const String &to) { + deinitIconv(_iconvHandle); + _to = to; + _iconvHandle = initIconv(_to, _from); +} + char *Encoding::convert(const char *string, size_t size) { return conversion(_iconvHandle, _to, _from, string, size); } diff --git a/common/encoding.h b/common/encoding.h index b55c485efd..67c5ac68ca 100644 --- a/common/encoding.h +++ b/common/encoding.h @@ -93,7 +93,7 @@ class Encoding { /** * @param from The encoding, to convert from */ - void setFrom(const String &from) {_from = from;}; + void setFrom(const String &from); /** * @return The encoding, which is currently being converted to @@ -103,7 +103,7 @@ class Encoding { /** * @param to The encoding, to convert to */ - void setTo(const String &to) {_to = to;}; + void setTo(const String &to); private: /** The encoding, which is currently being converted to */ |