Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Compilation error in Src/Modules/curses.c on HP-UX



On Mon, Dec 17, 2007 at 12:41:33AM +0000, Paul Ackersviller wrote:
> 1332     if (getyx(w->win, intarr[0], intarr[1]) == ERR ||
> 1333   getbegyx(w->win, intarr[2], intarr[3]) == ERR ||
> 1334   getmaxyx(w->win, intarr[4], intarr[5]) == ERR)

These are all defined as returning void in both the linux docs and hp
docs that I checked.  So this checking of the return values is illegal.

I didn't check-in the attached patch because my zsh build isn't building
this code.

..wayne..
--- Src/Modules/curses.c	14 Dec 2007 15:14:07 -0000	1.43
+++ Src/Modules/curses.c	17 Dec 2007 01:36:15 -0000
@@ -1329,9 +1329,14 @@ zccmd_position(const char *nam, char **a
     w = (ZCWin)getdata(node);
 
     /* Look no pointers:  these are macros. */
-    if (getyx(w->win, intarr[0], intarr[1]) == ERR ||
-	getbegyx(w->win, intarr[2], intarr[3]) == ERR ||
-	getmaxyx(w->win, intarr[4], intarr[5]) == ERR)
+    getyx(w->win, intarr[0], intarr[1]);
+    if (intarr[0] == -1)
+	return 1;
+    getbegyx(w->win, intarr[2], intarr[3]);
+    if (intarr[2] == -1)
+	return 1;
+    getmaxyx(w->win, intarr[4], intarr[5]);
+    if (intarr[4] == -1)
 	return 1;
 
     array = (char **)zalloc(7*sizeof(char *));


Messages sorted by: Reverse Date, Date, Thread, Author