- Indicate that StrRetToStrN{A|W} and StrRetToBuf{A|W} are identical

code but duplicated deliberately.
- Implement StrRChrI{A|W}.
This commit is contained in:
Guy Albertelli 2001-11-05 23:55:36 +00:00 committed by Alexandre Julliard
parent 8b0841ad38
commit 887c2b3b56
3 changed files with 86 additions and 3 deletions

View File

@ -25,6 +25,13 @@ DEFAULT_DEBUG_CHANNEL(shell);
* *
* NOTES * NOTES
* the pidl is for STRRET OFFSET * the pidl is for STRRET OFFSET
*
* ***** NOTE *****
* This routine is identical to StrRetToBufA in dlls/shlwapi/string.c.
* It was duplicated here because not every version of Shlwapi.dll exports
* StrRetToBufA. If you change one routine, change them both. YOU HAVE BEEN
* WARNED.
* ***** NOTE *****
*/ */
HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl) HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
{ {
@ -56,7 +63,21 @@ HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID
return S_OK; return S_OK;
} }
/*************************************************************************/ /*************************************************************************
* StrRetToStrNW [SHELL32.]
*
* converts a STRRET to a normal string
*
* NOTES
* the pidl is for STRRET OFFSET
*
* ***** NOTE *****
* This routine is identical to StrRetToBufW in dlls/shlwapi/string.c.
* It was duplicated here because not every version of Shlwapi.dll exports
* StrRetToBufW. If you change one routine, change them both. YOU HAVE BEEN
* WARNED.
* ***** NOTE *****
*/
HRESULT WINAPI StrRetToStrNW (LPVOID dest1, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl) HRESULT WINAPI StrRetToStrNW (LPVOID dest1, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
{ {

View File

@ -644,8 +644,8 @@ debug_channels (shell)
@ stub StrPBrkA @ stub StrPBrkA
@ stub StrPBrkW @ stub StrPBrkW
@ stdcall StrRChrA (str str long) StrRChrA @ stdcall StrRChrA (str str long) StrRChrA
@ stub StrRChrIA @ stdcall StrRChrIA (str str long) StrRChrIA
@ stub StrRChrIW @ stdcall StrRChrIW (str str long) StrRChrIW
@ stdcall StrRChrW (wstr wstr long) StrRChrW @ stdcall StrRChrW (wstr wstr long) StrRChrW
@ stub StrRStrIA @ stub StrRStrIA
@ stub StrRStrIW @ stub StrRStrIW

View File

@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <wctype.h>
#include "winerror.h" #include "winerror.h"
#include "windef.h" #include "windef.h"
@ -334,6 +335,53 @@ LPWSTR WINAPI StrRChrW( LPCWSTR lpStart, LPCWSTR lpEnd, WORD wMatch)
} }
/**************************************************************************
* StrRChrIA [SHLWAPI.@]
*
*/
LPSTR WINAPI StrRChrIA( LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch )
{
LPCSTR lpGotIt = NULL;
BOOL dbcs = IsDBCSLeadByte( LOBYTE(wMatch) );
TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
if (!lpEnd) lpEnd = lpStart + strlen(lpStart);
for(; lpStart < lpEnd; lpStart = CharNextA(lpStart))
{
if (dbcs) {
/*
if (_mbctoupper(*lpStart) == _mbctoupper(wMatch))
lpGotIt = lpStart;
*/
if (toupper(*lpStart) == toupper(wMatch)) lpGotIt = lpStart;
} else {
if (toupper(*lpStart) == toupper(wMatch)) lpGotIt = lpStart;
}
}
return (LPSTR)lpGotIt;
}
/**************************************************************************
* StrRChrIW [SHLWAPI.@]
*
*/
LPWSTR WINAPI StrRChrIW( LPCWSTR lpStart, LPCWSTR lpEnd, WORD wMatch)
{
LPCWSTR lpGotIt = NULL;
TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
if (!lpEnd) lpEnd = lpStart + strlenW(lpStart);
for(; lpStart < lpEnd; lpStart = CharNextW(lpStart))
if (towupper(*lpStart) == towupper(wMatch)) lpGotIt = lpStart;
return (LPWSTR)lpGotIt;
}
/************************************************************************* /*************************************************************************
* StrCatBuffA [SHLWAPI.@] * StrCatBuffA [SHLWAPI.@]
* *
@ -377,6 +425,13 @@ LPWSTR WINAPI StrCatBuffW(LPWSTR front, LPCWSTR back, INT size)
* *
* NOTES * NOTES
* the pidl is for STRRET OFFSET * the pidl is for STRRET OFFSET
*
* ***** NOTE *****
* This routine is identical to StrRetToStrNA in dlls/shell32/shellstring.c.
* It was duplicated there because not every version of Shlwapi.dll exports
* StrRetToBufA. If you change one routine, change them both. YOU HAVE BEEN
* WARNED.
* ***** NOTE *****
*/ */
HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, DWORD len) HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, DWORD len)
{ {
@ -415,6 +470,13 @@ HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, D
* *
* NOTES * NOTES
* the pidl is for STRRET OFFSET * the pidl is for STRRET OFFSET
*
* ***** NOTE *****
* This routine is identical to StrRetToStrNW in dlls/shell32/shellstring.c.
* It was duplicated there because not every version of Shlwapi.dll exports
* StrRetToBufW. If you change one routine, change them both. YOU HAVE BEEN
* WARNED.
* ***** NOTE *****
*/ */
HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, DWORD len) HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, DWORD len)
{ {