]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_set_term.c
ncurses 5.9 - patch 20121222
[ncurses.git] / ncurses / base / lib_set_term.c
index 3ed5e72431394834013eaf2e844680748c7eb8d1..1406b1ad03d0e7e1af6be686f061b47c00c3ebbc 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.147 2012/12/22 21:30:04 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;
@@ -581,9 +581,13 @@ NCURSES_SP_NAME(_nc_setupscreen) (
 
     NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_ARG);
 #if USE_WIDEC_SUPPORT
+    sp->_screen_unicode = _nc_unicode_locale();
     _nc_init_wacs();
+    if (_nc_wacs == 0) {
+       ReturnScreenError();
+    }
 
-    sp->_screen_acs_fix = (_nc_unicode_locale()
+    sp->_screen_acs_fix = (sp->_screen_unicode
                           && _nc_locale_breaks_acs(sp->_term));
 #endif
     env = _nc_get_locale();