Rearrange logic to address type mismatch spotted by clang 15

This commit is contained in:
jca 2023-01-12 13:17:19 +00:00
parent 947759f5fa
commit 5fdfdd96cc
2 changed files with 26 additions and 1 deletions

View File

@ -1,7 +1,7 @@
COMMENT= X11-based presentation tool
DISTNAME= magicpoint-1.09a
REVISION= 3
REVISION= 4
EPOCH= 0
CATEGORIES= misc productivity
MASTER_SITES= ftp://sh.wide.ad.jp/WIDE/free-ware/mgp/

View File

@ -0,0 +1,25 @@
Fix with clang 15: invalid pointer to integer conversion.
Index: mgp.c
--- mgp.c.orig
+++ mgp.c
@@ -448,16 +448,16 @@ genhtml(start_page)
char *childdebug;
char convdb[][3][16] = {{ "jpg", "cjpeg", "djpeg" },
{ "png", "pnmtopng", "pngtopnm" },
- { NULL, NULL, NULL }};
+ { "", "", "" }};
int inum = 0;
/* check image type */
if (htmlimage) {
- for (inum = 0; *convdb[inum] != NULL; inum++) {
+ for (inum = 0; **convdb[inum] != '\0'; inum++) {
if (strcmp(*convdb[inum], htmlimage) == 0)
break;
}
- if (*convdb[inum] == NULL) {
+ if (**convdb[inum] == '\0') {
fprintf(stderr, "unknwon image type %s.\n", htmlimage);
cleanup(-1);
}