Another blind fix
This commit is contained in:
@@ -13,6 +13,37 @@ using namespace pugi;
|
||||
|
||||
Array<ProjectInfo*> ProjectInfo::ProjectsCache;
|
||||
|
||||
struct XmlCharAsChar
|
||||
{
|
||||
#if PLATFORM_TEXT_IS_CHAR16
|
||||
Char* Str = nullptr;
|
||||
|
||||
XmlCharAsChar(const pugi::char_t* str)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
int32 length = 0;
|
||||
while (str[length])
|
||||
length++;
|
||||
Str = (Char*)Platform::Allocate(length * sizeof(Char), sizeof(Char));
|
||||
for (int32 i = 0; i <= length; i++)
|
||||
Str[i] = (Char)str[i];
|
||||
}
|
||||
|
||||
~XmlCharAsChar()
|
||||
{
|
||||
Platform::Free(Str);
|
||||
}
|
||||
#else
|
||||
const Char* Str;
|
||||
|
||||
XmlCharAsChar(const pugi::char_t* str)
|
||||
: Str(str)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
void ShowProjectLoadError(const Char* errorMsg, const String& projectRootFolder)
|
||||
{
|
||||
Platform::Error(String::Format(TEXT("Failed to load project. {0}\nPath: '{1}'"), errorMsg, projectRootFolder));
|
||||
@@ -28,8 +59,9 @@ Vector3 GetVector3FromXml(const xml_node& parent, const PUGIXML_CHAR* name, cons
|
||||
const auto z = node.child_value(PUGIXML_TEXT("Z"));
|
||||
if (x && y && z)
|
||||
{
|
||||
XmlCharAsChar xs(x), ys(y), zs(z);
|
||||
Vector3 v;
|
||||
if (!StringUtils::Parse(x, &v.X) && !StringUtils::Parse(y, &v.Y) && !StringUtils::Parse(z, &v.Z))
|
||||
if (!StringUtils::Parse(xs.Str, &v.X) && !StringUtils::Parse(ys.Str, &v.Y) && !StringUtils::Parse(zs.Str, &v.Z))
|
||||
{
|
||||
return v;
|
||||
}
|
||||
@@ -44,8 +76,9 @@ int32 GetIntFromXml(const xml_node& parent, const PUGIXML_CHAR* name, const int3
|
||||
const auto node = parent.child_value(name);
|
||||
if (node)
|
||||
{
|
||||
XmlCharAsChar s(node);
|
||||
int32 v;
|
||||
if (!StringUtils::Parse(node, &v))
|
||||
if (!StringUtils::Parse(s.Str, &v))
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -15,21 +15,6 @@ constexpr char DirectorySeparatorChar = '\\';
|
||||
constexpr char AltDirectorySeparatorChar = '/';
|
||||
constexpr char VolumeSeparatorChar = ':';
|
||||
|
||||
#if PLATFORM_TEXT_IS_CHAR16
|
||||
|
||||
int32 StringUtils::Length(const wchar_t* str)
|
||||
{
|
||||
int32 result = 0;
|
||||
if (str)
|
||||
{
|
||||
while (*str)
|
||||
str++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
const Char* StringUtils::FindIgnoreCase(const Char* str, const Char* toFind)
|
||||
{
|
||||
if (toFind == nullptr || str == nullptr)
|
||||
|
||||
@@ -186,8 +186,8 @@ API_ENUM() enum class ArchitectureType
|
||||
#ifndef PLATFORM_ARCH_ARM64
|
||||
#define PLATFORM_ARCH_ARM64 0
|
||||
#endif
|
||||
#ifndef PLATFORM_WCHAR_IS_CHAR16
|
||||
#define PLATFORM_WCHAR_IS_CHAR16 0
|
||||
#ifndef PLATFORM_TEXT_IS_CHAR16
|
||||
#define PLATFORM_TEXT_IS_CHAR16 0
|
||||
#endif
|
||||
#ifndef PLATFORM_DEBUG_BREAK
|
||||
#define PLATFORM_DEBUG_BREAK
|
||||
|
||||
@@ -115,9 +115,6 @@ public:
|
||||
public:
|
||||
// Gets the string length. Returns 0 if str is null.
|
||||
static int32 Length(const Char* str);
|
||||
#if PLATFORM_TEXT_IS_CHAR16
|
||||
static int32 Length(const wchar_t* str);
|
||||
#endif
|
||||
|
||||
// Gets the string length. Returns 0 if str is null.
|
||||
static int32 Length(const char* str);
|
||||
|
||||
Reference in New Issue
Block a user