Alexandre Julliard : kernel32: Avoid using tolowerW/toupperW().
Alexandre Julliard
julliard at winehq.org
Wed Apr 1 15:50:58 CDT 2020
Module: wine
Branch: master
Commit: 68587234bf82e268198f415a45256c854e179ba8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=68587234bf82e268198f415a45256c854e179ba8
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Apr 1 10:28:01 2020 +0200
kernel32: Avoid using tolowerW/toupperW().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/comm.c | 11 +++++++++--
dlls/kernel32/editline.c | 16 +++++-----------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/dlls/kernel32/comm.c b/dlls/kernel32/comm.c
index 48939c0287..656acb6b41 100644
--- a/dlls/kernel32/comm.c
+++ b/dlls/kernel32/comm.c
@@ -95,20 +95,25 @@ static LPCWSTR COMM_ParseParity(LPCWSTR ptr, LPBYTE lpparity)
member of DCB and not fParity even when parity is specified in the
device control string */
- switch(toupperW(*ptr++))
+ switch(*ptr++)
{
+ case 'e':
case 'E':
*lpparity = EVENPARITY;
break;
+ case 'm':
case 'M':
*lpparity = MARKPARITY;
break;
+ case 'n':
case 'N':
*lpparity = NOPARITY;
break;
+ case 'o':
case 'O':
*lpparity = ODDPARITY;
break;
+ case 's':
case 'S':
*lpparity = SPACEPARITY;
break;
@@ -239,7 +244,7 @@ static BOOL COMM_BuildOldCommDCB(LPCWSTR device, LPDCB lpdcb)
{
device++;
while(*device == ' ') device++;
- if(*device) last = toupperW(*device++);
+ if(*device) last = *device++;
while(*device == ' ') device++;
}
@@ -255,6 +260,7 @@ static BOOL COMM_BuildOldCommDCB(LPCWSTR device, LPDCB lpdcb)
lpdcb->fDtrControl = DTR_CONTROL_ENABLE;
lpdcb->fRtsControl = RTS_CONTROL_ENABLE;
break;
+ case 'x':
case 'X':
lpdcb->fInX = TRUE;
lpdcb->fOutX = TRUE;
@@ -263,6 +269,7 @@ static BOOL COMM_BuildOldCommDCB(LPCWSTR device, LPDCB lpdcb)
lpdcb->fDtrControl = DTR_CONTROL_ENABLE;
lpdcb->fRtsControl = RTS_CONTROL_ENABLE;
break;
+ case 'p':
case 'P':
lpdcb->fInX = FALSE;
lpdcb->fOutX = FALSE;
diff --git a/dlls/kernel32/editline.c b/dlls/kernel32/editline.c
index 7492604f04..e3d52ccc1a 100644
--- a/dlls/kernel32/editline.c
+++ b/dlls/kernel32/editline.c
@@ -27,6 +27,7 @@
#include "windef.h"
#include "winbase.h"
#include "wincon.h"
+#include "winuser.h"
#include "wine/unicode.h"
#include "winnls.h"
#include "wine/debug.h"
@@ -598,9 +599,7 @@ static void WCEL_LowerCaseWord(WCEL_Context* ctx)
unsigned int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs)
{
- unsigned int i;
- for (i = ctx->ofs; i <= new_ofs; i++)
- ctx->line[i] = tolowerW(ctx->line[i]);
+ CharLowerBuffW( ctx->line + ctx->ofs, new_ofs - ctx->ofs + 1 );
WCEL_Update(ctx, ctx->ofs, new_ofs - ctx->ofs + 1);
ctx->ofs = new_ofs;
}
@@ -611,9 +610,7 @@ static void WCEL_UpperCaseWord(WCEL_Context* ctx)
unsigned int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs)
{
- unsigned int i;
- for (i = ctx->ofs; i <= new_ofs; i++)
- ctx->line[i] = toupperW(ctx->line[i]);
+ CharUpperBuffW( ctx->line + ctx->ofs, new_ofs - ctx->ofs + 1 );
WCEL_Update(ctx, ctx->ofs, new_ofs - ctx->ofs + 1);
ctx->ofs = new_ofs;
}
@@ -624,11 +621,8 @@ static void WCEL_CapitalizeWord(WCEL_Context* ctx)
unsigned int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs)
{
- unsigned int i;
-
- ctx->line[ctx->ofs] = toupperW(ctx->line[ctx->ofs]);
- for (i = ctx->ofs + 1; i <= new_ofs; i++)
- ctx->line[i] = tolowerW(ctx->line[i]);
+ CharUpperBuffW( ctx->line + ctx->ofs, 1 );
+ CharLowerBuffW( ctx->line + ctx->ofs + 1, new_ofs - ctx->ofs );
WCEL_Update(ctx, ctx->ofs, new_ofs - ctx->ofs + 1);
ctx->ofs = new_ofs;
}
More information about the wine-cvs
mailing list