String fixes

feature/code-to-root
kaetemi 5 years ago
parent 50be041116
commit 4f0bbbad69

@ -290,6 +290,14 @@ inline bool endsWith(const char *str, const char *suffix) { return endsWith(str,
inline bool endsWith(const std::string &str, const char *suffix) { return endsWith(str.c_str(), str.size(), suffix, strlen(suffix)); }
inline bool endsWith(const std::string &str, const std::string &suffix) { return endsWith(str.c_str(), str.size(), suffix.c_str(), suffix.size()); }
// ****************************************************************************
// Conversion of strings between
// - UTF-8
// - Local codepage (UTF-8 on Linux)
// - TString (Local codepage or wide on Windows)
// - Wide (wchar_t *, UTF-16 on Windows, UTF-32 on Linux)
// ****************************************************************************
// Convert local codepage to UTF-8
// On Windows, the local codepage is undetermined
// On Linux, the local codepage is always UTF-8 (no-op)

@ -171,15 +171,16 @@ bool CIXml::init (IStream &stream)
// Try binary mode
if (_TryBinaryMode)
{
char header[4];
char header[5];
header[0] = buffer[0];
header[1] = buffer[1];
header[2] = buffer[2];
header[3] = buffer[3];
header[4] = '\0';
toLower(header);
// Does it a xml stream ?
if (!strcmp(header, "<?xm"))
if (strcmp(header, "<?xm"))
{
// NO ! Go in binary mode
_BinaryStream = &stream;

@ -598,7 +598,7 @@ bool CWorldEditorApp::initPath (const std::string &filename, CSplashScreen &spla
}
else
{
errorMessage ("Can't open the file %s for reading.", filename);
errorMessage ("Can't open the file %s for reading.", filename.c_str());
}
failed:

Loading…
Cancel
Save