]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_set_term.c
ncurses 5.9 - patch 20121102
[ncurses.git] / ncurses / base / lib_set_term.c
index 3ed5e72431394834013eaf2e844680748c7eb8d1..83d0e7d01487a7954bb16e4f2b269828e2c12e64 100644 (file)
@@ -47,7 +47,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_set_term.c,v 1.143 2012/08/25 20:10:40 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.146 2012/10/27 23:04:17 tom Exp $")
 
 #ifdef USE_TERM_DRIVER
 #define MaxColors      InfoOf(sp).maxcolors
@@ -261,8 +261,8 @@ extract_fgbg(char *src, int *result)
 }
 #endif
 
-#define ReturnScreenError() _nc_set_screen(0); \
-                            returnCode(ERR)
+#define ReturnScreenError() _nc_set_screen(0); \
+                            returnCode(ERR); } while (0)
 
 /* OS-independent screen initializations */
 NCURSES_EXPORT(int)
@@ -376,7 +376,7 @@ NCURSES_SP_NAME(_nc_setupscreen) (
     fflush(output);
     sp->_ofd = output ? fileno(output) : -1;
     sp->_ofp = output;
-    sp->out_limit = (size_t) (slines * scolumns);
+    sp->out_limit = (size_t) ((2 + slines) * (6 + scolumns));
     if ((sp->out_buffer = malloc(sp->out_limit)) == 0)
        sp->out_limit = 0;
     sp->out_inuse = 0;
@@ -582,6 +582,9 @@ NCURSES_SP_NAME(_nc_setupscreen) (
     NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_ARG);
 #if USE_WIDEC_SUPPORT
     _nc_init_wacs();
+    if (_nc_wacs == 0) {
+       ReturnScreenError();
+    }
 
     sp->_screen_acs_fix = (_nc_unicode_locale()
                           && _nc_locale_breaks_acs(sp->_term));