Jacek Caban : kernelbase: Avoid unneeded GetConsoleOutputCP calls.
Alexandre Julliard
julliard at winehq.org
Fri Jul 17 16:30:46 CDT 2020
Module: wine
Branch: master
Commit: 6039b785947088d379672c709c227b96ce3be1e5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6039b785947088d379672c709c227b96ce3be1e5
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Jul 17 13:55:20 2020 +0200
kernelbase: Avoid unneeded GetConsoleOutputCP calls.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/console.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c
index 27918d8370..1aeb45d89c 100644
--- a/dlls/kernelbase/console.c
+++ b/dlls/kernelbase/console.c
@@ -133,9 +133,8 @@ static void input_records_AtoW( INPUT_RECORD *buffer, int count )
}
/* map char infos to ASCII */
-static void char_info_WtoA( CHAR_INFO *buffer, int count )
+static void char_info_WtoA( UINT cp, CHAR_INFO *buffer, int count )
{
- UINT cp = GetConsoleOutputCP();
char ch;
while (count-- > 0)
@@ -889,8 +888,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputA( HANDLE handle, CHAR_INFO *buff
ret = ReadConsoleOutputW( handle, buffer, size, coord, region );
if (ret && region->Right >= region->Left)
{
+ UINT cp = GetConsoleOutputCP();
for (y = 0; y <= region->Bottom - region->Top; y++)
- char_info_WtoA( &buffer[(coord.Y + y) * size.X + coord.X], region->Right - region->Left + 1 );
+ char_info_WtoA( cp, &buffer[(coord.Y + y) * size.X + coord.X], region->Right - region->Left + 1 );
}
return ret;
}
@@ -1583,19 +1583,20 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputCharacterA( HANDLE handle, LPCST
if (length > 0)
{
+ UINT cp = GetConsoleOutputCP();
if (!str)
{
SetLastError( ERROR_INVALID_ACCESS );
return FALSE;
}
- lenW = MultiByteToWideChar( GetConsoleOutputCP(), 0, str, length, NULL, 0 );
+ lenW = MultiByteToWideChar( cp, 0, str, length, NULL, 0 );
if (!(strW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
}
- MultiByteToWideChar( GetConsoleOutputCP(), 0, str, length, strW, lenW );
+ MultiByteToWideChar( cp, 0, str, length, strW, lenW );
}
ret = WriteConsoleOutputCharacterW( handle, strW, lenW, coord, written );
HeapFree( GetProcessHeap(), 0, strW );
More information about the wine-cvs
mailing list