Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
54b951a4
Commit
54b951a4
authored
Dec 12, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Char{Lower,Upper}A call Char{Lower,Upper}BuffA.
Small optimization to avoid a memory allocation. Fixed sign extension in Char{Lower,Upper}A (reported by Andreas Rosenberg).
parent
6fee8c95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
40 deletions
+42
-40
lstr.c
dlls/user/lstr.c
+42
-40
No files found.
dlls/user/lstr.c
View file @
54b951a4
...
@@ -112,7 +112,7 @@ SEGPTR WINAPI AnsiUpper16( SEGPTR strOrChar )
...
@@ -112,7 +112,7 @@ SEGPTR WINAPI AnsiUpper16( SEGPTR strOrChar )
CharUpperA
(
MapSL
(
strOrChar
)
);
CharUpperA
(
MapSL
(
strOrChar
)
);
return
strOrChar
;
return
strOrChar
;
}
}
else
return
toupper
((
char
)
strOrChar
);
else
return
(
SEGPTR
)
CharUpperA
(
(
LPSTR
)
strOrChar
);
}
}
...
@@ -127,7 +127,7 @@ SEGPTR WINAPI AnsiLower16( SEGPTR strOrChar )
...
@@ -127,7 +127,7 @@ SEGPTR WINAPI AnsiLower16( SEGPTR strOrChar )
CharLowerA
(
MapSL
(
strOrChar
)
);
CharLowerA
(
MapSL
(
strOrChar
)
);
return
strOrChar
;
return
strOrChar
;
}
}
else
return
tolower
((
char
)
strOrChar
);
else
return
(
SEGPTR
)
CharLowerA
(
(
LPSTR
)
strOrChar
);
}
}
...
@@ -360,20 +360,19 @@ BOOL WINAPI OemToCharW( LPCSTR s, LPWSTR d )
...
@@ -360,20 +360,19 @@ BOOL WINAPI OemToCharW( LPCSTR s, LPWSTR d )
/***********************************************************************
/***********************************************************************
* CharLowerA (USER32.@)
* CharLowerA (USER32.@)
* FIXME: handle current locale
*/
*/
LPSTR
WINAPI
CharLowerA
(
LPSTR
x
)
LPSTR
WINAPI
CharLowerA
(
LPSTR
str
)
{
{
if
(
!
HIWORD
(
x
))
return
(
LPSTR
)
tolower
((
char
)(
int
)
x
);
if
(
!
HIWORD
(
str
))
{
char
ch
=
LOWORD
(
str
);
CharLowerBuffA
(
&
ch
,
1
);
return
(
LPSTR
)(
UINT_PTR
)(
BYTE
)
ch
;
}
__TRY
__TRY
{
{
LPSTR
s
=
x
;
CharLowerBuffA
(
str
,
strlen
(
str
)
);
while
(
*
s
)
{
*
s
=
tolower
(
*
s
);
s
++
;
}
}
}
__EXCEPT
(
page_fault
)
__EXCEPT
(
page_fault
)
{
{
...
@@ -381,26 +380,25 @@ LPSTR WINAPI CharLowerA(LPSTR x)
...
@@ -381,26 +380,25 @@ LPSTR WINAPI CharLowerA(LPSTR x)
return
NULL
;
return
NULL
;
}
}
__ENDTRY
__ENDTRY
return
x
;
return
str
;
}
}
/***********************************************************************
/***********************************************************************
* CharUpperA (USER32.@)
* CharUpperA (USER32.@)
* FIXME: handle current locale
*/
*/
LPSTR
WINAPI
CharUpperA
(
LPSTR
x
)
LPSTR
WINAPI
CharUpperA
(
LPSTR
str
)
{
{
if
(
!
HIWORD
(
x
))
return
(
LPSTR
)
toupper
((
char
)(
int
)
x
);
if
(
!
HIWORD
(
str
))
{
char
ch
=
LOWORD
(
str
);
CharUpperBuffA
(
&
ch
,
1
);
return
(
LPSTR
)(
UINT_PTR
)(
BYTE
)
ch
;
}
__TRY
__TRY
{
{
LPSTR
s
=
x
;
CharUpperBuffA
(
str
,
strlen
(
str
)
);
while
(
*
s
)
{
*
s
=
toupper
(
*
s
);
s
++
;
}
}
}
__EXCEPT
(
page_fault
)
__EXCEPT
(
page_fault
)
{
{
...
@@ -408,7 +406,7 @@ LPSTR WINAPI CharUpperA(LPSTR x)
...
@@ -408,7 +406,7 @@ LPSTR WINAPI CharUpperA(LPSTR x)
return
NULL
;
return
NULL
;
}
}
__ENDTRY
__ENDTRY
return
x
;
return
str
;
}
}
...
@@ -438,20 +436,22 @@ LPWSTR WINAPI CharUpperW(LPWSTR x)
...
@@ -438,20 +436,22 @@ LPWSTR WINAPI CharUpperW(LPWSTR x)
DWORD
WINAPI
CharLowerBuffA
(
LPSTR
str
,
DWORD
len
)
DWORD
WINAPI
CharLowerBuffA
(
LPSTR
str
,
DWORD
len
)
{
{
DWORD
lenW
;
DWORD
lenW
;
WCHAR
*
strW
;
WCHAR
buffer
[
32
];
WCHAR
*
strW
=
buffer
;
if
(
!
str
)
return
0
;
/* YES */
if
(
!
str
)
return
0
;
/* YES */
lenW
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
NULL
,
0
);
lenW
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
NULL
,
0
);
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
*
sizeof
(
WCHAR
));
if
(
lenW
>
sizeof
(
buffer
)
/
sizeof
(
WCHAR
))
if
(
strW
)
{
{
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
strW
,
lenW
);
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
*
sizeof
(
WCHAR
));
CharLowerBuffW
(
strW
,
lenW
);
if
(
!
strW
)
return
0
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
strW
,
lenW
,
str
,
len
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
strW
);
return
len
;
}
}
return
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
strW
,
lenW
);
CharLowerBuffW
(
strW
,
lenW
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
strW
,
lenW
,
str
,
len
,
NULL
,
NULL
);
if
(
strW
!=
buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
strW
);
return
len
;
}
}
...
@@ -473,20 +473,22 @@ DWORD WINAPI CharLowerBuffW( LPWSTR str, DWORD len )
...
@@ -473,20 +473,22 @@ DWORD WINAPI CharLowerBuffW( LPWSTR str, DWORD len )
DWORD
WINAPI
CharUpperBuffA
(
LPSTR
str
,
DWORD
len
)
DWORD
WINAPI
CharUpperBuffA
(
LPSTR
str
,
DWORD
len
)
{
{
DWORD
lenW
;
DWORD
lenW
;
WCHAR
*
strW
;
WCHAR
buffer
[
32
];
WCHAR
*
strW
=
buffer
;
if
(
!
str
)
return
0
;
/* YES */
if
(
!
str
)
return
0
;
/* YES */
lenW
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
NULL
,
0
);
lenW
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
NULL
,
0
);
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
*
sizeof
(
WCHAR
));
if
(
lenW
>
sizeof
(
buffer
)
/
sizeof
(
WCHAR
))
if
(
strW
)
{
{
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
strW
,
lenW
);
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
*
sizeof
(
WCHAR
));
CharUpperBuffW
(
strW
,
lenW
);
if
(
!
strW
)
return
0
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
strW
,
lenW
,
str
,
len
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
strW
);
return
len
;
}
}
return
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
strW
,
lenW
);
CharUpperBuffW
(
strW
,
lenW
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
strW
,
lenW
,
str
,
len
,
NULL
,
NULL
);
if
(
strW
!=
buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
strW
);
return
len
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment