Merge branch 'feature/code-to-root' into ryzomclassic-develop

ryzomclassic-develop
kaetemi 5 years ago
commit 51ec683eea

@ -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 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()); } 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 // Convert local codepage to UTF-8
// On Windows, the local codepage is undetermined // On Windows, the local codepage is undetermined
// On Linux, the local codepage is always UTF-8 (no-op) // On Linux, the local codepage is always UTF-8 (no-op)

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

@ -21,6 +21,7 @@
#define NLMAX_STRING_COMMON_H #define NLMAX_STRING_COMMON_H
#include <nel/misc/ucstring.h> #include <nel/misc/ucstring.h>
#include <nel/misc/string_common.h>
#if (MAX_VERSION_MAJOR < 15) #if (MAX_VERSION_MAJOR < 15)
#define GET_OBJECT_NAME_CONST #define GET_OBJECT_NAME_CONST
@ -37,9 +38,7 @@ static TSTR MaxTStrFromUtf8(const std::string &src)
{ {
TSTR dst; TSTR dst;
#if (MAX_VERSION_MAJOR < 15) #if (MAX_VERSION_MAJOR < 15)
ucstring uc; dst = nlUtf8ToTStr(src);
uc.fromUtf8(src);
dst = (const mwchar_t *)uc.c_str();
#else #else
dst.FromUTF8(src.c_str()); dst.FromUTF8(src.c_str());
#endif #endif
@ -49,14 +48,7 @@ static TSTR MaxTStrFromUtf8(const std::string &src)
static std::string MaxTStrToUtf8(const TSTR& src) static std::string MaxTStrToUtf8(const TSTR& src)
{ {
#if (MAX_VERSION_MAJOR < 15) #if (MAX_VERSION_MAJOR < 15)
#ifdef _UNICODE return NLMISC::tStrToUtf8(src.data());
ucstring uc(src.data());
return uc.toUtf8();
#else
WStr ws = src;
ucstring uc((const ucchar *)ws.data());
return uc.toUtf8();
#endif
#else #else
return src.ToUTF8().data(); return src.ToUTF8().data();
#endif #endif
@ -64,13 +56,7 @@ static std::string MaxTStrToUtf8(const TSTR& src)
static std::string MCharStrToUtf8(const MCHAR *src) static std::string MCharStrToUtf8(const MCHAR *src)
{ {
#ifdef _UNICODE return NLMISC::tStrToUtf8(src);
ucstring uc((const ucchar *)src);
return uc.toUtf8();
#else
ucstring uc((const ucchar *)WStr(src).data());
return uc.toUtf8();
#endif
} }
#endif /* #ifndef NLMAX_STRING_COMMON_H */ #endif /* #ifndef NLMAX_STRING_COMMON_H */

@ -1271,7 +1271,7 @@ Value* get_patch_vertex_cf (Value** arg_list, int count)
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
// We want to use 'TurnAllTexturesOn <object to use>' // We want to use 'TurnAllTexturesOn <object to use>'
const MCHAR *message= _M("NeLGetPatchVertex [NeLPatchMesh] [PatchId] [VertexId]"); MCHAR *message= _M("NeLGetPatchVertex [NeLPatchMesh] [PatchId] [VertexId]");
type_check(arg_list[0], MAXNode, message); type_check(arg_list[0], MAXNode, message);
type_check(arg_list[1], Integer, message); type_check(arg_list[1], Integer, message);
type_check(arg_list[2], Integer, message); type_check(arg_list[2], Integer, message);

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

Loading…
Cancel
Save