New version of ncurses port applied, fixed memory leak in gutlgrp.cpp.

This commit is contained in:
Alexander S. Aganichev
2000-03-04 10:02:11 +00:00
parent c3909b39c9
commit 69b146f956
6 changed files with 134 additions and 84 deletions

View File

@@ -32,6 +32,8 @@
#include <gkbdbase.h>
#include <gmemall.h>
#include <stdlib.h>
#if defined(__OS2__)
#define INCL_BASE
#include <os2.h>
@@ -98,12 +100,13 @@ void GKbd::Init() {
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
// WARNING: this might break with another version of ncurses, or
// WARNING: this might break with an old version of ncurses, or
// with another implementation of curses. I'm putting it here because
// it is quote useful most of the time :-) For other implementations of
// curses, you might have to compile curses yourself to achieve this. -jt
#if defined(NCURSES_VERSION)
ESCDELAY = 50; // ms, slow for a 300bps terminal, fast for humans :-)
if(not getenv("ESCDELAY")) // If not specified by user via environment, set
ESCDELAY = 50; // ms, slow for a 300bps terminal, fast for humans :-)
#endif
// For more ncurses-dependent code, look at the gkbd_curstable array
// and at the kbxget_raw() function -jt

View File

@@ -52,7 +52,7 @@ Grp::~Grp() {
multimap<int, grp_stock>::iterator i;
for(currgrp = container.begin(); currgrp != container.end(); currgrp++)
for(i = currgrp->second.find(GRP_MEMBER); i != currgrp->second.end(); i++) {
for(i = currgrp->second.begin(); i != currgrp->second.end(); i++) {
if(i->second.type == TYPE_OBJECT)
throw_free(i->second.data.object_item);
else if(i->second.type == TYPE_STRING)

View File

@@ -1361,9 +1361,10 @@ void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) {
// Does anyone know a better solution?
if(lines >= 0) {
if (lines <= 1 + erow - srow) {
vatch *buf = vsave (srow + lines, scol, erow, ecol);
vrestore (buf, srow, scol, erow - lines, ecol);
if(lines <= 1 + erow - srow) {
vatch *buf = vsave(srow + lines, scol, erow, ecol);
vrestore(buf, srow, scol, erow - lines, ecol);
throw_xfree(buf);
}
else
lines = 1 + erow - srow;
@@ -1374,9 +1375,10 @@ void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) {
}
else {
lines*=-1;
if (lines <= 1 + erow - srow) {
vatch *buf = vsave (srow, scol, erow - lines, ecol);
vrestore (buf, srow + lines, scol, erow, ecol);
if(lines <= 1 + erow - srow) {
vatch *buf = vsave(srow, scol, erow - lines, ecol);
vrestore(buf, srow + lines, scol, erow, ecol);
throw_xfree(buf);
}
else
lines = 1 + erow - srow;