Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CHUImporter: avoid unsigned -> signed voodoo that breaks on BE

  • Loading branch information...
commit 8541ff2e13b491ec58c146b59642b9be6cf4819b 1 parent 4322276
@bradallred bradallred authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 gemrb/plugins/CHUImporter/CHUImporter.cpp
View
13 gemrb/plugins/CHUImporter/CHUImporter.cpp
@@ -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) {

2 comments on commit 8541ff2

@wjp
Owner

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

@bradallred
Owner

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.
Something went wrong with that request. Please try again.