aboutsummaryrefslogtreecommitdiff
path: root/common/encoding.h
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-08-22 02:49:01 -0700
committerFilippos Karapetis2019-08-24 18:12:45 +0300
commitfcbf59f5ba37c1cbfdfa0ccacfc6b602033b9d86 (patch)
tree3a62e978bb931f456a57455987ac129074847fec /common/encoding.h
parent0c74a7f27eaad70a31a6dae814954973c5a1da85 (diff)
downloadscummvm-rg350-fcbf59f5ba37c1cbfdfa0ccacfc6b602033b9d86.tar.gz
scummvm-rg350-fcbf59f5ba37c1cbfdfa0ccacfc6b602033b9d86.tar.bz2
scummvm-rg350-fcbf59f5ba37c1cbfdfa0ccacfc6b602033b9d86.zip
COMMON: Convert endianity when needed in Encoding.
Diffstat (limited to 'common/encoding.h')
-rw-r--r--common/encoding.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/encoding.h b/common/encoding.h
index 6018eaf6e4..c8f864d2ec 100644
--- a/common/encoding.h
+++ b/common/encoding.h
@@ -35,6 +35,11 @@ typedef void* iconv_t;
#include "common/scummsys.h"
#include "common/str.h"
+#include "common/system.h"
+
+#ifdef WIN32
+#include "backends/platform/sdl/win32/win32.h"
+#endif
namespace Common {
@@ -44,6 +49,9 @@ namespace Common {
* ScummVM is compiled with or without iconv.
*/
class Encoding {
+#ifdef WIN32
+ friend char *OSystem_Win32::convertEncoding(const char*, const char *, const char *, size_t);
+#endif
public:
/**
* Constructs everything needed for the conversion between 2 encodings
@@ -234,6 +242,17 @@ class Encoding {
* the same string.
*/
static String addUtfEndianness(const String &str);
+
+ /**
+ * Switches the endianity of a string.
+ *
+ * @param string Array containing the characters of a string.
+ * @param length Length of the string in bytes
+ * @param bitCount Number of bits used for each character.
+ *
+ * @return Array of characters with the opposite endianity
+ */
+ static char *switchEndian(const char *string, int length, int bitCount);
};
}