[Scummvm-git-logs] scummvm master -> 08759141c1cf830c2222d551033c2a5ec4f306f4

digitall noreply at scummvm.org
Mon Apr 4 12:29:58 UTC 2022


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

Summary:
08759141c1 AGS: Fix Remaining Cast Qualification Warnings in Unicode Font Code


Commit: 08759141c1cf830c2222d551033c2a5ec4f306f4
    https://github.com/scummvm/scummvm/commit/08759141c1cf830c2222d551033c2a5ec4f306f4
Author: D G Turner (digitall at scummvm.org)
Date: 2022-04-04T13:29:30+01:00

Commit Message:
AGS: Fix Remaining Cast Qualification Warnings in Unicode Font Code

This was due to an issue with C++ which has issues with "const char **"
as a _partially_ constant pointer type and requires this modifying to
"char const* const*" to be fully const which can also be written
as "const char* const*" which fixes the API without requiring excessive
casts and removes the various GCC Compiler Warnings emitted when
-Wcast-qual is passed.

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


diff --git a/engines/ags/lib/alfont/alfont.cpp b/engines/ags/lib/alfont/alfont.cpp
index 36a5a668dfd..0d902f8c40e 100644
--- a/engines/ags/lib/alfont/alfont.cpp
+++ b/engines/ags/lib/alfont/alfont.cpp
@@ -1015,9 +1015,9 @@ void alfont_textout_aa_ex(BITMAP *bmp, ALFONT_FONT *f, const char *s, int x, int
 		_alfont_uncache_glyphs(f);
 
 #ifdef ALFONT_LINUX //Fix for Linux Unicode System(be converted)
-		for (character = ugetxc((const char **)&lpszW_tmp); character != 0; character = ugetxc((const char **)&lpszW_tmp), character = ugetxc((const char **)&lpszW_tmp)) {
+		for (character = ugetxc(&lpszW_tmp); character != 0; character = ugetxc(&lpszW_tmp), character = ugetxc(&lpszW_tmp)) {
 #else
-		for (character = ugetxc((const char **)&lpszW_tmp); character != 0; character = ugetxc((const char **)&lpszW_tmp)) {
+		for (character = ugetxc(&lpszW_tmp); character != 0; character = ugetxc(&lpszW_tmp)) {
 #endif
 			int glyph_index_tmp;
 			struct _ALFONT_CACHED_GLYPH cglyph_tmp;
@@ -1052,9 +1052,9 @@ void alfont_textout_aa_ex(BITMAP *bmp, ALFONT_FONT *f, const char *s, int x, int
 
 
 #ifdef ALFONT_LINUX //Fix for Linux Unicode System(be converted)
-	for (character = ugetxc((const char **)&lpszW); character != 0; character = ugetxc((const char **)&lpszW), character = ugetxc((const char **)&lpszW)) {
+	for (character = ugetxc(&lpszW); character != 0; character = ugetxc(&lpszW), character = ugetxc(&lpszW)) {
 #else
-	for (character = ugetxc((const char **)&lpszW); character != 0; character = ugetxc((const char **)&lpszW)) {
+	for (character = ugetxc(&lpszW); character != 0; character = ugetxc(&lpszW)) {
 #endif
 		int real_x, real_y, glyph_index;
 		struct _ALFONT_CACHED_GLYPH cglyph;
@@ -2086,9 +2086,9 @@ void alfont_textout_ex(BITMAP * bmp, ALFONT_FONT * f, const char *s, int x, int
 		_alfont_uncache_glyphs(f);
 
 #ifdef ALFONT_LINUX //Fix for Linux Unicode System(be converted)
-		for (character = ugetxc((const char **)&lpszW_tmp); character != 0; character = ugetxc((const char **)&lpszW_tmp), character = ugetxc((const char **)&lpszW_tmp)) {
+		for (character = ugetxc(&lpszW_tmp); character != 0; character = ugetxc(&lpszW_tmp), character = ugetxc(&lpszW_tmp)) {
 #else
-		for (character = ugetxc((const char **)&lpszW_tmp); character != 0; character = ugetxc((const char **)&lpszW_tmp)) {
+		for (character = ugetxc(&lpszW_tmp); character != 0; character = ugetxc(&lpszW_tmp)) {
 #endif
 			int glyph_index_tmp;
 			struct _ALFONT_CACHED_GLYPH cglyph_tmp;
@@ -2122,9 +2122,9 @@ void alfont_textout_ex(BITMAP * bmp, ALFONT_FONT * f, const char *s, int x, int
 		}
 
 #ifdef ALFONT_LINUX //Fix for Linux Unicode System(be converted)
-	for (character = ugetxc((const char **)&lpszW); character != 0; character = ugetxc((const char **)&lpszW), character = ugetxc((const char **)&lpszW)) {
+	for (character = ugetxc(&lpszW); character != 0; character = ugetxc(&lpszW), character = ugetxc(&lpszW)) {
 #else
-	for (character = ugetxc((const char **)&lpszW); character != 0; character = ugetxc((const char **)&lpszW)) {
+	for (character = ugetxc(&lpszW); character != 0; character = ugetxc(&lpszW)) {
 #endif
 		int real_x, real_y, glyph_index;
 		struct _ALFONT_CACHED_GLYPH cglyph;
@@ -2872,9 +2872,9 @@ int alfont_text_length(ALFONT_FONT * f, const char *str) {
 		_alfont_uncache_glyphs(f);
 
 #ifdef ALFONT_LINUX //Fix for Linux Unicode System(be converted)
-		for (character = ugetxc((const char **)&lpszW_tmp); character != 0; character = ugetxc((const char **)&lpszW_tmp), character = ugetxc((const char **)&lpszW_tmp)) {
+		for (character = ugetxc(&lpszW_tmp); character != 0; character = ugetxc(&lpszW_tmp), character = ugetxc(&lpszW_tmp)) {
 #else
-		for (character = ugetxc((const char **)&lpszW_tmp); character != 0; character = ugetxc((const char **)&lpszW_tmp)) {
+		for (character = ugetxc(&lpszW_tmp); character != 0; character = ugetxc(&lpszW_tmp)) {
 #endif
 			/* get the character out of the font */
 
@@ -2898,9 +2898,9 @@ int alfont_text_length(ALFONT_FONT * f, const char *str) {
 		}
 
 #ifdef ALFONT_LINUX //Fix for Linux Unicode System(be converted)
-	for (character = ugetxc((const char **)&lpszW); character != 0; character = ugetxc((const char **)&lpszW), character = ugetxc((const char **)&lpszW)) {
+	for (character = ugetxc(&lpszW); character != 0; character = ugetxc(&lpszW), character = ugetxc(&lpszW)) {
 #else
-	for (character = ugetxc((const char **)&lpszW); character != 0; character = ugetxc((const char **)&lpszW)) {
+	for (character = ugetxc(&lpszW); character != 0; character = ugetxc(&lpszW)) {
 #endif
 		/* get the character out of the font */
 
@@ -3749,14 +3749,14 @@ int alfont_ugetx(ALFONT_FONT * f, char **s) {
 	//advances the *s pointer to the next character
 
 	if (f->type == 1) {
-		ugetxc((const char **)s);
+		ugetxc(s);
 #ifdef ALFONT_LINUX
-		ugetxc((const char **)s);
+		ugetxc(s);
 #endif
 	} else if (f->type == 2) {
-		ugetxc((const char **)&lpszWS);
+		ugetxc(&lpszWS);
 #ifdef ALFONT_LINUX
-		ugetxc((const char **)&lpszWS);
+		ugetxc(&lpszWS);
 #endif
 #ifdef ALFONT_DOS
 		if ((c_pt = iconv_open(f->language, "UTF-16LE")) == (iconv_t)-1) {
@@ -3798,9 +3798,9 @@ int alfont_ugetx(ALFONT_FONT * f, char **s) {
 #ifdef ALFONT_LINUX
 		set_uformat(U_UTF8);
 #endif
-		ugetxc((const char **)s);
+		ugetxc(s);
 #ifdef ALFONT_LINUX
-		ugetxc((const char **)s);
+		ugetxc(s);
 #endif
 	}
 
@@ -4056,14 +4056,14 @@ int alfont_ugetxc(ALFONT_FONT * f, const char **s) {
 	//advances the *s pointer to the next character
 
 	if (f->type == 1) {
-		ugetxc((const char **)s);
+		ugetxc(s);
 #ifdef ALFONT_LINUX
-		ugetxc((const char **)s);
+		ugetxc(s);
 #endif
 	} else if (f->type == 2) {
-		ugetxc((const char **)&lpszWS);
+		ugetxc(&lpszWS);
 #ifdef ALFONT_LINUX
-		ugetxc((const char **)&lpszWS);
+		ugetxc(&lpszWS);
 #endif
 #ifdef ALFONT_DOS
 		if ((c_pt = iconv_open(f->language, "UTF-16LE")) == (iconv_t)-1) {
diff --git a/engines/ags/lib/allegro/unicode.cpp b/engines/ags/lib/allegro/unicode.cpp
index 683a877485e..1726b7825a3 100644
--- a/engines/ags/lib/allegro/unicode.cpp
+++ b/engines/ags/lib/allegro/unicode.cpp
@@ -30,7 +30,7 @@ int (*ugetc)(const char *s) = utf8_getc;
 /* ugetxc: */
 int (*ugetx)(char **s) = utf8_getx;
 /* ugetxc: */
-int (*ugetxc)(const char **s) = (int (*)(const char **)) utf8_getx;
+int (*ugetxc)(const char * const *s) = (int (*)(const char * const *)) utf8_getx;
 /* usetc: */
 int (*usetc)(char *s, int c) = utf8_setc;
 /* uwidth: */
@@ -82,7 +82,7 @@ void set_uformat(int type) {
 		_G(utype) = info->id;
 		ugetc = info->u_getc;
 		ugetx = (int (*)(char **)) info->u_getx;
-		ugetxc = (int (*)(AL_CONST char **)) info->u_getx;
+		ugetxc = (int (*)(AL_CONST char * const*)) info->u_getx;
 		usetc = info->u_setc;
 		uwidth = info->u_width;
 		ucwidth = info->u_cwidth;
diff --git a/engines/ags/lib/allegro/unicode.h b/engines/ags/lib/allegro/unicode.h
index 81c30746ef2..ef1175d524e 100644
--- a/engines/ags/lib/allegro/unicode.h
+++ b/engines/ags/lib/allegro/unicode.h
@@ -57,7 +57,7 @@ extern int (*ugetc)(const char *s);
 /* ugetxc: */
 extern int (*ugetx)(char **s);
 /* ugetxc: */
-extern int (*ugetxc)(const char **s);
+extern int (*ugetxc)(const char * const *s);
 /* usetc: */
 extern int (*usetc)(char *s, int c);
 /* uwidth: */




More information about the Scummvm-git-logs mailing list