Skip to content

Commit

Permalink
AGS: Pointers should not be casted to long
Browse files Browse the repository at this point in the history
New string arithmetic is using pointers diff casted to long...
Trying to avoid C++11 features, the best option is to cast them to intptr_t instead of long
  • Loading branch information
aviloria authored and dreammaster committed Jul 12, 2021
1 parent c321401 commit 09ed759
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engines/ags/engine/ac/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ size_t break_up_text_into_lines(const char *todis, SplitLines &lines, int wii, i
int MAXSTRLEN = MAX_MAXSTRLEN;
void check_strlen(char *ptt) {
MAXSTRLEN = MAX_MAXSTRLEN;
long charstart = (long)&_GP(game).chars[0];
long charstart = (intptr_t)&_GP(game).chars[0];
long charend = charstart + sizeof(CharacterInfo) * _GP(game).numcharacters;
if (((long)&ptt[0] >= charstart) && ((long)&ptt[0] <= charend))
if (((intptr_t)&ptt[0] >= charstart) && ((intptr_t)&ptt[0] <= charend))
MAXSTRLEN = 30;
}

Expand Down

0 comments on commit 09ed759

Please sign in to comment.