[Curses] Print warnings on errors (1/5)

Peter Berg Larsen pebl at math.ku.dk
Sat Nov 29 01:28:57 CST 2003


Changelog:
- Print a message when failing to allocate memory, refresh a line or
  allocate colors (as these are used later)
-------------- next part --------------
diff -ur wine-20031016/programs/wineconsole/curses.c wine-my/programs/wineconsole/curses.c
--- wine-20031016/programs/wineconsole/curses.c	2003-10-15 23:01:05.000000000 +0200
+++ wine-my/programs/wineconsole/curses.c	2003-11-14 05:20:46.000000000 +0100
@@ -229,6 +229,8 @@
     else 
 	PRIVATE(data)->line = HeapAlloc(GetProcessHeap(), 0, 
                                       sizeof(chtype) * data->curcfg.sb_width);
+    if (!PRIVATE(data)->line)
+        WINE_FIXME("Cannot create line\n");
 }
 
 /******************************************************************
@@ -353,7 +355,10 @@
             if (cell[x].Attributes & FOREGROUND_INTENSITY) attr |= A_BOLD;
             PRIVATE(data)->line[x] = attr;
         }
-        mvwaddchnstr(PRIVATE(data)->pad, y, 0, PRIVATE(data)->line, data->curcfg.sb_width);
+        if (mvwaddchnstr(PRIVATE(data)->pad, y, 0, PRIVATE(data)->line, data->curcfg.sb_width) == ERR)
+	{
+	    WINE_WARN("Error while refreshing the %d line\n",y);
+	}
     }
 
     WCCURSES_PosCursor(data);
@@ -933,7 +938,12 @@
     initscr();
 
     /* creating the basic colors - FIXME intensity not handled yet */
-    if (has_colors())
+    if (!has_colors())
+    {
+	WINE_MESSAGE("Colors not supported on this terminal.\n"
+		     "Set TERM to xterm-color?\n");
+    }
+    else
     {
         int i, j;
 


More information about the wine-patches mailing list