invalid pointer (64bit) -> int (32bit) casts in current source #60

Closed
rofl0r opened this Issue Mar 28, 2013 · 4 comments

Comments

Projects
None yet
2 participants
Contributor

rofl0r commented Mar 28, 2013

ac/roomstatus.cpp: In member function ‘void RoomStatus::WriteToFile_v321(AGS::Common::Stream_)’:
ac/roomstatus.cpp:58:26: warning: cast from ‘char_’ to ‘int’ loses precision

ac/gamestate.cpp: In member function ‘void GameState::WriteToFile_v321(AGS::Common::Stream_)’:
ac/gamestate.cpp:379:28: warning: cast from ‘int_’ to ‘int’ loses precision
ac/gamestate.cpp:380:28: warning: cast from ‘char**’ to ‘int’ loses precision

media/audio/queuedaudioitem.cpp:37:28: warning: cast from ‘SOUNDCLIP*’ to ‘int’ loses precision

../Common/ac/gamesetupstructbase.cpp:91:28: warning: cast from ‘char_’ to ‘int’ loses precision
../Common/ac/gamesetupstructbase.cpp:92:28: warning: cast from ‘CharacterInfo_’ to ‘int’ loses precision
../Common/ac/gamesetupstructbase.cpp:93:28: warning: cast from ‘ccScript*’ to ‘int’ loses precision

Owner

ivan-mogilko commented Mar 28, 2013

Yes, these pointers are saved as 4-byte value there. The value itself does not make sense there, it is used just as a flag to tell that an object did exist and should be recreated on game load.
This was supposed to be fixed at some point, but probably just forgotten considered low priority.

E: Now, however, thinking more about this, if the 64-bit pointer has meaningful value in the upper bits, this "flag" will have incorrect value.
Should be fixed ASAP then.

Owner

ivan-mogilko commented Mar 28, 2013

Hmm, either my info is outdated, or I confused this with something else. But I don't see if the related pointers from RoomStatus, GameState and SOUNDCLIP were used the way I thought the are. Only the ones from GameSetupStruct are.

Perhaps, some of those could be simply skipped during save/load. This should be checked more carefully.

Contributor

rofl0r commented Aug 6, 2013

any updates on this since you're closing it ?

Owner

ivan-mogilko commented Aug 6, 2013

Well, I changed the code where possible, either removing saving/loading pointers (where they were not needed), or making more explicit conversion (usually writing boolean value instead of pointer value).

E: I did this few months ago, just forgot to update this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment