https://git.reactos.org/?p=reactos.git;a=commitdiff;h=985680068c41fe90d3d19…
commit 985680068c41fe90d3d19ee6777f2f982672b931
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Jul 30 07:59:01 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Jul 30 07:59:01 2023 +0900
[ATL] Overload const-return-versions of FindChar/FindString/FindOneOf (#5473)
Overload the const-return-versions of FindChar/FindCharReverse/FindString/FindOneOf.
Modify CStringT::Replace.
---
sdk/lib/atl/atlsimpstr.h | 4 ++++
sdk/lib/atl/cstringt.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/sdk/lib/atl/atlsimpstr.h b/sdk/lib/atl/atlsimpstr.h
index c06a8e46cc5..7d78f41abc4 100644
--- a/sdk/lib/atl/atlsimpstr.h
+++ b/sdk/lib/atl/atlsimpstr.h
@@ -358,6 +358,10 @@ public:
return GetData()->nDataLength;
}
+ PXSTR GetString() throw()
+ {
+ return m_pszData;
+ }
PCXSTR GetString() const throw()
{
return m_pszData;
diff --git a/sdk/lib/atl/cstringt.h b/sdk/lib/atl/cstringt.h
index 748cbcba993..2e5a18b1a54 100644
--- a/sdk/lib/atl/cstringt.h
+++ b/sdk/lib/atl/cstringt.h
@@ -99,6 +99,12 @@ public:
}
static LPWSTR __cdecl FindString(
+ _In_z_ LPWSTR pszSource,
+ _In_z_ LPCWSTR pszSub)
+ {
+ return ::wcsstr(pszSource, pszSub);
+ }
+ static LPCWSTR __cdecl FindString(
_In_z_ LPCWSTR pszSource,
_In_z_ LPCWSTR pszSub)
{
@@ -106,6 +112,12 @@ public:
}
static LPWSTR __cdecl FindChar(
+ _In_z_ LPWSTR pszSource,
+ _In_ WCHAR ch)
+ {
+ return ::wcschr(pszSource, ch);
+ }
+ static LPCWSTR __cdecl FindChar(
_In_z_ LPCWSTR pszSource,
_In_ WCHAR ch)
{
@@ -113,6 +125,12 @@ public:
}
static LPWSTR __cdecl FindCharReverse(
+ _In_z_ LPWSTR pszSource,
+ _In_ WCHAR ch)
+ {
+ return ::wcsrchr(pszSource, ch);
+ }
+ static LPCWSTR __cdecl FindCharReverse(
_In_z_ LPCWSTR pszSource,
_In_ WCHAR ch)
{
@@ -120,6 +138,12 @@ public:
}
static LPWSTR __cdecl FindOneOf(
+ _In_z_ LPWSTR pszSource,
+ _In_z_ LPCWSTR pszCharSet)
+ {
+ return ::wcspbrk(pszSource, pszCharSet);
+ }
+ static LPCWSTR __cdecl FindOneOf(
_In_z_ LPCWSTR pszSource,
_In_z_ LPCWSTR pszCharSet)
{
@@ -262,6 +286,12 @@ public:
}
static LPSTR __cdecl FindString(
+ _In_z_ LPSTR pszSource,
+ _In_z_ LPCSTR pszSub)
+ {
+ return ::strstr(pszSource, pszSub);
+ }
+ static LPCSTR __cdecl FindString(
_In_z_ LPCSTR pszSource,
_In_z_ LPCSTR pszSub)
{
@@ -269,6 +299,12 @@ public:
}
static LPSTR __cdecl FindChar(
+ _In_z_ LPSTR pszSource,
+ _In_ CHAR ch)
+ {
+ return ::strchr(pszSource, ch);
+ }
+ static LPCSTR __cdecl FindChar(
_In_z_ LPCSTR pszSource,
_In_ CHAR ch)
{
@@ -276,6 +312,12 @@ public:
}
static LPSTR __cdecl FindCharReverse(
+ _In_z_ LPSTR pszSource,
+ _In_ CHAR ch)
+ {
+ return ::strrchr(pszSource, ch);
+ }
+ static LPCSTR __cdecl FindCharReverse(
_In_z_ LPCSTR pszSource,
_In_ CHAR ch)
{
@@ -283,6 +325,12 @@ public:
}
static LPSTR __cdecl FindOneOf(
+ _In_z_ LPSTR pszSource,
+ _In_z_ LPCSTR pszCharSet)
+ {
+ return ::strpbrk(pszSource, pszCharSet);
+ }
+ static LPCSTR __cdecl FindOneOf(
_In_z_ LPCSTR pszSource,
_In_z_ LPCSTR pszCharSet)
{
@@ -876,7 +924,7 @@ public:
int Replace(XCHAR chOld, XCHAR chNew)
{
- PCXSTR pszString = CThisSimpleString::GetString();
+ PXSTR pszString = CThisSimpleString::GetString();
PXSTR pszFirst = StringTraits::FindChar(pszString, chOld);
if (!pszFirst)
return 0;