bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Corrections for 20020824


From: Philippe Blain
Subject: Corrections for 20020824
Date: Mon, 26 Aug 2002 06:26:48 +0200

>From Philippe Blain, Bordeaux, FRANCE.
My old computer: P133 - 8,4 Go - 32 Mo Red Hat Linux 7.0

To maintainers of 'ncurses'.(and to Mr Dickey)
Subject: Corrections for ncurses-5.2-20020824+                 oh, oh

Here are some problems I found :                               /'^'\
                                                              ( o o )
---------------------------------------------------------oOOO---(_)---OOOo--
----
File : ncurses/base/lib_newwin.c

Function : _nc_makenew()

When creating a new window, the boolean '_notimeout' of '_win_st' is not
explicitely initialized to FALSE by '_nc_makenew'
 (but nevertheless zero-ed by typeCalloc).

----------------------------------------------------------------------------
----
File : ncurses/base/lib_screen.c

Function : getwin()

Same thing, '_notimeout, _idcok, _idlok' are absent and not proper restored.

Change chtype to NCURSES_CH_T (because of widechars):
    (void) fread(nwin->_line[n].text,
==>          sizeof(NCURSES_CH_T), (size_t) (nwin->_maxx + 1), filep);

What if window was a pad ?
Because of 'newwin()' (and not newpad()), should return NULL; but it's
feasible
to save and restore a pad by modifying code.


Function : putwin()

Change chtype to NCURSES_CH_T, push 'len' out of the for(...) loop :
==> len = (win->_maxx + 1);
    for (n = 0; n <= win->_maxy; n++) {
        clearerr(filep);
==>     if (fwrite(win->_line[n].text, sizeof(NCURSES_CH_T), len, filep) !=
len
        || ferror(filep))
          returnCode(code);
    }

If window is a pad, should not be permitted and return ERR.
==> if (win && !(win->_flags & _ISPAD)) { ... }


Think 'clearerr' is needed only once at the beginning of each function and
not in for(..) loops, because if error indicator change, 'ferror' stops
function
and returns ERR. This has no consequences if you let 'clearerr' in for(..)
loops
anyway.

----------------------------------------------------------------------------
----
File : ncurses/base/lib_window.c

Function : dupwin()

Idem, '_notimeout, _idcok, _idlok' are absent and not proper duplicated.

Change chtype to NCURSES_CH_T :
==> linesize = (win->_maxx + 1) * sizeof(NCURSES_CH_T);

What if window is a pad ?.  Because of 'newwin()', should return NULL if
trying to duplicate a pad.

----------------------------------------------------------------------------
----
File : ncurses/base/lib_restart.c

Function : restartterm()

Check return value of 'setupterm' :
==> if (setupterm(termp, filenum, errret) != OK) returnCode(ERR);

----------------------------------------------------------------------------
----
- Philippe






reply via email to

[Prev in Thread] Current Thread [Next in Thread]