projects
/
ncurses.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ncurses 6.2 - patch 20200229
[ncurses.git]
/
ncurses
/
win32con
/
win_driver.c
diff --git
a/ncurses/win32con/win_driver.c
b/ncurses/win32con/win_driver.c
index 280aa6dc16cb4dd2eeb722cd94fe88b3f172ac61..72a9cf53525f8a94d692384347f3b56a552df929 100644
(file)
--- a/
ncurses/win32con/win_driver.c
+++ b/
ncurses/win32con/win_driver.c
@@
-55,11
+55,9
@@
#define CUR TerminalType(my_term).
#define CUR TerminalType(my_term).
-MODULE_ID("$Id: win_driver.c,v 1.6
3 2020/02/02 23:34:34
tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.6
6 2020/03/01 00:18:49
tom Exp $")
-#ifndef __GNUC__
-# error We need GCC to compile for MinGW
-#endif
+#define TypeAlloca(type,count) (type*) _alloca(sizeof(type) * (size_t) (count))
#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
@@
-262,7
+260,7
@@
static BOOL
con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
{
int actual = 0;
con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
{
int actual = 0;
- CHAR_INFO
ci[limit]
;
+ CHAR_INFO
*ci = TypeAlloca(CHAR_INFO, limit)
;
COORD loc, siz;
SMALL_RECT rec;
int i;
COORD loc, siz;
SMALL_RECT rec;
int i;
@@
-311,7
+309,7
@@
con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
static BOOL
con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
{
static BOOL
con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
{
- CHAR_INFO
ci[n]
;
+ CHAR_INFO
*ci = TypeAlloca(CHAR_INFO, n)
;
COORD loc, siz;
SMALL_RECT rec;
int i;
COORD loc, siz;
SMALL_RECT rec;
int i;
@@
-510,7
+508,7
@@
wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
int x;
#if USE_WIDEC_SUPPORT
if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
int x;
#if USE_WIDEC_SUPPORT
- cchar_t
empty[Width]
;
+ cchar_t
*empty = TypeAlloca(cchar_t, Width)
;
wchar_t blank[2] =
{
L' ', L'\0'
wchar_t blank[2] =
{
L' ', L'\0'
@@
-519,7
+517,7
@@
wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
for (x = 0; x < Width; x++)
setcchar(&empty[x], blank, 0, 0, 0);
#else
for (x = 0; x < Width; x++)
setcchar(&empty[x], blank, 0, 0, 0);
#else
- chtype
empty[Width]
;
+ chtype
*empty = TypeAlloca(chtype, Width)
;
for (x = 0; x < Width; x++)
empty[x] = ' ';
for (x = 0; x < Width; x++)
empty[x] = ' ';
@@
-675,8
+673,8
@@
wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
int max_cells = (high * wide);
int i;
int max_cells = (high * wide);
int i;
- CHAR_INFO
this_screen[max_cells]
;
- CHAR_INFO
that_screen[max_cells]
;
+ CHAR_INFO
*this_screen = TypeAlloca(CHAR_INFO, max_cells)
;
+ CHAR_INFO
*that_screen = TypeAlloca(CHAR_INFO, max_cells)
;
COORD this_size;
SMALL_RECT this_region;
COORD bufferCoord;
COORD this_size;
SMALL_RECT this_region;
COORD bufferCoord;
@@
-701,7
+699,9
@@
wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
bufferCoord,
&this_region)) {
bufferCoord,
&this_region)) {
- memcpy(that_screen, this_screen, sizeof(that_screen));
+ memcpy(that_screen,
+ this_screen,
+ sizeof(CHAR_INFO) * (size_t) max_cells);
for (i = 0; i < max_cells; i++) {
that_screen[i].Attributes = RevAttr(that_screen[i].Attributes);
for (i = 0; i < max_cells; i++) {
that_screen[i].Attributes = RevAttr(that_screen[i].Attributes);