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
52e5d384
Commit
52e5d384
authored
Jun 25, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Get rid of CharNextW/CharPrevW. Simplify some string functions.
parent
73032be7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
118 deletions
+49
-118
string.c
dlls/comctl32/string.c
+49
-118
No files found.
dlls/comctl32/string.c
View file @
52e5d384
...
...
@@ -81,22 +81,6 @@ static BOOL COMCTL32_ChrCmpHelperA(WORD ch1, WORD ch2, DWORD dwFlags)
}
/*************************************************************************
* COMCTL32_ChrCmpHelperW
*
* Internal helper for COMCTL32_ChrCmpW/ChrCmpIW.
*/
static
BOOL
COMCTL32_ChrCmpHelperW
(
WCHAR
ch1
,
WCHAR
ch2
,
DWORD
dwFlags
)
{
WCHAR
str1
[
2
],
str2
[
2
];
str1
[
0
]
=
ch1
;
str1
[
1
]
=
'\0'
;
str2
[
0
]
=
ch2
;
str2
[
1
]
=
'\0'
;
return
CompareStringW
(
GetThreadLocale
(),
dwFlags
,
str1
,
2
,
str2
,
2
)
-
2
;
}
/*************************************************************************
* COMCTL32_ChrCmpA (internal)
*
* Internal helper function.
...
...
@@ -127,23 +111,13 @@ static BOOL COMCTL32_ChrCmpIA(WORD ch1, WORD ch2)
}
/*************************************************************************
* COMCTL32_ChrCmpW
*
* Internal helper function.
*/
static
BOOL
COMCTL32_ChrCmpW
(
WCHAR
ch1
,
WCHAR
ch2
)
{
return
COMCTL32_ChrCmpHelperW
(
ch1
,
ch2
,
0
);
}
/*************************************************************************
* COMCTL32_ChrCmpIW
*
* Internal helper function.
*/
static
BOOL
COMCTL32_ChrCmpIW
(
WCHAR
ch1
,
WCHAR
ch2
)
static
inline
BOOL
COMCTL32_ChrCmpIW
(
WCHAR
ch1
,
WCHAR
ch2
)
{
return
C
OMCTL32_ChrCmpHelperW
(
ch1
,
ch2
,
NORM_IGNORECASE
)
;
return
C
ompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
&
ch1
,
1
,
&
ch2
,
1
)
-
2
;
}
/**************************************************************************
...
...
@@ -372,30 +346,6 @@ static LPSTR COMCTL32_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch,
return
NULL
;
}
/*************************************************************************
* COMCTL32_StrStrHelperW
*
* Internal implementation of StrStrW/StrStrIW
*/
static
LPWSTR
COMCTL32_StrStrHelperW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszSearch
,
INT
(
WINAPI
*
pStrCmpFn
)(
LPCWSTR
,
LPCWSTR
,
INT
))
{
int
iLen
;
if
(
!
lpszStr
||
!
lpszSearch
||
!*
lpszSearch
)
return
NULL
;
iLen
=
strlenW
(
lpszSearch
);
while
(
*
lpszStr
)
{
if
(
!
pStrCmpFn
(
lpszStr
,
lpszSearch
,
iLen
))
return
(
LPWSTR
)
lpszStr
;
lpszStr
=
CharNextW
(
lpszStr
);
}
return
NULL
;
}
/**************************************************************************
* StrStrIA [COMCTL32.355]
*
...
...
@@ -439,9 +389,22 @@ INT WINAPI StrToIntA (LPCSTR lpszStr)
*/
LPWSTR
WINAPI
StrStrIW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszSearch
)
{
int
iLen
;
TRACE
(
"(%s,%s)
\n
"
,
debugstr_w
(
lpszStr
),
debugstr_w
(
lpszSearch
));
return
COMCTL32_StrStrHelperW
(
lpszStr
,
lpszSearch
,
StrCmpNIW
);
if
(
!
lpszStr
||
!
lpszSearch
||
!*
lpszSearch
)
return
NULL
;
iLen
=
strlenW
(
lpszSearch
);
while
(
*
lpszStr
)
{
if
(
!
StrCmpNIW
(
lpszStr
,
lpszSearch
,
iLen
))
return
(
LPWSTR
)
lpszStr
;
lpszStr
++
;
}
return
NULL
;
}
/**************************************************************************
...
...
@@ -602,25 +565,18 @@ LPSTR WINAPI StrRChrA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
*
* See StrRChrA.
*/
LPWSTR
WINAPI
StrRChrW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszE
nd
,
WORD
ch
)
LPWSTR
WINAPI
StrRChrW
(
LPCWSTR
str
,
LPCWSTR
e
nd
,
WORD
ch
)
{
LPCWSTR
lpszRet
=
NULL
;
TRACE
(
"(%s,%s,%x)
\n
"
,
debugstr_w
(
lpszStr
),
debugstr_w
(
lpszEnd
),
ch
);
if
(
lpszStr
)
{
if
(
!
lpszEnd
)
lpszEnd
=
lpszStr
+
strlenW
(
lpszStr
);
WCHAR
*
ret
=
NULL
;
while
(
*
lpszStr
&&
lpszStr
<=
lpszEnd
)
if
(
!
str
)
return
NULL
;
if
(
!
end
)
end
=
str
+
strlenW
(
str
);
while
(
str
<
end
)
{
if
(
!
COMCTL32_ChrCmpW
(
ch
,
*
lpszStr
))
lpszRet
=
lpszStr
;
lpszStr
=
CharNextW
(
lpszStr
);
if
(
*
str
==
ch
)
ret
=
(
WCHAR
*
)
str
;
str
++
;
}
}
return
(
LPWSTR
)
lpszRet
;
return
ret
;
}
/**************************************************************************
...
...
@@ -649,9 +605,8 @@ LPSTR WINAPI StrStrA(LPCSTR lpszStr, LPCSTR lpszSearch)
*/
LPWSTR
WINAPI
StrStrW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszSearch
)
{
TRACE
(
"(%s,%s)
\n
"
,
debugstr_w
(
lpszStr
),
debugstr_w
(
lpszSearch
));
return
COMCTL32_StrStrHelperW
(
lpszStr
,
lpszSearch
,
StrCmpNW
);
if
(
!
lpszStr
||
!
lpszSearch
)
return
NULL
;
return
strstrW
(
lpszStr
,
lpszSearch
);
}
/*************************************************************************
...
...
@@ -700,7 +655,7 @@ LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
{
if
(
toupperW
(
*
lpszStr
)
==
ch
)
return
(
LPWSTR
)
lpszStr
;
lpszStr
=
CharNextW
(
lpszStr
)
;
lpszStr
++
;
}
lpszStr
=
NULL
;
}
...
...
@@ -780,38 +735,12 @@ LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
if
(
!
StrCmpNIW
(
lpszStr
,
lpszSearch
,
iLen
))
lpszRet
=
(
LPWSTR
)
lpszStr
;
}
lpszStr
=
CharNextW
(
lpszStr
)
;
lpszStr
++
;
}
return
lpszRet
;
}
/*************************************************************************
* COMCTL32_StrSpnHelperW
*
* Internal implementation of StrSpnW/StrCSpnW/StrCSpnIW
*/
static
int
COMCTL32_StrSpnHelperW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszMatch
,
LPWSTR
(
WINAPI
*
pStrChrFn
)(
LPCWSTR
,
WCHAR
),
BOOL
bInvert
)
{
LPCWSTR
lpszRead
=
lpszStr
;
if
(
lpszStr
&&
*
lpszStr
&&
lpszMatch
)
{
while
(
*
lpszRead
)
{
LPCWSTR
lpszTest
=
pStrChrFn
(
lpszMatch
,
*
lpszRead
);
if
(
!
bInvert
&&
!
lpszTest
)
break
;
if
(
bInvert
&&
lpszTest
)
break
;
lpszRead
=
CharNextW
(
lpszRead
);
};
}
return
lpszRead
-
lpszStr
;
}
/*************************************************************************
* StrCSpnIA [COMCTL32.374]
*
* Find the length of the start of a string that does not contain certain
...
...
@@ -839,9 +768,19 @@ int WINAPI StrCSpnIA(LPCSTR lpszStr, LPCSTR lpszMatch)
*/
int
WINAPI
StrCSpnIW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszMatch
)
{
LPCWSTR
lpszRead
=
lpszStr
;
TRACE
(
"(%s,%s)
\n
"
,
debugstr_w
(
lpszStr
),
debugstr_w
(
lpszMatch
));
return
COMCTL32_StrSpnHelperW
(
lpszStr
,
lpszMatch
,
StrChrIW
,
TRUE
);
if
(
lpszStr
&&
*
lpszStr
&&
lpszMatch
)
{
while
(
*
lpszRead
)
{
if
(
StrChrIW
(
lpszMatch
,
*
lpszRead
))
break
;
lpszRead
++
;
}
}
return
lpszRead
-
lpszStr
;
}
/**************************************************************************
...
...
@@ -889,25 +828,18 @@ LPSTR WINAPI StrRChrIA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
*
* See StrRChrIA.
*/
LPWSTR
WINAPI
StrRChrIW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszE
nd
,
WORD
ch
)
LPWSTR
WINAPI
StrRChrIW
(
LPCWSTR
str
,
LPCWSTR
e
nd
,
WORD
ch
)
{
LPCWSTR
lpszRet
=
NULL
;
TRACE
(
"(%s,%s,%x)
\n
"
,
debugstr_w
(
lpszStr
),
debugstr_w
(
lpszEnd
),
ch
);
if
(
lpszStr
)
{
if
(
!
lpszEnd
)
lpszEnd
=
lpszStr
+
strlenW
(
lpszStr
);
WCHAR
*
ret
=
NULL
;
while
(
*
lpszStr
&&
lpszStr
<=
lpszEnd
)
if
(
!
str
)
return
NULL
;
if
(
!
end
)
end
=
str
+
strlenW
(
str
);
while
(
str
<
end
)
{
if
(
ch
==
*
lpszStr
)
lpszRet
=
lpszStr
;
lpszStr
=
CharNextW
(
lpszStr
);
if
(
!
COMCTL32_ChrCmpIW
(
*
str
,
ch
))
ret
=
(
WCHAR
*
)
str
;
str
++
;
}
}
return
(
LPWSTR
)
lpszRet
;
return
ret
;
}
/*************************************************************************
...
...
@@ -917,9 +849,8 @@ LPWSTR WINAPI StrRChrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, WORD ch)
*/
int
WINAPI
StrCSpnW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszMatch
)
{
TRACE
(
"(%s,%s)
\n
"
,
debugstr_w
(
lpszStr
),
debugstr_w
(
lpszMatch
));
return
COMCTL32_StrSpnHelperW
(
lpszStr
,
lpszMatch
,
StrChrW
,
TRUE
);
if
(
!
lpszStr
||
!
lpszMatch
)
return
0
;
return
strcspnW
(
lpszStr
,
lpszMatch
);
}
/*************************************************************************
...
...
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