Commit 0443f2c7 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

shlwapi: Implement StrChrNW.

parent 1775ab4a
......@@ -757,6 +757,7 @@
@ stdcall StrChrA (str long)
@ stdcall StrChrIA (str long)
@ stdcall StrChrIW (wstr long)
@ stdcall StrChrNW(wstr long long)
@ stdcall StrChrW (wstr long)
@ stdcall StrCmpIW (wstr wstr)
@ stdcall StrCmpLogicalW(wstr wstr)
......
......@@ -319,6 +319,25 @@ LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
}
/*************************************************************************
* StrChrNW [SHLWAPI.@]
*/
LPWSTR WINAPI StrChrNW(LPCWSTR lpszStr, WCHAR ch, UINT cchMax)
{
TRACE("(%s(%i),%i)\n", debugstr_wn(lpszStr,cchMax), cchMax, ch);
if (lpszStr)
{
while (*lpszStr && cchMax-- > 0)
{
if (*lpszStr == ch)
return (LPWSTR)lpszStr;
lpszStr++;
}
}
return NULL;
}
/*************************************************************************
* StrCmpIW [SHLWAPI.@]
*
* Compare two strings, ignoring case.
......
......@@ -58,6 +58,7 @@ static HRESULT (WINAPI *pStrRetToBufA)(STRRET*,LPCITEMIDLIST,LPSTR,UINT);
static HRESULT (WINAPI *pStrRetToBufW)(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
static INT (WINAPIV *pwnsprintfA)(LPSTR,INT,LPCSTR, ...);
static INT (WINAPIV *pwnsprintfW)(LPWSTR,INT,LPCWSTR, ...);
static LPWSTR (WINAPI *pStrChrNW)(LPWSTR,WCHAR,UINT);
static int strcmpW(const WCHAR *str1, const WCHAR *str2)
{
......@@ -373,6 +374,27 @@ static void test_StrCpyW(void)
}
}
static void test_StrChrNW(void)
{
static WCHAR string[] = {'T','e','s','t','i','n','g',' ','S','t','r','i','n','g',0};
LPWSTR p;
if (!pStrChrNW)
{
win_skip("StrChrNW not available\n");
return;
}
p = pStrChrNW(string,'t',10);
ok(*p=='t',"Found wrong 't'\n");
ok(*(p+1)=='i',"next should be 'i'\n");
p = pStrChrNW(string,'S',10);
ok(*p=='S',"Found wrong 'S'\n");
p = pStrChrNW(string,'r',10);
ok(p==NULL,"Should not have found 'r'\n");
}
static void test_StrToIntA(void)
{
......@@ -911,6 +933,7 @@ START_TEST(string)
pStrCatBuffW = (void *)GetProcAddress(hShlwapi, "StrCatBuffW");
pStrCpyNXA = (void *)GetProcAddress(hShlwapi, (LPSTR)399);
pStrCpyNXW = (void *)GetProcAddress(hShlwapi, (LPSTR)400);
pStrChrNW = (void *)GetProcAddress(hShlwapi, "StrChrNW");
pStrFormatByteSize64A = (void *)GetProcAddress(hShlwapi, "StrFormatByteSize64A");
pStrFormatKBSizeA = (void *)GetProcAddress(hShlwapi, "StrFormatKBSizeA");
pStrFormatKBSizeW = (void *)GetProcAddress(hShlwapi, "StrFormatKBSizeW");
......@@ -929,6 +952,7 @@ START_TEST(string)
test_StrRChrA();
test_StrRChrW();
test_StrCpyW();
test_StrChrNW();
test_StrToIntA();
test_StrToIntW();
test_StrToIntExA();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment