Page 1 of 1

[fixed] CAttributeImpl.h CEnumAttribute::getInt()

Posted: Sun Jun 19, 2016 5:57 pm
by luthyr
Shouldn't

Code: Select all

 
virtual s32 getInt() _IRR_OVERRIDE_
 {
     for (s32 i=0; EnumLiterals.size(); ++i)
         if (Value.equals_ignore_case(EnumLiterals[i]))
         {
             return i;
         }
 
     return -1;
 }
 
be

Code: Select all

 
virtual s32 getInt() _IRR_OVERRIDE_
{
    for (u32 i=0; i < EnumLiterals.size(); ++i)
        if (Value.equals_ignore_case(EnumLiterals[i]))
        {
            return i;
        }
    return -1;
}
 

Re: CAttributeImpl.h CEnumAttribute::getInt() for loop wrong

Posted: Sun Jun 19, 2016 6:29 pm
by CuteAlien
Yeah, I agree. Fixed in svn trunk r5306. Thanks for reporting!

Re: [fixed] CAttributeImpl.h CEnumAttribute::getInt()

Posted: Thu Jul 07, 2016 2:57 pm
by luthyr
I saw this was changed, but the key difference I was reporting is missing:

i < EnumLiterals.size()

It's been several days since I looked at this, but I think the reason I was reporting it was because at some point I encountered a crash because it went passed the bounds of EnumLiterals.

Re: [fixed] CAttributeImpl.h CEnumAttribute::getInt()

Posted: Thu Jul 07, 2016 4:13 pm
by CuteAlien
Argh - the problem when there are 2 changes in one line.
I didn't see the real bug and thought you just switched u32 and s32 :-)
Hm, this fix even belongs in 1.8 branch - so fixed there for now. Merge with trunk will follow next days.

Re: [fixed] CAttributeImpl.h CEnumAttribute::getInt()

Posted: Thu Jul 07, 2016 4:20 pm
by luthyr
Yeah, sorry about that. :P