aboutsummaryrefslogtreecommitdiff
path: root/ncurses
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses')
-rw-r--r--ncurses/base/lib_newwin.c6
-rw-r--r--ncurses/base/lib_slk.c16
-rw-r--r--ncurses/widechar/lib_add_wch.c6
3 files changed, 15 insertions, 13 deletions
diff --git a/ncurses/base/lib_newwin.c b/ncurses/base/lib_newwin.c
index 2b120eac10c7..72d8af84b703 100644
--- a/ncurses/base/lib_newwin.c
+++ b/ncurses/base/lib_newwin.c
@@ -43,7 +43,7 @@
#include <curses.priv.h>
#include <stddef.h>
-MODULE_ID("$Id: lib_newwin.c,v 1.68 2011/01/22 20:34:15 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.69 2011/03/07 21:58:17 tom Exp $")
#define window_is(name) ((sp)->_##name == win)
@@ -141,7 +141,7 @@ NCURSES_SP_NAME(newwin) (NCURSES_SP_DCLx
T((T_CALLED("newwin(%p, %d,%d,%d,%d)"), (void *) SP_PARM, num_lines, num_columns,
begy, begx));
- if (begy < 0 || begx < 0 || num_lines <= 0 || num_columns <= 0)
+ if (begy < 0 || begx < 0 || num_lines < 0 || num_columns < 0)
returnWin(0);
if (num_lines == 0)
@@ -198,7 +198,7 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
/*
* make sure window fits inside the original one
*/
- if (begy < 0 || begx < 0 || orig == 0 || num_lines <= 0 || num_columns <= 0)
+ if (begy < 0 || begx < 0 || orig == 0 || num_lines < 0 || num_columns < 0)
returnWin(0);
if (begy + num_lines > orig->_maxy + 1
|| begx + num_columns > orig->_maxx + 1)
diff --git a/ncurses/base/lib_slk.c b/ncurses/base/lib_slk.c
index 7a2eecd9e56d..84f17ae03705 100644
--- a/ncurses/base/lib_slk.c
+++ b/ncurses/base/lib_slk.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -47,7 +47,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_slk.c,v 1.47 2010/12/25 22:58:58 tom Exp $")
+MODULE_ID("$Id: lib_slk.c,v 1.48 2011/03/05 21:21:52 tom Exp $")
#ifdef USE_TERM_DRIVER
#define NumLabels InfoOf(SP_PARM).numlabels
@@ -138,7 +138,7 @@ _nc_slk_initialize(WINDOW *stwin, int cols)
{
int i;
int res = OK;
- int max_length;
+ size_t max_length;
SCREEN *sp;
int numlab;
@@ -189,9 +189,9 @@ _nc_slk_initialize(WINDOW *stwin, int cols)
== NULL)
returnCode(slk_failed(NCURSES_SP_ARG));
- max_length = SP_PARM->_slk->maxlen;
+ max_length = (size_t) SP_PARM->_slk->maxlen;
for (i = 0; i < SP_PARM->_slk->labcnt; i++) {
- size_t used = (size_t) max_length + 1;
+ size_t used = max_length + 1;
SP_PARM->_slk->ent[i].ent_text = (char *) _nc_doalloc(0, used);
if (SP_PARM->_slk->ent[i].ent_text == 0)
@@ -202,8 +202,10 @@ _nc_slk_initialize(WINDOW *stwin, int cols)
if (SP_PARM->_slk->ent[i].form_text == 0)
returnCode(slk_failed(NCURSES_SP_ARG));
- memset(SP_PARM->_slk->ent[i].form_text, ' ', used - 1);
- SP_PARM->_slk->ent[i].form_text[used] = '\0';
+ if (used > 1) {
+ memset(SP_PARM->_slk->ent[i].form_text, ' ', used - 1);
+ }
+ SP_PARM->_slk->ent[i].form_text[used - 1] = '\0';
SP_PARM->_slk->ent[i].visible = (char) (i < SP_PARM->_slk->maxlab);
}
diff --git a/ncurses/widechar/lib_add_wch.c b/ncurses/widechar/lib_add_wch.c
index a8491fcbf57f..38d3130a54c4 100644
--- a/ncurses/widechar/lib_add_wch.c
+++ b/ncurses/widechar/lib_add_wch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2004-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 2004-2010,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,7 +39,7 @@
#include <wctype.h>
#endif
-MODULE_ID("$Id: lib_add_wch.c,v 1.11 2010/12/19 01:32:55 tom Exp $")
+MODULE_ID("$Id: lib_add_wch.c,v 1.12 2011/03/22 09:31:15 Petr.Pavlu Exp $")
/* clone/adapt lib_addch.c */
static const cchar_t blankchar = NewChar(BLANK_TEXT);
@@ -308,7 +308,7 @@ wadd_wch_nosync(WINDOW *win, cchar_t ch)
/*
* If we are using the alternate character set, forget about locale.
- * Otherwise, if the locale * claims the code is printable, treat it that
+ * Otherwise, if the locale claims the code is printable, treat it that
* way.
*/
if ((AttrOf(ch) & A_ALTCHARSET)