Skip to content

Commit

Permalink
Fixes sourceforge bug #918
Browse files Browse the repository at this point in the history
  • Loading branch information
adeyblue authored and jayrm committed Oct 2, 2020
1 parent 5aec5fb commit fada761
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/rtlib/win32/io_pcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ int fb_ConsolePageCopy( int src, int dst )
}

/* do the copy */
static COORD pos = { 0, 0 };

CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo( __fb_con.pgHandleTb[src], &csbi );
PCHAR_INFO buff = alloca( csbi.dwSize.X * csbi.dwSize.Y * sizeof( CHAR_INFO ) );

ReadConsoleOutput( __fb_con.pgHandleTb[src], buff, csbi.dwSize, pos, &csbi.srWindow );

GetConsoleScreenBufferInfo( __fb_con.pgHandleTb[dst], &csbi );
WriteConsoleOutput( __fb_con.pgHandleTb[dst], buff, csbi.dwSize, pos, &csbi.srWindow );
PCHAR_INFO buff = malloc( csbi.dwSize.X * csbi.dwSize.Y * sizeof( CHAR_INFO ) );
if(buff)
{
COORD pos = { 0, 0 };
ReadConsoleOutput( __fb_con.pgHandleTb[src], buff, csbi.dwSize, pos, &csbi.srWindow );

return fb_ErrorSetNum( FB_RTERROR_OK );
GetConsoleScreenBufferInfo( __fb_con.pgHandleTb[dst], &csbi );
WriteConsoleOutput( __fb_con.pgHandleTb[dst], buff, csbi.dwSize, pos, &csbi.srWindow );
free( buff );
}
return fb_ErrorSetNum( buff ? FB_RTERROR_OK : FB_RTERROR_OUTOFMEM );
}

0 comments on commit fada761

Please sign in to comment.