]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_window.c
ncurses 6.2 - patch 20200523
[ncurses.git] / ncurses / base / lib_window.c
index 5c1171b5450ff9da512abf7ad0b44357c7c57391..7222bfe5c6561b356073912c3767f5675dccee01 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2010,2016 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 +40,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_window.c,v 1.28 2009/12/19 22:01:07 tom Exp $")
+MODULE_ID("$Id: lib_window.c,v 1.31 2020/02/02 23:34:34 tom Exp $")
 
 NCURSES_EXPORT(void)
 _nc_synchook(WINDOW *win)
@@ -56,7 +57,6 @@ mvderwin(WINDOW *win, int y, int x)
 /* move a derived window */
 {
     WINDOW *orig;
-    int i;
     int rc = ERR;
 
     T((T_CALLED("mvderwin(%p,%d,%d)"), (void *) win, y, x));
@@ -66,6 +66,8 @@ mvderwin(WINDOW *win, int y, int x)
        && (x >= 0 && y >= 0)
        && (x + getmaxx(win) <= getmaxx(orig))
        && (y + getmaxy(win) <= getmaxy(orig))) {
+       int i;
+
        wsyncup(win);
        win->_parx = x;
        win->_pary = y;
@@ -177,8 +179,6 @@ dupwin(WINDOW *win)
 /* make an exact duplicate of the given window */
 {
     WINDOW *nwin = 0;
-    size_t linesize;
-    int i;
 
     T((T_CALLED("dupwin(%p)"), (void *) win));
 
@@ -200,6 +200,8 @@ dupwin(WINDOW *win)
        }
 
        if (nwin != 0) {
+           int i;
+           size_t linesize;
 
            nwin->_curx = win->_curx;
            nwin->_cury = win->_cury;
@@ -239,7 +241,7 @@ dupwin(WINDOW *win)
            if (win->_flags & _ISPAD)
                nwin->_pad = win->_pad;
 
-           linesize = (win->_maxx + 1) * sizeof(NCURSES_CH_T);
+           linesize = (unsigned) (win->_maxx + 1) * sizeof(NCURSES_CH_T);
            for (i = 0; i <= nwin->_maxy; i++) {
                memcpy(nwin->_line[i].text, win->_line[i].text, linesize);
                nwin->_line[i].firstchar = win->_line[i].firstchar;