[PATCH 2/3] shlwapi: Forward some string functions to kernelbase.
Nikolay Sivov
nsivov at codeweavers.com
Mon May 27 08:28:43 CDT 2019
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/shlwapi/ordinal.c | 95 ---
dlls/shlwapi/shlwapi.spec | 90 +--
dlls/shlwapi/string.c | 1179 +++----------------------------------
3 files changed, 120 insertions(+), 1244 deletions(-)
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index 657c33fffa..16096614f9 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -731,35 +731,6 @@ BOOL WINAPI GetStringType3ExW(LPWSTR src, INT count, LPWORD type)
return GetStringTypeW(CT_CTYPE3, src, count, type);
}
-/*************************************************************************
- * @ [SHLWAPI.151]
- *
- * Compare two Ascii strings up to a given length.
- *
- * PARAMS
- * lpszSrc [I] Source string
- * lpszCmp [I] String to compare to lpszSrc
- * len [I] Maximum length
- *
- * RETURNS
- * A number greater than, less than or equal to 0 depending on whether
- * lpszSrc is greater than, less than or equal to lpszCmp.
- */
-DWORD WINAPI StrCmpNCA(LPCSTR lpszSrc, LPCSTR lpszCmp, INT len)
-{
- return StrCmpNA(lpszSrc, lpszCmp, len);
-}
-
-/*************************************************************************
- * @ [SHLWAPI.152]
- *
- * Unicode version of StrCmpNCA.
- */
-DWORD WINAPI StrCmpNCW(LPCWSTR lpszSrc, LPCWSTR lpszCmp, INT len)
-{
- return StrCmpNW(lpszSrc, lpszCmp, len);
-}
-
/*************************************************************************
* @ [SHLWAPI.153]
*
@@ -779,72 +750,6 @@ DWORD WINAPI StrCmpNICA(LPCSTR lpszSrc, LPCSTR lpszCmp, DWORD len)
return StrCmpNIA(lpszSrc, lpszCmp, len);
}
-/*************************************************************************
- * @ [SHLWAPI.154]
- *
- * Unicode version of StrCmpNICA.
- */
-DWORD WINAPI StrCmpNICW(LPCWSTR lpszSrc, LPCWSTR lpszCmp, DWORD len)
-{
- return StrCmpNIW(lpszSrc, lpszCmp, len);
-}
-
-/*************************************************************************
- * @ [SHLWAPI.155]
- *
- * Compare two Ascii strings.
- *
- * PARAMS
- * lpszSrc [I] Source string
- * lpszCmp [I] String to compare to lpszSrc
- *
- * RETURNS
- * A number greater than, less than or equal to 0 depending on whether
- * lpszSrc is greater than, less than or equal to lpszCmp.
- */
-DWORD WINAPI StrCmpCA(LPCSTR lpszSrc, LPCSTR lpszCmp)
-{
- return lstrcmpA(lpszSrc, lpszCmp);
-}
-
-/*************************************************************************
- * @ [SHLWAPI.156]
- *
- * Unicode version of StrCmpCA.
- */
-DWORD WINAPI StrCmpCW(LPCWSTR lpszSrc, LPCWSTR lpszCmp)
-{
- return lstrcmpW(lpszSrc, lpszCmp);
-}
-
-/*************************************************************************
- * @ [SHLWAPI.157]
- *
- * Compare two Ascii strings, ignoring case.
- *
- * PARAMS
- * lpszSrc [I] Source string
- * lpszCmp [I] String to compare to lpszSrc
- *
- * RETURNS
- * A number greater than, less than or equal to 0 depending on whether
- * lpszSrc is greater than, less than or equal to lpszCmp.
- */
-DWORD WINAPI StrCmpICA(LPCSTR lpszSrc, LPCSTR lpszCmp)
-{
- return lstrcmpiA(lpszSrc, lpszCmp);
-}
-
-/*************************************************************************
- * @ [SHLWAPI.158]
- *
- * Unicode version of StrCmpICA.
- */
-DWORD WINAPI StrCmpICW(LPCWSTR lpszSrc, LPCWSTR lpszCmp)
-{
- return lstrcmpiW(lpszSrc, lpszCmp);
-}
-
/*************************************************************************
* @ [SHLWAPI.160]
*
diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec
index 060daccf24..3bc0da8fb0 100644
--- a/dlls/shlwapi/shlwapi.spec
+++ b/dlls/shlwapi/shlwapi.spec
@@ -148,14 +148,14 @@
148 stdcall -noname VkKeyScanWrapW(long) user32.VkKeyScanW
149 stdcall -noname WinHelpWrapW(long wstr long long) user32.WinHelpW
150 stdcall -noname wvsprintfWrapW(ptr wstr ptr) user32.wvsprintfW
-151 stdcall -ordinal StrCmpNCA(str ptr long)
-152 stdcall -ordinal StrCmpNCW(wstr wstr long)
+151 stdcall -ordinal StrCmpNCA(str ptr long) kernelbase.StrCmpNCA
+152 stdcall -ordinal StrCmpNCW(wstr wstr long) kernelbase.StrCmpNCW
153 stdcall -ordinal StrCmpNICA(long long long)
-154 stdcall -ordinal StrCmpNICW(wstr wstr long)
-155 stdcall -ordinal StrCmpCA(str str)
-156 stdcall -ordinal StrCmpCW(wstr wstr)
-157 stdcall -ordinal StrCmpICA(str str)
-158 stdcall -ordinal StrCmpICW(wstr wstr)
+154 stdcall -ordinal StrCmpNICW(wstr wstr long) kernelbase.StrCmpNICW
+155 stdcall -ordinal StrCmpCA(str str) kernelbase.StrCmpCA
+156 stdcall -ordinal StrCmpCW(wstr wstr) kernelbase.StrCmpCW
+157 stdcall -ordinal StrCmpICA(str str) kernelbase.StrCmpICA
+158 stdcall -ordinal StrCmpICW(wstr wstr) kernelbase.StrCmpICW
159 stdcall -noname CompareStringAltW(long long wstr long wstr long) kernel32.CompareStringW
160 stdcall -noname SHAboutInfoA(ptr long)
161 stdcall -noname SHAboutInfoW(ptr long)
@@ -396,8 +396,8 @@
396 stub -noname MLHtmlHelpA
397 stub -noname MLWinHelpW
398 stub -noname MLHtmlHelpW
-399 stdcall -noname StrCpyNXA(ptr str long)
-400 stdcall -noname StrCpyNXW(ptr wstr long)
+399 stdcall -noname StrCpyNXA(ptr str long) kernelbase.StrCpyNXA
+400 stdcall -noname StrCpyNXW(ptr wstr long) kernelbase.StrCpyNXW
401 stdcall -noname PageSetupDlgWrapW(ptr)
402 stdcall -noname PrintDlgWrapW(ptr)
403 stdcall -noname GetOpenFileNameWrapW(ptr)
@@ -564,8 +564,8 @@
@ stdcall -private DllGetVersion(ptr)
@ stdcall GetMenuPosFromID(ptr long)
@ stdcall HashData (ptr long ptr long)
-@ stdcall IntlStrEqWorkerA(long str str long) StrIsIntlEqualA
-@ stdcall IntlStrEqWorkerW(long wstr wstr long) StrIsIntlEqualW
+@ stdcall IntlStrEqWorkerA(long str str long) kernelbase.StrIsIntlEqualA
+@ stdcall IntlStrEqWorkerW(long wstr wstr long) kernelbase.StrIsIntlEqualW
@ stdcall IsCharSpaceA(long)
@ stdcall IsInternetESCEnabled()
@ stdcall PathAddBackslashA (str)
@@ -753,29 +753,29 @@
@ stdcall SHSkipJunction(ptr ptr)
@ stdcall SHStrDupA (str ptr)
@ stdcall SHStrDupW (wstr ptr)
-@ stdcall StrCSpnA (str str)
-@ stdcall StrCSpnIA (str str)
-@ stdcall StrCSpnIW (wstr wstr)
-@ stdcall StrCSpnW (wstr wstr)
-@ stdcall StrCatBuffA (str str long)
+@ stdcall StrCSpnA(str str) kernelbase.StrCSpnA
+@ stdcall StrCSpnIA(str str) kernelbase.StrCSpnIA
+@ stdcall StrCSpnIW(wstr wstr) kernelbase.StrCSpnIW
+@ stdcall StrCSpnW(wstr wstr) kernelbase.StrCSpnW
+@ stdcall StrCatBuffA(str str long) kernelbase.StrCatBuffA
@ stdcall StrCatBuffW (wstr wstr long)
-@ stdcall StrCatChainW (ptr long long wstr)
+@ stdcall StrCatChainW(ptr long long wstr) kernelbase.StrCatChainW
@ stdcall StrCatW (ptr wstr)
@ stdcall StrChrA (str long)
-@ stdcall StrChrIA (str long)
-@ stdcall StrChrIW (wstr long)
+@ stdcall StrChrIA(str long) kernelbase.StrChrIA
+@ stdcall StrChrIW(wstr long) kernelbase.StrChrIW
@ stdcall StrChrNW(wstr long long)
@ stdcall StrChrW (wstr long)
-@ stdcall StrCmpIW (wstr wstr)
-@ stdcall StrCmpLogicalW(wstr wstr)
+@ stdcall StrCmpIW(wstr wstr) kernelbase.StrCmpIW
+@ stdcall StrCmpLogicalW(wstr wstr) kernelbase.StrCmpLogicalW
@ stdcall StrCmpNA (str str long)
@ stdcall StrCmpNIA (str str long)
-@ stdcall StrCmpNIW (wstr wstr long)
-@ stdcall StrCmpNW (wstr wstr long)
-@ stdcall StrCmpW (wstr wstr)
+@ stdcall StrCmpNIW(wstr wstr long) kernelbase.StrCmpNIW
+@ stdcall StrCmpNW(wstr wstr long) kernelbase.StrCmpNW
+@ stdcall StrCmpW(wstr wstr) kernelbase.StrCmpW
@ stdcall StrCpyNW (ptr wstr long)
@ stdcall StrCpyW (ptr wstr)
-@ stdcall StrDupA (str)
+@ stdcall StrDupA(str) kernelbase.StrDupA
@ stdcall StrDupW (wstr)
@ stdcall StrFormatByteSize64A(int64 ptr long)
@ stdcall StrFormatByteSizeA(long ptr long)
@@ -784,39 +784,39 @@
@ stdcall StrFormatKBSizeW(int64 wstr long)
@ stdcall StrFromTimeIntervalA(ptr long long long)
@ stdcall StrFromTimeIntervalW(ptr long long long)
-@ stdcall StrIsIntlEqualA(long str str long)
-@ stdcall StrIsIntlEqualW(long wstr wstr long)
+@ stdcall StrIsIntlEqualA(long str str long) kernelbase.StrIsIntlEqualA
+@ stdcall StrIsIntlEqualW(long wstr wstr long) kernelbase.StrIsIntlEqualW
@ stdcall StrNCatA(str str long)
@ stdcall StrNCatW(wstr wstr long)
-@ stdcall StrPBrkA(str str)
-@ stdcall StrPBrkW(wstr wstr)
-@ stdcall StrRChrA (str str long)
-@ stdcall StrRChrIA (str str long)
-@ stdcall StrRChrIW (wstr wstr long)
-@ stdcall StrRChrW (wstr wstr long)
-@ stdcall StrRStrIA (str str str)
-@ stdcall StrRStrIW (wstr wstr wstr)
+@ stdcall StrPBrkA(str str) kernelbase.StrPBrkA
+@ stdcall StrPBrkW(wstr wstr) kernelbase.StrPBrkW
+@ stdcall StrRChrA(str str long) kernelbase.StrRChrA
+@ stdcall StrRChrIA(str str long) kernelbase.StrRChrIA
+@ stdcall StrRChrIW(wstr wstr long) kernelbase.StrRChrIW
+@ stdcall StrRChrW(wstr wstr long) kernelbase.StrRChrW
+@ stdcall StrRStrIA(str str str) kernelbase.StrRStrIA
+@ stdcall StrRStrIW(wstr wstr wstr) kernelbase.StrRStrIW
@ stdcall StrRetToBSTR(ptr ptr ptr)
@ stdcall StrRetToBufA(ptr ptr ptr long)
@ stdcall StrRetToBufW(ptr ptr ptr long)
@ stdcall StrRetToStrA(ptr ptr ptr)
@ stdcall StrRetToStrW(ptr ptr ptr)
-@ stdcall StrSpnA (str str)
-@ stdcall StrSpnW (wstr wstr)
-@ stdcall StrStrA(str str)
-@ stdcall StrStrIA(str str)
-@ stdcall StrStrIW(wstr wstr)
-@ stdcall StrStrNW(wstr wstr long)
-@ stdcall StrStrNIW(wstr wstr long)
-@ stdcall StrStrW(wstr wstr)
+@ stdcall StrSpnA(str str) kernelbase.StrSpnA
+@ stdcall StrSpnW(wstr wstr) kernelbase.StrSpnW
+@ stdcall StrStrA(str str) kernelbase.StrStrA
+@ stdcall StrStrIA(str str) kernelbase.StrStrIA
+@ stdcall StrStrIW(wstr wstr) kernelbase.StrStrIW
+@ stdcall StrStrNW(wstr wstr long) kernelbase.StrStrNW
+@ stdcall StrStrNIW(wstr wstr long) kernelbase.StrStrNIW
+@ stdcall StrStrW(wstr wstr) kernelbase.StrStrW
@ stdcall StrToInt64ExA(str long ptr)
@ stdcall StrToInt64ExW(wstr long ptr)
@ stdcall StrToIntA(str)
@ stdcall StrToIntExA(str long ptr)
@ stdcall StrToIntExW(wstr long ptr)
@ stdcall StrToIntW(wstr)
-@ stdcall StrTrimA(str str)
-@ stdcall StrTrimW(wstr wstr)
+@ stdcall StrTrimA(str str) kernelbase.StrTrimA
+@ stdcall StrTrimW(wstr wstr) kernelbase.StrTrimW
@ stdcall UrlApplySchemeA(str ptr ptr long)
@ stdcall UrlApplySchemeW(wstr ptr ptr long)
@ stdcall UrlCanonicalizeA(str ptr ptr long)
diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c
index 7b8473a379..816638b65f 100644
--- a/dlls/shlwapi/string.c
+++ b/dlls/shlwapi/string.c
@@ -263,59 +263,6 @@ LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
return lpszRet;
}
-/*************************************************************************
- * StrChrIA [SHLWAPI.@]
- *
- * Find a given character in a string, ignoring case.
- *
- * PARAMS
- * lpszStr [I] String to search in.
- * ch [I] Character to search for.
- *
- * RETURNS
- * Success: A pointer to the first occurrence of ch in lpszStr, or NULL if
- * not found.
- * Failure: NULL, if any arguments are invalid.
- */
-LPSTR WINAPI StrChrIA(LPCSTR lpszStr, WORD ch)
-{
- TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
-
- if (lpszStr)
- {
- while (*lpszStr)
- {
- if (!ChrCmpIA(*lpszStr, ch))
- return (LPSTR)lpszStr;
- lpszStr = CharNextA(lpszStr);
- }
- }
- return NULL;
-}
-
-/*************************************************************************
- * StrChrIW [SHLWAPI.@]
- *
- * See StrChrA.
- */
-LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
-{
- TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
-
- if (lpszStr)
- {
- ch = toupperW(ch);
- while (*lpszStr)
- {
- if (toupperW(*lpszStr) == ch)
- return (LPWSTR)lpszStr;
- lpszStr++;
- }
- lpszStr = NULL;
- }
- return (LPWSTR)lpszStr;
-}
-
/*************************************************************************
* StrChrNW [SHLWAPI.@]
*/
@@ -335,25 +282,6 @@ LPWSTR WINAPI StrChrNW(LPCWSTR lpszStr, WCHAR ch, UINT cchMax)
return NULL;
}
-/*************************************************************************
- * StrCmpIW [SHLWAPI.@]
- *
- * Compare two strings, ignoring case.
- *
- * PARAMS
- * lpszStr [I] First string to compare
- * lpszComp [I] Second string to compare
- *
- * RETURNS
- * An integer less than, equal to or greater than 0, indicating that
- * lpszStr is less than, the same, or greater than lpszComp.
- */
-int WINAPI StrCmpIW(LPCWSTR lpszStr, LPCWSTR lpszComp)
-{
- TRACE("(%s,%s)\n", debugstr_w(lpszStr),debugstr_w(lpszComp));
- return CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, -1, lpszComp, -1) - CSTR_EQUAL;
-}
-
/*************************************************************************
* StrCmpNA [SHLWAPI.@]
*
@@ -374,17 +302,6 @@ INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
return CompareStringA(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
}
-/*************************************************************************
- * StrCmpNW [SHLWAPI.@]
- *
- * See StrCmpNA.
- */
-INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
-{
- TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
- return CompareStringW(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
-}
-
/*************************************************************************
* StrCmpNIA [SHLWAPI.@]
*
@@ -405,36 +322,6 @@ int WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, int iLen)
return CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
}
-/*************************************************************************
- * StrCmpNIW [SHLWAPI.@]
- *
- * See StrCmpNIA.
- */
-INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, int iLen)
-{
- TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
- return CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
-}
-
-/*************************************************************************
- * StrCmpW [SHLWAPI.@]
- *
- * Compare two strings.
- *
- * PARAMS
- * lpszStr [I] First string to compare
- * lpszComp [I] Second string to compare
- *
- * RETURNS
- * An integer less than, equal to or greater than 0, indicating that
- * lpszStr is less than, the same, or greater than lpszComp.
- */
-int WINAPI StrCmpW(LPCWSTR lpszStr, LPCWSTR lpszComp)
-{
- TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszComp));
- return CompareStringW(GetThreadLocale(), 0, lpszStr, -1, lpszComp, -1) - CSTR_EQUAL;
-}
-
/*************************************************************************
* StrCatW [SHLWAPI.@]
*
@@ -456,47 +343,6 @@ LPWSTR WINAPI StrCatW(LPWSTR lpszStr, LPCWSTR lpszSrc)
return lpszStr;
}
-/*************************************************************************
- * StrCatChainW [SHLWAPI.@]
- *
- * Concatenates two unicode strings.
- *
- * PARAMS
- * lpszStr [O] Initial string
- * cchMax [I] Length of destination buffer
- * ichAt [I] Offset from the destination buffer to begin concatenation
- * lpszCat [I] String to concatenate
- *
- * RETURNS
- * The offset from the beginning of pszDst to the terminating NULL.
- */
-DWORD WINAPI StrCatChainW(LPWSTR lpszStr, DWORD cchMax, DWORD ichAt, LPCWSTR lpszCat)
-{
- TRACE("(%s,%u,%d,%s)\n", debugstr_w(lpszStr), cchMax, ichAt, debugstr_w(lpszCat));
-
- if (ichAt == -1)
- ichAt = strlenW(lpszStr);
-
- if (!cchMax)
- return ichAt;
-
- if (ichAt == cchMax)
- ichAt--;
-
- if (lpszCat && ichAt < cchMax)
- {
- lpszStr += ichAt;
- while (ichAt < cchMax - 1 && *lpszCat)
- {
- *lpszStr++ = *lpszCat++;
- ichAt++;
- }
- *lpszStr = 0;
- }
-
- return ichAt;
-}
-
/*************************************************************************
* StrCpyW [SHLWAPI.@]
*
@@ -551,261 +397,6 @@ LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
return dst;
}
-/*************************************************************************
- * SHLWAPI_StrStrHelperA
- *
- * Internal implementation of StrStrA/StrStrIA
- */
-static LPSTR SHLWAPI_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch,
- INT (WINAPI *pStrCmpFn)(LPCSTR,LPCSTR,INT))
-{
- size_t iLen;
- LPCSTR end;
-
- if (!lpszStr || !lpszSearch || !*lpszSearch)
- return NULL;
-
- iLen = strlen(lpszSearch);
- end = lpszStr + strlen(lpszStr);
-
- while (lpszStr + iLen <= end)
- {
- if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
- return (LPSTR)lpszStr;
- lpszStr = CharNextA(lpszStr);
- }
- return NULL;
-}
-
-/*************************************************************************
- * StrStrA [SHLWAPI.@]
- *
- * Find a substring within a string.
- *
- * PARAMS
- * lpszStr [I] String to search in
- * lpszSearch [I] String to look for
- *
- * RETURNS
- * The start of lpszSearch within lpszStr, or NULL if not found.
- */
-LPSTR WINAPI StrStrA(LPCSTR lpszStr, LPCSTR lpszSearch)
-{
- TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
-
- return SHLWAPI_StrStrHelperA(lpszStr, lpszSearch, StrCmpNA);
-}
-
-/*************************************************************************
- * StrStrW [SHLWAPI.@]
- *
- * See StrStrA.
- */
-LPWSTR WINAPI StrStrW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
-{
- TRACE("(%s, %s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
-
- if (!lpszStr || !lpszSearch || !*lpszSearch) return NULL;
- return strstrW( lpszStr, lpszSearch );
-}
-
-/*************************************************************************
- * StrRStrIA [SHLWAPI.@]
- *
- * Find the last occurrence of a substring within a string.
- *
- * PARAMS
- * lpszStr [I] String to search in
- * lpszEnd [I] End of lpszStr
- * lpszSearch [I] String to look for
- *
- * RETURNS
- * The last occurrence lpszSearch within lpszStr, or NULL if not found.
- */
-LPSTR WINAPI StrRStrIA(LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
-{
- LPSTR lpszRet = NULL;
- WORD ch1, ch2;
- INT iLen;
-
- TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
-
- if (!lpszStr || !lpszSearch || !*lpszSearch)
- return NULL;
-
- if (IsDBCSLeadByte(*lpszSearch))
- ch1 = *lpszSearch << 8 | (UCHAR)lpszSearch[1];
- else
- ch1 = *lpszSearch;
- iLen = lstrlenA(lpszSearch);
-
- if (!lpszEnd)
- lpszEnd = lpszStr + lstrlenA(lpszStr);
- else /* reproduce the broken behaviour on Windows */
- lpszEnd += min(iLen - 1, lstrlenA(lpszEnd));
-
- while (lpszStr + iLen <= lpszEnd && *lpszStr)
- {
- ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | (UCHAR)lpszStr[1] : *lpszStr;
- if (!ChrCmpIA(ch1, ch2))
- {
- if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
- lpszRet = (LPSTR)lpszStr;
- }
- lpszStr = CharNextA(lpszStr);
- }
- return lpszRet;
-}
-
-/*************************************************************************
- * StrRStrIW [SHLWAPI.@]
- *
- * See StrRStrIA.
- */
-LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
-{
- LPWSTR lpszRet = NULL;
- INT iLen;
-
- TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
-
- if (!lpszStr || !lpszSearch || !*lpszSearch)
- return NULL;
-
- iLen = strlenW(lpszSearch);
-
- if (!lpszEnd)
- lpszEnd = lpszStr + strlenW(lpszStr);
- else /* reproduce the broken behaviour on Windows */
- lpszEnd += min(iLen - 1, lstrlenW(lpszEnd));
-
- while (lpszStr + iLen <= lpszEnd && *lpszStr)
- {
- if (!ChrCmpIW(*lpszSearch, *lpszStr))
- {
- if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
- lpszRet = (LPWSTR)lpszStr;
- }
- lpszStr++;
- }
- return lpszRet;
-}
-
-/*************************************************************************
- * StrStrIA [SHLWAPI.@]
- *
- * Find a substring within a string, ignoring case.
- *
- * PARAMS
- * lpszStr [I] String to search in
- * lpszSearch [I] String to look for
- *
- * RETURNS
- * The start of lpszSearch within lpszStr, or NULL if not found.
- */
-LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch)
-{
- TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
-
- return SHLWAPI_StrStrHelperA(lpszStr, lpszSearch, StrCmpNIA);
-}
-
-/*************************************************************************
- * StrStrIW [SHLWAPI.@]
- *
- * See StrStrIA.
- */
-LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
-{
- int iLen;
- LPCWSTR end;
-
- TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
-
- if (!lpszStr || !lpszSearch || !*lpszSearch)
- return NULL;
-
- iLen = strlenW(lpszSearch);
- end = lpszStr + strlenW(lpszStr);
-
- while (lpszStr + iLen <= end)
- {
- if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
- return (LPWSTR)lpszStr;
- lpszStr++;
- }
- return NULL;
-}
-
-/*************************************************************************
- * StrStrNW [SHLWAPI.@]
- *
- * Find a substring within a string up to a given number of initial characters.
- *
- * PARAMS
- * lpFirst [I] String to search in
- * lpSrch [I] String to look for
- * cchMax [I] Maximum number of initial search characters
- *
- * RETURNS
- * The start of lpFirst within lpSrch, or NULL if not found.
- */
-LPWSTR WINAPI StrStrNW(LPCWSTR lpFirst, LPCWSTR lpSrch, UINT cchMax)
-{
- UINT i;
- int len;
-
- TRACE("(%s, %s, %u)\n", debugstr_w(lpFirst), debugstr_w(lpSrch), cchMax);
-
- if (!lpFirst || !lpSrch || !*lpSrch || !cchMax)
- return NULL;
-
- len = strlenW(lpSrch);
-
- for (i = cchMax; *lpFirst && (i > 0); i--, lpFirst++)
- {
- if (!strncmpW(lpFirst, lpSrch, len))
- return (LPWSTR)lpFirst;
- }
-
- return NULL;
-}
-
-/*************************************************************************
- * StrStrNIW [SHLWAPI.@]
- *
- * Find a substring within a string up to a given number of initial characters,
- * ignoring case.
- *
- * PARAMS
- * lpFirst [I] String to search in
- * lpSrch [I] String to look for
- * cchMax [I] Maximum number of initial search characters
- *
- * RETURNS
- * The start of lpFirst within lpSrch, or NULL if not found.
- */
-LPWSTR WINAPI StrStrNIW(LPCWSTR lpFirst, LPCWSTR lpSrch, UINT cchMax)
-{
- UINT i;
- int len;
-
- TRACE("(%s, %s, %u)\n", debugstr_w(lpFirst), debugstr_w(lpSrch), cchMax);
-
- if (!lpFirst || !lpSrch || !*lpSrch || !cchMax)
- return NULL;
-
- len = strlenW(lpSrch);
-
- for (i = cchMax; *lpFirst && (i > 0); i--, lpFirst++)
- {
- if (!strncmpiW(lpFirst, lpSrch, len))
- return (LPWSTR)lpFirst;
- }
-
- return NULL;
-}
-
/*************************************************************************
* StrToIntA [SHLWAPI.@]
*
@@ -956,480 +547,118 @@ BOOL WINAPI StrToInt64ExA(LPCSTR lpszStr, DWORD dwFlags, LONGLONG *lpiRet)
iRet += (*lpszStr - '0');
lpszStr++;
}
- *lpiRet = bNegative ? -iRet : iRet;
- return TRUE;
-}
-
-/*************************************************************************
- * StrToIntExW [SHLWAPI.@]
- *
- * See StrToIntExA.
- */
-BOOL WINAPI StrToIntExW(LPCWSTR lpszStr, DWORD dwFlags, LPINT lpiRet)
-{
- LONGLONG li;
- BOOL bRes;
-
- TRACE("(%s,%08X,%p)\n", debugstr_w(lpszStr), dwFlags, lpiRet);
-
- bRes = StrToInt64ExW(lpszStr, dwFlags, &li);
- if (bRes) *lpiRet = li;
- return bRes;
-}
-
-/*************************************************************************
- * StrToInt64ExW [SHLWAPI.@]
- *
- * See StrToIntExA.
- */
-BOOL WINAPI StrToInt64ExW(LPCWSTR lpszStr, DWORD dwFlags, LONGLONG *lpiRet)
-{
- BOOL bNegative = FALSE;
- LONGLONG iRet = 0;
-
- TRACE("(%s,%08X,%p)\n", debugstr_w(lpszStr), dwFlags, lpiRet);
-
- if (!lpszStr || !lpiRet)
- {
- WARN("Invalid parameter would crash under Win32!\n");
- return FALSE;
- }
- if (dwFlags > STIF_SUPPORT_HEX) WARN("Unknown flags %08x\n", dwFlags);
-
- /* Skip leading space, '+', '-' */
- while (isspaceW(*lpszStr)) lpszStr++;
-
- if (*lpszStr == '-')
- {
- bNegative = TRUE;
- lpszStr++;
- }
- else if (*lpszStr == '+')
- lpszStr++;
-
- if (dwFlags & STIF_SUPPORT_HEX &&
- *lpszStr == '0' && tolowerW(lpszStr[1]) == 'x')
- {
- /* Read hex number */
- lpszStr += 2;
-
- if (!isxdigitW(*lpszStr))
- return FALSE;
-
- while (isxdigitW(*lpszStr))
- {
- iRet = iRet * 16;
- if (isdigitW(*lpszStr))
- iRet += (*lpszStr - '0');
- else
- iRet += 10 + (tolowerW(*lpszStr) - 'a');
- lpszStr++;
- }
- *lpiRet = iRet;
- return TRUE;
- }
-
- /* Read decimal number */
- if (!isdigitW(*lpszStr))
- return FALSE;
-
- while (isdigitW(*lpszStr))
- {
- iRet = iRet * 10;
- iRet += (*lpszStr - '0');
- lpszStr++;
- }
- *lpiRet = bNegative ? -iRet : iRet;
- return TRUE;
-}
-
-/*************************************************************************
- * StrDupA [SHLWAPI.@]
- *
- * Duplicate a string.
- *
- * PARAMS
- * lpszStr [I] String to duplicate.
- *
- * RETURNS
- * Success: A pointer to a new string containing the contents of lpszStr
- * Failure: NULL, if memory cannot be allocated
- *
- * NOTES
- * The string memory is allocated with LocalAlloc(), and so should be released
- * by calling LocalFree().
- */
-LPSTR WINAPI StrDupA(LPCSTR lpszStr)
-{
- int iLen;
- LPSTR lpszRet;
-
- TRACE("(%s)\n",debugstr_a(lpszStr));
-
- iLen = lpszStr ? strlen(lpszStr) + 1 : 1;
- lpszRet = LocalAlloc(LMEM_FIXED, iLen);
-
- if (lpszRet)
- {
- if (lpszStr)
- memcpy(lpszRet, lpszStr, iLen);
- else
- *lpszRet = '\0';
- }
- return lpszRet;
-}
-
-/*************************************************************************
- * StrDupW [SHLWAPI.@]
- *
- * See StrDupA.
- */
-LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
-{
- int iLen;
- LPWSTR lpszRet;
-
- TRACE("(%s)\n",debugstr_w(lpszStr));
-
- iLen = (lpszStr ? strlenW(lpszStr) + 1 : 1) * sizeof(WCHAR);
- lpszRet = LocalAlloc(LMEM_FIXED, iLen);
-
- if (lpszRet)
- {
- if (lpszStr)
- memcpy(lpszRet, lpszStr, iLen);
- else
- *lpszRet = '\0';
- }
- return lpszRet;
-}
-
-/*************************************************************************
- * SHLWAPI_StrSpnHelperA
- *
- * Internal implementation of StrSpnA/StrCSpnA/StrCSpnIA
- */
-static int SHLWAPI_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch,
- LPSTR (WINAPI *pStrChrFn)(LPCSTR,WORD),
- BOOL bInvert)
-{
- LPCSTR lpszRead = lpszStr;
- if (lpszStr && *lpszStr && lpszMatch)
- {
- while (*lpszRead)
- {
- LPCSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
-
- if (!bInvert && !lpszTest)
- break;
- if (bInvert && lpszTest)
- break;
- lpszRead = CharNextA(lpszRead);
- };
- }
- return lpszRead - lpszStr;
-}
-
-/*************************************************************************
- * StrSpnA [SHLWAPI.@]
- *
- * Find the length of the start of a string that contains only certain
- * characters.
- *
- * PARAMS
- * lpszStr [I] String to search
- * lpszMatch [I] Characters that can be in the substring
- *
- * RETURNS
- * The length of the part of lpszStr containing only chars from lpszMatch,
- * or 0 if any parameter is invalid.
- */
-int WINAPI StrSpnA(LPCSTR lpszStr, LPCSTR lpszMatch)
-{
- TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
-
- return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, FALSE);
-}
-
-/*************************************************************************
- * StrSpnW [SHLWAPI.@]
- *
- * See StrSpnA.
- */
-int WINAPI StrSpnW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
-{
- if (!lpszStr || !lpszMatch) return 0;
- return strspnW( lpszStr, lpszMatch );
-}
-
-/*************************************************************************
- * StrCSpnA [SHLWAPI.@]
- *
- * Find the length of the start of a string that does not contain certain
- * characters.
- *
- * PARAMS
- * lpszStr [I] String to search
- * lpszMatch [I] Characters that cannot be in the substring
- *
- * RETURNS
- * The length of the part of lpszStr containing only chars not in lpszMatch,
- * or 0 if any parameter is invalid.
- */
-int WINAPI StrCSpnA(LPCSTR lpszStr, LPCSTR lpszMatch)
-{
- TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
-
- return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, TRUE);
-}
-
-/*************************************************************************
- * StrCSpnW [SHLWAPI.@]
- *
- * See StrCSpnA.
- */
-int WINAPI StrCSpnW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
-{
- if (!lpszStr || !lpszMatch) return 0;
- return strcspnW( lpszStr, lpszMatch );
-}
-
-/*************************************************************************
- * StrCSpnIA [SHLWAPI.@]
- *
- * Find the length of the start of a string that does not contain certain
- * characters, ignoring case.
- *
- * PARAMS
- * lpszStr [I] String to search
- * lpszMatch [I] Characters that cannot be in the substring
- *
- * RETURNS
- * The length of the part of lpszStr containing only chars not in lpszMatch,
- * or 0 if any parameter is invalid.
- */
-int WINAPI StrCSpnIA(LPCSTR lpszStr, LPCSTR lpszMatch)
-{
- TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
-
- return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrIA, TRUE);
-}
-
-/*************************************************************************
- * StrCSpnIW [SHLWAPI.@]
- *
- * See StrCSpnIA.
- */
-int WINAPI StrCSpnIW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
-{
- LPCWSTR lpszRead = lpszStr;
-
- TRACE("(%s,%s)\n",debugstr_w(lpszStr), debugstr_w(lpszMatch));
-
- if (lpszStr && *lpszStr && lpszMatch)
- {
- while (*lpszRead)
- {
- if (StrChrIW(lpszMatch, *lpszRead)) break;
- lpszRead++;
- }
- }
- return lpszRead - lpszStr;
-}
-
-/*************************************************************************
- * StrPBrkA [SHLWAPI.@]
- *
- * Search a string for any of a group of characters.
- *
- * PARAMS
- * lpszStr [I] String to search
- * lpszMatch [I] Characters to match
- *
- * RETURNS
- * A pointer to the first matching character in lpszStr, or NULL if no
- * match was found.
- */
-LPSTR WINAPI StrPBrkA(LPCSTR lpszStr, LPCSTR lpszMatch)
-{
- TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
-
- if (lpszStr && lpszMatch && *lpszMatch)
- {
- while (*lpszStr)
- {
- if (StrChrA(lpszMatch, *lpszStr))
- return (LPSTR)lpszStr;
- lpszStr = CharNextA(lpszStr);
- }
- }
- return NULL;
+ *lpiRet = bNegative ? -iRet : iRet;
+ return TRUE;
}
/*************************************************************************
- * StrPBrkW [SHLWAPI.@]
+ * StrToIntExW [SHLWAPI.@]
*
- * See StrPBrkA.
+ * See StrToIntExA.
*/
-LPWSTR WINAPI StrPBrkW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
+BOOL WINAPI StrToIntExW(LPCWSTR lpszStr, DWORD dwFlags, LPINT lpiRet)
{
- if (!lpszStr || !lpszMatch) return NULL;
- return strpbrkW( lpszStr, lpszMatch );
+ LONGLONG li;
+ BOOL bRes;
+
+ TRACE("(%s,%08X,%p)\n", debugstr_w(lpszStr), dwFlags, lpiRet);
+
+ bRes = StrToInt64ExW(lpszStr, dwFlags, &li);
+ if (bRes) *lpiRet = li;
+ return bRes;
}
/*************************************************************************
- * SHLWAPI_StrRChrHelperA
+ * StrToInt64ExW [SHLWAPI.@]
*
- * Internal implementation of StrRChrA/StrRChrIA.
+ * See StrToIntExA.
*/
-static LPSTR SHLWAPI_StrRChrHelperA(LPCSTR lpszStr,
- LPCSTR lpszEnd, WORD ch,
- BOOL (WINAPI *pChrCmpFn)(WORD,WORD))
+BOOL WINAPI StrToInt64ExW(LPCWSTR lpszStr, DWORD dwFlags, LONGLONG *lpiRet)
{
- LPCSTR lpszRet = NULL;
+ BOOL bNegative = FALSE;
+ LONGLONG iRet = 0;
- if (lpszStr)
- {
- WORD ch2;
+ TRACE("(%s,%08X,%p)\n", debugstr_w(lpszStr), dwFlags, lpiRet);
- if (!lpszEnd)
- lpszEnd = lpszStr + lstrlenA(lpszStr);
+ if (!lpszStr || !lpiRet)
+ {
+ WARN("Invalid parameter would crash under Win32!\n");
+ return FALSE;
+ }
+ if (dwFlags > STIF_SUPPORT_HEX) WARN("Unknown flags %08x\n", dwFlags);
- while (*lpszStr && lpszStr <= lpszEnd)
- {
- ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
+ /* Skip leading space, '+', '-' */
+ while (isspaceW(*lpszStr)) lpszStr++;
- if (!pChrCmpFn(ch, ch2))
- lpszRet = lpszStr;
- lpszStr = CharNextA(lpszStr);
- }
+ if (*lpszStr == '-')
+ {
+ bNegative = TRUE;
+ lpszStr++;
}
- return (LPSTR)lpszRet;
-}
-
-/**************************************************************************
- * StrRChrA [SHLWAPI.@]
- *
- * Find the last occurrence of a character in string.
- *
- * PARAMS
- * lpszStr [I] String to search in
- * lpszEnd [I] Place to end search, or NULL to search until the end of lpszStr
- * ch [I] Character to search for.
- *
- * RETURNS
- * Success: A pointer to the last occurrence of ch in lpszStr before lpszEnd,
- * or NULL if not found.
- * Failure: NULL, if any arguments are invalid.
- */
-LPSTR WINAPI StrRChrA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
-{
- TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
+ else if (*lpszStr == '+')
+ lpszStr++;
- return SHLWAPI_StrRChrHelperA(lpszStr, lpszEnd, ch, SHLWAPI_ChrCmpA);
-}
+ if (dwFlags & STIF_SUPPORT_HEX &&
+ *lpszStr == '0' && tolowerW(lpszStr[1]) == 'x')
+ {
+ /* Read hex number */
+ lpszStr += 2;
-/**************************************************************************
- * StrRChrW [SHLWAPI.@]
- *
- * See StrRChrA.
- */
-LPWSTR WINAPI StrRChrW(LPCWSTR str, LPCWSTR end, WORD ch)
-{
- WCHAR *ret = NULL;
+ if (!isxdigitW(*lpszStr))
+ return FALSE;
- if (!str) return NULL;
- if (!end) end = str + strlenW(str);
- while (str < end)
+ while (isxdigitW(*lpszStr))
{
- if (*str == ch) ret = (WCHAR *)str;
- str++;
+ iRet = iRet * 16;
+ if (isdigitW(*lpszStr))
+ iRet += (*lpszStr - '0');
+ else
+ iRet += 10 + (tolowerW(*lpszStr) - 'a');
+ lpszStr++;
}
- return ret;
-}
-
-/**************************************************************************
- * StrRChrIA [SHLWAPI.@]
- *
- * Find the last occurrence of a character in string, ignoring case.
- *
- * PARAMS
- * lpszStr [I] String to search in
- * lpszEnd [I] Place to end search, or NULL to search until the end of lpszStr
- * ch [I] Character to search for.
- *
- * RETURNS
- * Success: A pointer to the last occurrence of ch in lpszStr before lpszEnd,
- * or NULL if not found.
- * Failure: NULL, if any arguments are invalid.
- */
-LPSTR WINAPI StrRChrIA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
-{
- TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
-
- return SHLWAPI_StrRChrHelperA(lpszStr, lpszEnd, ch, ChrCmpIA);
-}
+ *lpiRet = iRet;
+ return TRUE;
+ }
-/**************************************************************************
- * StrRChrIW [SHLWAPI.@]
- *
- * See StrRChrIA.
- */
-LPWSTR WINAPI StrRChrIW(LPCWSTR str, LPCWSTR end, WORD ch)
-{
- WCHAR *ret = NULL;
+ /* Read decimal number */
+ if (!isdigitW(*lpszStr))
+ return FALSE;
- if (!str) return NULL;
- if (!end) end = str + strlenW(str);
- while (str < end)
- {
- if (!ChrCmpIW(*str, ch)) ret = (WCHAR *)str;
- str++;
- }
- return ret;
+ while (isdigitW(*lpszStr))
+ {
+ iRet = iRet * 10;
+ iRet += (*lpszStr - '0');
+ lpszStr++;
+ }
+ *lpiRet = bNegative ? -iRet : iRet;
+ return TRUE;
}
/*************************************************************************
- * StrCatBuffA [SHLWAPI.@]
- *
- * Concatenate two strings together.
- *
- * PARAMS
- * lpszStr [O] String to concatenate to
- * lpszCat [I] String to add to lpszCat
- * cchMax [I] Maximum number of characters for the whole string
- *
- * RETURNS
- * lpszStr.
- *
- * NOTES
- * cchMax determines the number of characters in the final length of the
- * string, not the number appended to lpszStr from lpszCat.
+ * StrDupW [SHLWAPI.@]
*/
-LPSTR WINAPI StrCatBuffA(LPSTR lpszStr, LPCSTR lpszCat, INT cchMax)
+LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
{
- INT iLen;
+ int iLen;
+ LPWSTR lpszRet;
+
+ TRACE("(%s)\n",debugstr_w(lpszStr));
- TRACE("(%p,%s,%d)\n", lpszStr, debugstr_a(lpszCat), cchMax);
+ iLen = (lpszStr ? strlenW(lpszStr) + 1 : 1) * sizeof(WCHAR);
+ lpszRet = LocalAlloc(LMEM_FIXED, iLen);
- if (!lpszStr)
+ if (lpszRet)
{
- WARN("Invalid lpszStr would crash under Win32!\n");
- return NULL;
+ if (lpszStr)
+ memcpy(lpszRet, lpszStr, iLen);
+ else
+ *lpszRet = '\0';
}
-
- iLen = strlen(lpszStr);
- cchMax -= iLen;
-
- if (cchMax > 0)
- StrCpyNA(lpszStr + iLen, lpszCat, cchMax);
- return lpszStr;
+ return lpszRet;
}
/*************************************************************************
* StrCatBuffW [SHLWAPI.@]
- *
- * See StrCatBuffA.
*/
LPWSTR WINAPI StrCatBuffW(LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax)
{
@@ -1809,95 +1038,6 @@ LPWSTR WINAPI StrNCatW(LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax)
return lpszRet;
}
-/*************************************************************************
- * StrTrimA [SHLWAPI.@]
- *
- * Remove characters from the start and end of a string.
- *
- * PARAMS
- * lpszStr [O] String to remove characters from
- * lpszTrim [I] Characters to remove from lpszStr
- *
- * RETURNS
- * TRUE If lpszStr was valid and modified
- * FALSE Otherwise
- */
-BOOL WINAPI StrTrimA(LPSTR lpszStr, LPCSTR lpszTrim)
-{
- DWORD dwLen;
- LPSTR lpszRead = lpszStr;
- BOOL bRet = FALSE;
-
- TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszTrim));
-
- if (lpszRead && *lpszRead)
- {
- while (*lpszRead && StrChrA(lpszTrim, *lpszRead))
- lpszRead = CharNextA(lpszRead); /* Skip leading matches */
-
- dwLen = strlen(lpszRead);
-
- if (lpszRead != lpszStr)
- {
- memmove(lpszStr, lpszRead, dwLen + 1);
- bRet = TRUE;
- }
- if (dwLen > 0)
- {
- lpszRead = lpszStr + dwLen;
- while (StrChrA(lpszTrim, lpszRead[-1]))
- lpszRead = CharPrevA(lpszStr, lpszRead); /* Skip trailing matches */
-
- if (lpszRead != lpszStr + dwLen)
- {
- *lpszRead = '\0';
- bRet = TRUE;
- }
- }
- }
- return bRet;
-}
-
-/*************************************************************************
- * StrTrimW [SHLWAPI.@]
- *
- * See StrTrimA.
- */
-BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
-{
- DWORD dwLen;
- LPWSTR lpszRead = lpszStr;
- BOOL bRet = FALSE;
-
- TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszTrim));
-
- if (lpszRead && *lpszRead)
- {
- while (*lpszRead && StrChrW(lpszTrim, *lpszRead)) lpszRead++;
-
- dwLen = strlenW(lpszRead);
-
- if (lpszRead != lpszStr)
- {
- memmove(lpszStr, lpszRead, (dwLen + 1) * sizeof(WCHAR));
- bRet = TRUE;
- }
- if (dwLen > 0)
- {
- lpszRead = lpszStr + dwLen;
- while (StrChrW(lpszTrim, lpszRead[-1]))
- lpszRead--; /* Skip trailing matches */
-
- if (lpszRead != lpszStr + dwLen)
- {
- *lpszRead = '\0';
- bRet = TRUE;
- }
- }
- }
- return bRet;
-}
-
/*************************************************************************
* _SHStrDupAA [INTERNAL]
*
@@ -2175,175 +1315,6 @@ INT WINAPI StrFromTimeIntervalW(LPWSTR lpszStr, UINT cchMax, DWORD dwMS,
return iRet;
}
-/*************************************************************************
- * StrIsIntlEqualA [SHLWAPI.@]
- *
- * Compare two strings.
- *
- * PARAMS
- * bCase [I] Whether to compare case sensitively
- * lpszStr [I] First string to compare
- * lpszComp [I] Second string to compare
- * iLen [I] Length to compare
- *
- * RETURNS
- * TRUE If the strings are equal.
- * FALSE Otherwise.
- */
-BOOL WINAPI StrIsIntlEqualA(BOOL bCase, LPCSTR lpszStr, LPCSTR lpszComp,
- int iLen)
-{
- DWORD dwFlags;
-
- TRACE("(%d,%s,%s,%d)\n", bCase,
- debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
-
- /* FIXME: This flag is undocumented and unknown by our CompareString.
- * We need a define for it.
- */
- dwFlags = 0x10000000;
- if (!bCase) dwFlags |= NORM_IGNORECASE;
-
- return (CompareStringA(GetThreadLocale(), dwFlags, lpszStr, iLen, lpszComp, iLen) == CSTR_EQUAL);
-}
-
-/*************************************************************************
- * StrIsIntlEqualW [SHLWAPI.@]
- *
- * See StrIsIntlEqualA.
- */
-BOOL WINAPI StrIsIntlEqualW(BOOL bCase, LPCWSTR lpszStr, LPCWSTR lpszComp,
- int iLen)
-{
- DWORD dwFlags;
-
- TRACE("(%d,%s,%s,%d)\n", bCase,
- debugstr_w(lpszStr),debugstr_w(lpszComp), iLen);
-
- /* FIXME: This flag is undocumented and unknown by our CompareString.
- * We need a define for it.
- */
- dwFlags = 0x10000000;
- if (!bCase) dwFlags |= NORM_IGNORECASE;
-
- return (CompareStringW(GetThreadLocale(), dwFlags, lpszStr, iLen, lpszComp, iLen) == CSTR_EQUAL);
-}
-
-/*************************************************************************
- * @ [SHLWAPI.399]
- *
- * Copy a string to another string, up to a maximum number of characters.
- *
- * PARAMS
- * lpszDest [O] Destination string
- * lpszSrc [I] Source string
- * iLen [I] Maximum number of chars to copy
- *
- * RETURNS
- * Success: A pointer to the last character written to lpszDest.
- * Failure: lpszDest, if any arguments are invalid.
- */
-LPSTR WINAPI StrCpyNXA(LPSTR lpszDest, LPCSTR lpszSrc, int iLen)
-{
- TRACE("(%p,%s,%i)\n", lpszDest, debugstr_a(lpszSrc), iLen);
-
- if (lpszDest && lpszSrc && iLen > 0)
- {
- while ((iLen-- > 1) && *lpszSrc)
- *lpszDest++ = *lpszSrc++;
- if (iLen >= 0)
- *lpszDest = '\0';
- }
- return lpszDest;
-}
-
-/*************************************************************************
- * @ [SHLWAPI.400]
- *
- * Unicode version of StrCpyNXA.
- */
-LPWSTR WINAPI StrCpyNXW(LPWSTR lpszDest, LPCWSTR lpszSrc, int iLen)
-{
- TRACE("(%p,%s,%i)\n", lpszDest, debugstr_w(lpszSrc), iLen);
-
- if (lpszDest && lpszSrc && iLen > 0)
- {
- while ((iLen-- > 1) && *lpszSrc)
- *lpszDest++ = *lpszSrc++;
- if (iLen >= 0)
- *lpszDest = '\0';
- }
- return lpszDest;
-}
-
-/*************************************************************************
- * StrCmpLogicalW [SHLWAPI.@]
- *
- * Compare two strings, ignoring case and comparing digits as numbers.
- *
- * PARAMS
- * lpszStr [I] First string to compare
- * lpszComp [I] Second string to compare
- * iLen [I] Length to compare
- *
- * RETURNS
- * TRUE If the strings are equal.
- * FALSE Otherwise.
- */
-INT WINAPI StrCmpLogicalW(LPCWSTR lpszStr, LPCWSTR lpszComp)
-{
- INT iDiff;
-
- TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszComp));
-
- if (lpszStr && lpszComp)
- {
- while (*lpszStr)
- {
- if (!*lpszComp)
- return 1;
- else if (isdigitW(*lpszStr))
- {
- int iStr, iComp;
-
- if (!isdigitW(*lpszComp))
- return -1;
-
- /* Compare the numbers */
- StrToIntExW(lpszStr, 0, &iStr);
- StrToIntExW(lpszComp, 0, &iComp);
-
- if (iStr < iComp)
- return -1;
- else if (iStr > iComp)
- return 1;
-
- /* Skip */
- while (isdigitW(*lpszStr))
- lpszStr++;
- while (isdigitW(*lpszComp))
- lpszComp++;
- }
- else if (isdigitW(*lpszComp))
- return 1;
- else
- {
- iDiff = ChrCmpIW(*lpszStr,*lpszComp);
- if (iDiff > 0)
- return 1;
- else if (iDiff < 0)
- return -1;
-
- lpszStr++;
- lpszComp++;
- }
- }
- if (*lpszComp)
- return -1;
- }
- return 0;
-}
-
/* Structure for formatting byte strings */
typedef struct tagSHLWAPI_BYTEFORMATS
{
--
2.20.1
More information about the wine-devel
mailing list