Fix (I hope) the bounding checks against the source window.
This commit is contained in:
parent
158fe62cd6
commit
75c6c76be7
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: copywin.c,v 1.10 2004/08/01 21:48:24 dsl Exp $ */
|
/* $NetBSD: copywin.c,v 1.11 2004/08/02 18:47:52 dsl Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998-1999 Brett Lymn
|
* Copyright (c) 1998-1999 Brett Lymn
|
||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
__RCSID("$NetBSD: copywin.c,v 1.10 2004/08/01 21:48:24 dsl Exp $");
|
__RCSID("$NetBSD: copywin.c,v 1.11 2004/08/02 18:47:52 dsl Exp $");
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -79,16 +79,16 @@ int copywin(const WINDOW *srcwin, WINDOW *dstwin,
|
|||||||
if (dmaxcol >= dstwin->maxx)
|
if (dmaxcol >= dstwin->maxx)
|
||||||
dmaxcol = dstwin->maxx - 1;
|
dmaxcol = dstwin->maxx - 1;
|
||||||
if (smincol + (dmaxcol - dmincol) >= srcwin->maxx)
|
if (smincol + (dmaxcol - dmincol) >= srcwin->maxx)
|
||||||
dmaxcol = srcwin->maxx + dmincol - smincol;
|
dmaxcol = srcwin->maxx + dmincol - smincol - 1;
|
||||||
if (dmaxcol < dmincol)
|
if (dmaxcol < dmincol)
|
||||||
/* nothing in the intersection */
|
/* nothing in the intersection */
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
/* Bound dmaxrow for both windows (should be ok for dstwin) */
|
/* Bound dmaxrow for both windows (should be ok for dstwin) */
|
||||||
if (dmaxrow >= dstwin->maxx)
|
if (dmaxrow >= dstwin->maxy)
|
||||||
dmaxrow = dstwin->maxy - 1;
|
dmaxrow = dstwin->maxy - 1;
|
||||||
if (sminrow + (dmaxrow - dminrow) >= srcwin->maxy)
|
if (sminrow + (dmaxrow - dminrow) >= srcwin->maxy)
|
||||||
dmaxrow = srcwin->maxx + dminrow - sminrow;
|
dmaxrow = srcwin->maxy + dminrow - sminrow - 1;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
__CTRACE("copywin %s mode: from (%d,%d) to (%d,%d-%d,%d)\n",
|
__CTRACE("copywin %s mode: from (%d,%d) to (%d,%d-%d,%d)\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user