some fixes.

This commit is contained in:
tluqo 2014-02-17 21:28:38 +01:00
parent 67df575f5a
commit a7d55f8ce4
7 changed files with 11 additions and 14 deletions

View file

@ -5,7 +5,7 @@
#include <cassert>
#include <malloc.h>
static const uint32_t LUX_MAX_PATH = 260;
const uint32_t LUX_MAX_PATH = 260;
#ifndef ASSERT
#define ASSERT(x) assert(x)

View file

@ -64,7 +64,7 @@ namespace Lux
if(INVALID_HANDLE_VALUE != hnd)
{
OsFileImpl* impl = LUX_NEW(OsFileImpl)(); //TODO: lock-free free list
OsFileImpl* impl = LUX_NEW(OsFileImpl); //TODO: lock-free free list
impl->m_file = hnd;
m_impl = impl;

View file

@ -12,14 +12,12 @@ namespace Lux
: m_id(rhs.m_id)
{
uint32_t len = strlen(rhs.m_path);
m_path = LUX_NEW_ARRAY(char, len + 1);
strcpy(m_path, rhs.m_path);
}
Path::Path(const char* path)
{
uint32_t len = strlen(path);
m_path = LUX_NEW_ARRAY(char, len + 1);
PathUtils::normalize(path, m_path, len + 1);
m_id = crc32(m_path);
}
@ -28,12 +26,10 @@ namespace Lux
: m_id(id)
{
uint32_t len = strlen(path);
m_path = LUX_NEW_ARRAY(char, len + 1);
strcpy(m_path, path);
}
Path::~Path()
{
LUX_DELETE_ARRAY(m_path);
}
}

View file

@ -6,9 +6,10 @@ namespace Lux
{
public:
LUX_FORCE_INLINE Path()
: m_path(NULL)
, m_id(0)
{ }
: m_id(0)
{
m_path[0] = '\0';
}
Path(const Path& rhs);
Path(const char* path);
@ -26,7 +27,7 @@ namespace Lux
bool isValid() { return NULL != m_path; }
private:
char* m_path;
char m_path[LUX_MAX_PATH];
uint32_t m_id;
};
}

View file

@ -10,7 +10,7 @@ namespace Lux
while (*path != '\0' && i < max_size)
{
*out = *path == '/' ? '\\' : *path;
*out = *path >= 'A' && *path <= 'Z' ? *path - 'a' : *path;
*out = *path >= 'A' && *path <= 'Z' ? *path - 'A' + 'a' : *out;
path++;
out++;

View file

@ -18,10 +18,10 @@ namespace Lux
LOADING,
READY,
UNLOADING,
ERROR_
ERROR
};
State() : value(0) { }
State() : value(EMPTY) { }
State(Value _value) : value(_value) { }
State(int32_t _value) : value(_value) { }
operator Value() const { return (Value)value; }

View file

@ -166,7 +166,7 @@ void RendererImpl::loadResources()
{
h3dLoadResource(res, NULL, 0);
sprintf_s(path, "%s%s/%s", m_base_path.c_str(), h3dutGetResourcePath(h3dGetResType(res)), h3dGetResName(res));
LoadInfo* info = LUX_NEW(LoadInfo)();
LoadInfo* info = LUX_NEW(LoadInfo);
info->m_renderer_impl = this;
info->m_res = res;