aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-31 22:40:45 +0200
committerFilippos Karapetis2019-08-24 18:12:45 +0300
commit613613568cbeee923a23400716c743be01d3906e (patch)
treea69ca274f59df50f42b6d04b92c759c29038560c
parent24d35df4760678f7592a42c2b78453bdfd6e0050 (diff)
downloadscummvm-rg350-613613568cbeee923a23400716c743be01d3906e.tar.gz
scummvm-rg350-613613568cbeee923a23400716c743be01d3906e.tar.bz2
scummvm-rg350-613613568cbeee923a23400716c743be01d3906e.zip
COMMON: Rename methods in Common::Encoding
-rw-r--r--common/encoding.cpp14
-rw-r--r--common/encoding.h7
2 files changed, 10 insertions, 11 deletions
diff --git a/common/encoding.cpp b/common/encoding.cpp
index 00870e71ab..d121e13dbe 100644
--- a/common/encoding.cpp
+++ b/common/encoding.cpp
@@ -68,19 +68,19 @@ void Encoding::setTo(const String &to) {
}
char *Encoding::convert(const char *string, size_t size) {
- return conversion(_iconvHandle, _to, _from, string, size);
+ return convertWithTransliteration(_iconvHandle, _to, _from, string, size);
}
char *Encoding::convert(const String &to, const String &from, const char *string, size_t size) {
iconv_t iconvHandle = initIconv(to, from);
- char *result = conversion(iconvHandle, to, from, string, size);
+ char *result = convertWithTransliteration(iconvHandle, to, from, string, size);
deinitIconv(iconvHandle);
return result;
}
-char *Encoding::conversion(iconv_t iconvHandle, const String &to, const String &from, const char *string, size_t length) {
+char *Encoding::convertWithTransliteration(iconv_t iconvHandle, const String &to, const String &from, const char *string, size_t length) {
if (from.equalsIgnoreCase(to)) {
// don't convert, just copy the string and return it
char *result = (char *) calloc(sizeof(char), length + 4);
@@ -111,7 +111,7 @@ char *Encoding::conversion(iconv_t iconvHandle, const String &to, const String &
tmpString = nullptr;
else {
iconv_t tmpHandle = initIconv("UTF-32", from);
- tmpString = conversion2(tmpHandle, "UTF-32", from, string, length);
+ tmpString = conversion(tmpHandle, "UTF-32", from, string, length);
deinitIconv(tmpHandle);
if (!tmpString)
return nullptr;
@@ -134,17 +134,17 @@ char *Encoding::conversion(iconv_t iconvHandle, const String &to, const String &
newHandle = initIconv(to, newFrom);
char *result;
if (newString != nullptr) {
- result = conversion2(newHandle, to, newFrom, newString, newLength);
+ result = conversion(newHandle, to, newFrom, newString, newLength);
free(newString);
} else
- result = conversion2(newHandle, to, newFrom, string, newLength);
+ result = conversion(newHandle, to, newFrom, string, newLength);
if (newFrom != from)
deinitIconv(newHandle);
return result;
}
-char *Encoding::conversion2(iconv_t iconvHandle, const String &to, const String &from, const char *string, size_t length) {
+char *Encoding::conversion(iconv_t iconvHandle, const String &to, const String &from, const char *string, size_t length) {
char *result = nullptr;
#ifdef USE_ICONV
if (iconvHandle != (iconv_t) -1)
diff --git a/common/encoding.h b/common/encoding.h
index 67c5ac68ca..014000d5ae 100644
--- a/common/encoding.h
+++ b/common/encoding.h
@@ -119,8 +119,7 @@ class Encoding {
iconv_t _iconvHandle;
/**
- * Takes care of transliteration and calls conversion2 for the encoding
- * conversion
+ * Takes care of transliteration and calls conversion
*
* The result has to be freed after use.
*
@@ -132,7 +131,7 @@ class Encoding {
*
* @return Converted string (must be freed) or nullptr if the conversion failed
*/
- static char *conversion(iconv_t iconvHandle, const String &to, const String &from, const char *string, size_t length);
+ static char *convertWithTransliteration(iconv_t iconvHandle, const String &to, const String &from, const char *string, size_t length);
/**
* Calls as many conversion functions as possible or until the conversion
@@ -149,7 +148,7 @@ class Encoding {
*
* @return Converted string (must be freed) or nullptr if the conversion failed
*/
- static char *conversion2(iconv_t iconvHandle, const String &to, const String &from, const char *string, size_t length);
+ static char *conversion(iconv_t iconvHandle, const String &to, const String &from, const char *string, size_t length);
/**
* Tries to convert the string using iconv.