Commit 1b1d18b6 authored by cutealien's avatar cutealien

Make CUserPointerAttribute::setString work on 64-bit systems.

Should also still work on 32-bit (I hope, don't have a 32-bit environment right now).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4799 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 7bf3b8a3
......@@ -2032,9 +2032,24 @@ public:
virtual void setString(const char* text) _IRR_OVERRIDE_
{
u32 tmp;
sscanf(text, "0x%x", &tmp);
Value = (void *) tmp;
size_t val = 0;
switch ( sizeof(void*) )
{
case 4:
{
unsigned int tmp; // not using an irrlicht type - sscanf with %x needs always unsigned int
sscanf(text, "0x%x", &tmp);
val = (size_t)tmp;
}
break;
case 8:
{
unsigned long long tmp = strtoull(text, NULL, 16);
val = (size_t)tmp;
}
break;
}
Value = (void *)val;
}
virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment