Skip to content

Commit

Permalink
CHUImporter: avoid unsigned -> signed voodoo that breaks on BE
Browse files Browse the repository at this point in the history
  • Loading branch information
bradallred committed Dec 30, 2013
1 parent 4322276 commit 8541ff2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions gemrb/plugins/CHUImporter/CHUImporter.cpp
Expand Up @@ -118,15 +118,20 @@ Window* CHUImporter::GetWindow(unsigned int wid)
str->Seek( CTOffset + ( ( FirstControl + i ) * 8 ), GEM_STREAM_START );
ieDword COffset, CLength, ControlID;
Region ctrlFrame;
ieWord tmp;
ieByte ControlType, temp;
str->ReadDword( &COffset );
str->ReadDword( &CLength );
str->Seek( COffset, GEM_STREAM_START );
str->ReadDword( &ControlID );
str->ReadWord( (ieWord*)&ctrlFrame.x );
str->ReadWord( (ieWord*)&ctrlFrame.y );
str->ReadWord( (ieWord*)&ctrlFrame.w );
str->ReadWord( (ieWord*)&ctrlFrame.h );
str->ReadWord( &tmp );
ctrlFrame.x = tmp;
str->ReadWord( &tmp);
ctrlFrame.y = tmp;
str->ReadWord( &tmp );
ctrlFrame.w = tmp;
str->ReadWord( &tmp );
ctrlFrame.h = tmp;
str->Read( &ControlType, 1 );
str->Read( &temp, 1 );
switch (ControlType) {
Expand Down

2 comments on commit 8541ff2

@wjp
Copy link
Member

@wjp wjp commented on 8541ff2 Dec 30, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the commit message: it was not the unsigned/signed difference that was problematic, but the short/int.

@bradallred
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i realized that after too, i was just blindly going of what lynx said. Believe me I'm plenty embarrassed for making the mistake in the first place and now this :(

Please sign in to comment.