[PATCH] fix new compiler warnings

dana <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
mikael's recent batch of fixes introduced some new warnings for me

the termcap+terminfo ones are because older versions of ncurses lack
const qualifiers on some of their prototypes. i just cast the const away
on all of them, hope that's fine

ps: after this i think we're ready for a 5.9.1 test release. will try to
put one together this week end

dana


diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index 5cb03046d..f07ce7fd2 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -1419,7 +1419,7 @@ zccmd_position(const char *nam, char **args)
     }
     array[6] = NULL;
 
-    !setaparam(args[1], array);
+    return !setaparam(args[1], array);
 }
 
 
diff --git a/Src/Modules/termcap.c b/Src/Modules/termcap.c
index fade8f151..2187bec42 100644
--- a/Src/Modules/termcap.c
+++ b/Src/Modules/termcap.c
@@ -59,7 +59,7 @@ ztgetflag(const char *s)
      * off, but other curses variants can't, so we fudge it. *
      * This feature of ncurses appears to have gone away as  *
      * of NCURSES_MAJOR_VERSION == 5, so don't rely on it.   */
-    switch (tgetflag(s)) {
+    switch (tgetflag((char *) s)) {
     case -1:
 	break;
     case 0:
@@ -177,7 +177,7 @@ gettermcap(UNUSED(HashTable ht), const char *name)
 
     /* logic in the following cascade copied from echotc, above */
 
-    if ((num = tgetnum(name)) != -1) {
+    if ((num = tgetnum((char *) name)) != -1) {
 	pm->gsu.i = &nullsetinteger_gsu;
 	pm->u.val = num;
 	pm->node.flags |= PM_INTEGER;
@@ -197,7 +197,7 @@ gettermcap(UNUSED(HashTable ht), const char *name)
 	pm->node.flags |= PM_SCALAR;
 	return &pm->node;
     }
-    if ((tcstr = tgetstr(name, &u)) != NULL && tcstr != (char *)-1) {
+    if ((tcstr = tgetstr((char *) name, &u)) != NULL && tcstr != (char *)-1) {
 	pm->u.str = dupstring(tcstr);
 	pm->node.flags |= PM_SCALAR;
     } else {
diff --git a/Src/Modules/terminfo.c b/Src/Modules/terminfo.c
index 7ce162e81..1df5f5c30 100644
--- a/Src/Modules/terminfo.c
+++ b/Src/Modules/terminfo.c
@@ -164,15 +164,16 @@ getterminfo(UNUSED(HashTable ht), const char *name)
     pm->node.nam = dupstring(name);
     pm->node.flags = PM_READONLY;
 
-    if (((num = tigetnum(name)) != -1) && (num != -2)) {
+    if (((num = tigetnum((char *) name)) != -1) && (num != -2)) {
 	pm->u.val = num;
 	pm->node.flags |= PM_INTEGER;
 	pm->gsu.i = &nullsetinteger_gsu;
-    } else if ((num = tigetflag(name)) != -1) {
+    } else if ((num = tigetflag((char *) name)) != -1) {
 	pm->u.str = num ? dupstring("yes") : dupstring("no");
 	pm->node.flags |= PM_SCALAR;
 	pm->gsu.s = &nullsetscalar_gsu;
-    } else if ((tistr = (char *)tigetstr(name)) != NULL && tistr != (char *)-1) {
+    } else if ((tistr = (char *)tigetstr((char *) name)) != NULL &&
+	    tistr != (char *)-1) {
 	pm->u.str = metafy(tistr, -1, META_HEAPDUP);
 	pm->node.flags |= PM_SCALAR;
 	pm->gsu.s = &nullsetscalar_gsu;
diff --git a/Src/jobs.c b/Src/jobs.c
index fc79a3f3a..43fbc08b7 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2819,7 +2819,6 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 		    while (*++argv) {
 			status = zstrtol(*argv, &signame, 10);
 			if (signame == *argv) {
-			    int rtsig;
 			    signame = casemodify(signame, CASMOD_UPPER);
 			    if (!strncmp(signame, "SIG", 3))
 				signame += 3;
@@ -2837,6 +2836,7 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 				    }
 			    }
 #if defined(SIGRTMIN) && defined(SIGRTMAX)
+			    int rtsig;
 			    if (sig > SIGCOUNT && (rtsig = rtsigno(signame))) {
 				printf("%d\n", rtsig);
 			    } else
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.