[Scummvm-git-logs] scummvm master -> 09ed7592bda7af959e87d4134988fc60d1b109ad

dreammaster dreammaster at scummvm.org
Mon Jul 12 03:41:42 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c321401328 AGS: Pointers should not be casted to long
09ed7592bd AGS: Pointers should not be casted to long


Commit: c321401328a74c01f420a0de1dbe83ed4f173b4b
    https://github.com/scummvm/scummvm/commit/c321401328a74c01f420a0de1dbe83ed4f173b4b
Author: aviloria (aviloria at yahoo.com)
Date: 2021-07-11T20:41:39-07:00

Commit Message:
AGS: Pointers should not be casted to long

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

Changed paths:
    engines/ags/lib/allegro/unicode.cpp


diff --git a/engines/ags/lib/allegro/unicode.cpp b/engines/ags/lib/allegro/unicode.cpp
index b1537585aa..bd3ee1d6bf 100644
--- a/engines/ags/lib/allegro/unicode.cpp
+++ b/engines/ags/lib/allegro/unicode.cpp
@@ -1132,7 +1132,7 @@ int uoffset(const char *s, int index) {
 		}
 	}
 
-	return (long)s - (long)orig;
+	return (intptr_t)s - (intptr_t)orig;
 }
 
 char *ustrlwr(char *s) {
@@ -1209,7 +1209,7 @@ int ustrsizez(const char *s) {
 	do {
 	} while (ugetxc(&s) != 0);
 
-	return (long)s - (long)orig;
+	return (intptr_t)s - (intptr_t)orig;
 }
 
 } // namespace AGS3


Commit: 09ed7592bda7af959e87d4134988fc60d1b109ad
    https://github.com/scummvm/scummvm/commit/09ed7592bda7af959e87d4134988fc60d1b109ad
Author: aviloria (aviloria at yahoo.com)
Date: 2021-07-11T20:41:39-07:00

Commit Message:
AGS: Pointers should not be casted to long

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

Changed paths:
    engines/ags/engine/ac/string.cpp


diff --git a/engines/ags/engine/ac/string.cpp b/engines/ags/engine/ac/string.cpp
index 9cdd215924..9610c7c61b 100644
--- a/engines/ags/engine/ac/string.cpp
+++ b/engines/ags/engine/ac/string.cpp
@@ -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;
 }
 




More information about the Scummvm-git-logs mailing list