aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heider2010-06-15 17:50:14 +0000
committerAndre Heider2010-06-15 17:50:14 +0000
commit212d0ac28c3b10c57ffefb16af998f58fa5e294c (patch)
tree78218080bfcaa047232c3fd124987b39e4d2dc7b
parentee419aad9cb16e36248158a434831163a93731db (diff)
downloadscummvm-rg350-212d0ac28c3b10c57ffefb16af998f58fa5e294c.tar.gz
scummvm-rg350-212d0ac28c3b10c57ffefb16af998f58fa5e294c.tar.bz2
scummvm-rg350-212d0ac28c3b10c57ffefb16af998f58fa5e294c.zip
Fix compilation when using ICONV_USES_CONST.
svn-id: r49878
-rw-r--r--common/translation.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/common/translation.cpp b/common/translation.cpp
index c7bcb385d1..60ae4c2257 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -129,27 +129,29 @@ String TranslationManager::getTranslation(const String &message) {
bool TranslationManager::convert(const char *message) {
// Preparing conversion origin
size_t len = strlen(message);
- char *msgcpy = new char[len + 1];
- strcpy(msgcpy, message);
- char *msg = msgcpy;
#ifdef ICONV_USES_CONST
+ const char *msg = message;
const char **pmsg = &msg;
#else
+ char *msgcpy = new char[len + 1];
+ strcpy(msgcpy, message);
+ char *msg = msgcpy;
char **pmsg = &msg;
#endif
// Preparing conversion destination
size_t len2 = _sizeconv;
char *conv = _convmsg;
- char **pconv = &conv;
// Clean previous conversions
- iconv(_conversion, NULL, NULL, pconv, &len2);
+ iconv(_conversion, NULL, NULL, &conv, &len2);
// Do the real conversion
- size_t result = iconv(_conversion, pmsg, &len, pconv, &len2);
+ size_t result = iconv(_conversion, pmsg, &len, &conv, &len2);
+#ifndef ICONV_USES_CONST
delete[] msgcpy;
+#endif
return result != ((size_t)-1);
}