ReactOS 0.4.16-dev-197-g92996da
string.c File Reference
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "comctl32.h"
#include "wine/debug.h"
Include dependency graph for string.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commctrl)
 
static BOOL COMCTL32_ChrCmpHelperA (WORD ch1, WORD ch2, DWORD dwFlags)
 
static BOOL COMCTL32_ChrCmpA (WORD ch1, WORD ch2)
 
static BOOL COMCTL32_ChrCmpIA (WORD ch1, WORD ch2)
 
static BOOL COMCTL32_ChrCmpIW (WCHAR ch1, WCHAR ch2)
 
INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen)
 
BOOL WINAPI Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc)
 
INT WINAPI Str_GetPtrW (LPCWSTR lpSrc, LPWSTR lpDest, INT nMaxLen)
 
BOOL WINAPI Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc)
 
LPSTR WINAPI StrChrA (LPCSTR lpszStr, WORD ch)
 
INT WINAPI StrCmpNIA (LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
 
INT WINAPI StrCmpNIW (LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
 
static LPSTR COMCTL32_StrStrHelperA (LPCSTR lpszStr, LPCSTR lpszSearch, INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT))
 
LPSTR WINAPI StrStrIA (LPCSTR lpszStr, LPCSTR lpszSearch)
 
INT WINAPI StrToIntA (LPCSTR lpszStr)
 
LPWSTR WINAPI StrStrIW (LPCWSTR lpszStr, LPCWSTR lpszSearch)
 
INT WINAPI StrToIntW (LPCWSTR lpString)
 
static int COMCTL32_StrSpnHelperA (LPCSTR lpszStr, LPCSTR lpszMatch, LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD), BOOL bInvert)
 
int WINAPI StrCSpnA (LPCSTR lpszStr, LPCSTR lpszMatch)
 
LPWSTR WINAPI StrChrW (LPCWSTR lpszStr, WCHAR ch)
 
INT WINAPI StrCmpNA (LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
 
INT WINAPI StrCmpNW (LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
 
LPSTR WINAPI StrRChrA (LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
 
LPWSTR WINAPI StrRChrW (LPCWSTR str, LPCWSTR end, WORD ch)
 
LPSTR WINAPI StrStrA (LPCSTR lpszStr, LPCSTR lpszSearch)
 
LPWSTR WINAPI StrStrW (LPCWSTR lpszStr, LPCWSTR lpszSearch)
 
LPSTR WINAPI StrChrIA (LPCSTR lpszStr, WORD ch)
 
LPWSTR WINAPI StrChrIW (LPCWSTR lpszStr, WCHAR ch)
 
LPSTR WINAPI StrRStrIA (LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
 
LPWSTR WINAPI StrRStrIW (LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
 
int WINAPI StrCSpnIA (LPCSTR lpszStr, LPCSTR lpszMatch)
 
int WINAPI StrCSpnIW (LPCWSTR lpszStr, LPCWSTR lpszMatch)
 
LPSTR WINAPI StrRChrIA (LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
 
LPWSTR WINAPI StrRChrIW (LPCWSTR str, LPCWSTR end, WORD ch)
 
int WINAPI StrCSpnW (LPCWSTR lpszStr, LPCWSTR lpszMatch)
 
BOOL WINAPI IntlStrEqWorkerA (BOOL bCase, LPCSTR lpszStr, LPCSTR lpszComp, int iLen)
 
BOOL WINAPI IntlStrEqWorkerW (BOOL bCase, LPCWSTR lpszStr, LPCWSTR lpszComp, int iLen)
 

Function Documentation

◆ COMCTL32_ChrCmpA()

static BOOL COMCTL32_ChrCmpA ( WORD  ch1,
WORD  ch2 
)
static

Definition at line 84 of file string.c.

85{
86 return COMCTL32_ChrCmpHelperA(ch1, ch2, 0);
87}
static BOOL COMCTL32_ChrCmpHelperA(WORD ch1, WORD ch2, DWORD dwFlags)
Definition: string.c:54

Referenced by StrChrA(), and StrRChrA().

◆ COMCTL32_ChrCmpHelperA()

static BOOL COMCTL32_ChrCmpHelperA ( WORD  ch1,
WORD  ch2,
DWORD  dwFlags 
)
static

Definition at line 54 of file string.c.

55{
56 char str1[3], str2[3];
57
58 str1[0] = LOBYTE(ch1);
59 if (IsDBCSLeadByte(str1[0]))
60 {
61 str1[1] = HIBYTE(ch1);
62 str1[2] = '\0';
63 }
64 else
65 str1[1] = '\0';
66
67 str2[0] = LOBYTE(ch2);
68 if (IsDBCSLeadByte(str2[0]))
69 {
70 str2[1] = HIBYTE(ch2);
71 str2[2] = '\0';
72 }
73 else
74 str2[1] = '\0';
75
76 return CompareStringA(GetThreadLocale(), dwFlags, str1, -1, str2, -1) - CSTR_EQUAL;
77}
LCID WINAPI GetThreadLocale(void)
Definition: locale.c:2801
BOOL WINAPI IsDBCSLeadByte(BYTE testchar)
Definition: locale.c:2124
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: locale.c:4083
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define CSTR_EQUAL
Definition: winnls.h:456

Referenced by COMCTL32_ChrCmpA(), and COMCTL32_ChrCmpIA().

◆ COMCTL32_ChrCmpIA()

static BOOL COMCTL32_ChrCmpIA ( WORD  ch1,
WORD  ch2 
)
static

Definition at line 102 of file string.c.

103{
104 TRACE("(%d,%d)\n", ch1, ch2);
105
106 return COMCTL32_ChrCmpHelperA(ch1, ch2, NORM_IGNORECASE);
107}
#define TRACE(s)
Definition: solgame.cpp:4
#define NORM_IGNORECASE
Definition: winnls.h:176

Referenced by StrChrIA(), and StrRStrIA().

◆ COMCTL32_ChrCmpIW()

static BOOL COMCTL32_ChrCmpIW ( WCHAR  ch1,
WCHAR  ch2 
)
inlinestatic

Definition at line 114 of file string.c.

115{
116 return CompareStringW(GetThreadLocale(), NORM_IGNORECASE, &ch1, 1, &ch2, 1) - CSTR_EQUAL;
117}
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: locale.c:4014

Referenced by StrRChrIW(), and StrRStrIW().

◆ COMCTL32_StrSpnHelperA()

static int COMCTL32_StrSpnHelperA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch,
LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD ,
BOOL  bInvert 
)
static

Definition at line 417 of file string.c.

420{
421 LPCSTR lpszRead = lpszStr;
422 if (lpszStr && *lpszStr && lpszMatch)
423 {
424 while (*lpszRead)
425 {
426 LPCSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
427
428 if (!bInvert && !lpszTest)
429 break;
430 if (bInvert && lpszTest)
431 break;
432 lpszRead = CharNextA(lpszRead);
433 };
434 }
435 return lpszRead - lpszStr;
436}
static BOOL bInvert
Definition: win.c:51
LPSTR WINAPI CharNextA(_In_ LPCSTR)
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by StrCSpnA(), and StrCSpnIA().

◆ COMCTL32_StrStrHelperA()

static LPSTR COMCTL32_StrStrHelperA ( LPCSTR  lpszStr,
LPCSTR  lpszSearch,
INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT  
)
static

Definition at line 318 of file string.c.

320{
321 size_t iLen;
322 LPCSTR end;
323
324 if (!lpszStr || !lpszSearch || !*lpszSearch)
325 return NULL;
326
327 iLen = strlen(lpszSearch);
328 end = lpszStr + strlen(lpszStr);
329
330 while (lpszStr + iLen <= end)
331 {
332 if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
333 return (LPSTR)lpszStr;
334 lpszStr = CharNextA(lpszStr);
335 }
336 return NULL;
337}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define NULL
Definition: types.h:112
GLuint GLuint end
Definition: gl.h:1545
char * LPSTR
Definition: xmlstorage.h:182

Referenced by StrStrA(), and StrStrIA().

◆ IntlStrEqWorkerA()

BOOL WINAPI IntlStrEqWorkerA ( BOOL  bCase,
LPCSTR  lpszStr,
LPCSTR  lpszComp,
int  iLen 
)

Definition at line 860 of file string.c.

862{
864 int iRet;
865
866 TRACE("(%d,%s,%s,%d)\n", bCase,
867 debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
868
869 /* FIXME: This flag is undocumented and unknown by our CompareString.
870 */
872 if (!bCase) dwFlags |= NORM_IGNORECASE;
873
875 dwFlags, lpszStr, iLen, lpszComp, iLen);
876
877 if (!iRet)
878 iRet = CompareStringA(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
879
880 return iRet == CSTR_EQUAL;
881}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define debugstr_a
Definition: kernel32.h:31
#define LOCALE_RETURN_GENITIVE_NAMES
Definition: winnls.h:24

◆ IntlStrEqWorkerW()

BOOL WINAPI IntlStrEqWorkerW ( BOOL  bCase,
LPCWSTR  lpszStr,
LPCWSTR  lpszComp,
int  iLen 
)

Definition at line 888 of file string.c.

890{
892 int iRet;
893
894 TRACE("(%d,%s,%s,%d)\n", bCase,
895 debugstr_w(lpszStr),debugstr_w(lpszComp), iLen);
896
897 /* FIXME: This flag is undocumented and unknown by our CompareString.
898 */
900 if (!bCase) dwFlags |= NORM_IGNORECASE;
901
903 dwFlags, lpszStr, iLen, lpszComp, iLen);
904
905 if (!iRet)
906 iRet = CompareStringW(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
907
908 return iRet == CSTR_EQUAL;
909}
#define debugstr_w
Definition: kernel32.h:32

◆ Str_GetPtrA()

INT WINAPI Str_GetPtrA ( LPCSTR  lpSrc,
LPSTR  lpDest,
INT  nMaxLen 
)

Definition at line 132 of file string.c.

133{
134 INT len;
135
136 TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
137
138 if ((!lpDest || nMaxLen == 0) && lpSrc)
139 return (strlen(lpSrc) + 1);
140
141 if (nMaxLen == 0)
142 return 0;
143
144 if (lpSrc == NULL) {
145 lpDest[0] = '\0';
146 return 0;
147 }
148
149 len = strlen(lpSrc) + 1;
150 if (len >= nMaxLen)
151 len = nMaxLen;
152
153 RtlMoveMemory (lpDest, lpSrc, len - 1);
154 lpDest[len - 1] = '\0';
155
156 return len;
157}
GLenum GLsizei len
Definition: glext.h:6722
int32_t INT
Definition: typedefs.h:58
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264

Referenced by InitFunctionPtrs().

◆ Str_GetPtrW()

INT WINAPI Str_GetPtrW ( LPCWSTR  lpSrc,
LPWSTR  lpDest,
INT  nMaxLen 
)

Definition at line 200 of file string.c.

201{
202 INT len;
203
204 TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
205
206 if (!lpDest && lpSrc)
207 return lstrlenW (lpSrc);
208
209 if (nMaxLen == 0)
210 return 0;
211
212 if (lpSrc == NULL) {
213 lpDest[0] = '\0';
214 return 0;
215 }
216
217 len = lstrlenW (lpSrc);
218 if (len >= nMaxLen)
219 len = nMaxLen - 1;
220
221 RtlMoveMemory (lpDest, lpSrc, len*sizeof(WCHAR));
222 lpDest[len] = '\0';
223
224 return len;
225}
#define lstrlenW
Definition: compat.h:750
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by HEADER_GetItemT(), HEADER_PrepareCallbackItems(), InitFunctionPtrs(), REBAR_GetBandInfoT(), TAB_GetItemT(), TOOLBAR_GetButtonInfoT(), and TOOLTIPS_GetDispInfoW().

◆ Str_SetPtrA()

BOOL WINAPI Str_SetPtrA ( LPSTR lppDest,
LPCSTR  lpSrc 
)

Definition at line 176 of file string.c.

177{
178 TRACE("(%p %p)\n", lppDest, lpSrc);
179
180 if (lpSrc) {
181 LPSTR ptr = ReAlloc (*lppDest, strlen (lpSrc) + 1);
182 if (!ptr)
183 return FALSE;
184 strcpy (ptr, lpSrc);
185 *lppDest = ptr;
186 }
187 else {
188 Free (*lppDest);
189 *lppDest = NULL;
190 }
191
192 return TRUE;
193}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
PVOID ReAlloc(IN DWORD dwFlags, IN PVOID lpMem, IN SIZE_T dwBytes)
Definition: main.c:76
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static PVOID ptr
Definition: dispmode.c:27
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815

Referenced by InitFunctionPtrs().

◆ Str_SetPtrW()

BOOL WINAPI Str_SetPtrW ( LPWSTR lppDest,
LPCWSTR  lpSrc 
)

Definition at line 232 of file string.c.

233{
234 TRACE("(%p %s)\n", lppDest, debugstr_w(lpSrc));
235
236 if (lpSrc) {
237 INT len = lstrlenW (lpSrc) + 1;
238 LPWSTR ptr = ReAlloc (*lppDest, len * sizeof(WCHAR));
239 if (!ptr)
240 return FALSE;
241 lstrcpyW (ptr, lpSrc);
242 *lppDest = ptr;
243 }
244 else {
245 Free (*lppDest);
246 *lppDest = NULL;
247 }
248
249 return TRUE;
250}
#define lstrcpyW
Definition: compat.h:749
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by HEADER_StoreHDItemInHeader(), InitFunctionPtrs(), REBAR_InsertBandT(), REBAR_SetBandInfoT(), set_string_index(), TAB_InsertItemT(), TAB_SetItemT(), textsetptrT(), TOOLBAR_AddStringW(), TOOLTIPS_GetDispInfoA(), and TOOLTIPS_GetDispInfoW().

◆ StrChrA()

LPSTR WINAPI StrChrA ( LPCSTR  lpszStr,
WORD  ch 
)

Definition at line 266 of file string.c.

267{
268 TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
269
270 if (lpszStr)
271 {
272 while (*lpszStr)
273 {
274 if (!COMCTL32_ChrCmpA(*lpszStr, ch))
275 return (LPSTR)lpszStr;
276 lpszStr = CharNextA(lpszStr);
277 }
278 }
279 return NULL;
280}
static BOOL COMCTL32_ChrCmpA(WORD ch1, WORD ch2)
Definition: string.c:84

Referenced by FPropContainsProp(), PathFindNextComponentA(), PathQuoteSpacesA(), PathSkipRootA(), SHStripMneumonicA(), StrCSpnA(), StrPBrkA(), StrSpnA(), StrTrimA(), and test_StrChrA().

◆ StrChrIA()

LPSTR WINAPI StrChrIA ( LPCSTR  lpszStr,
WORD  ch 
)

Definition at line 610 of file string.c.

611{
612 TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
613
614 if (lpszStr)
615 {
616 while (*lpszStr)
617 {
618 if (!COMCTL32_ChrCmpIA(*lpszStr, ch))
619 return (LPSTR)lpszStr;
620 lpszStr = CharNextA(lpszStr);
621 }
622 }
623 return NULL;
624}
static BOOL COMCTL32_ChrCmpIA(WORD ch1, WORD ch2)
Definition: string.c:102

Referenced by FPropContainsProp(), StrCSpnIA(), and test_StrChrIA().

◆ StrChrIW()

LPWSTR WINAPI StrChrIW ( LPCWSTR  lpszStr,
WCHAR  ch 
)

Definition at line 631 of file string.c.

632{
633 TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
634
635 if (lpszStr)
636 {
637 ch = towupper(ch);
638 while (*lpszStr)
639 {
640 if (towupper(*lpszStr) == ch)
641 return (LPWSTR)lpszStr;
642 lpszStr++;
643 }
644 lpszStr = NULL;
645 }
646 return (LPWSTR)lpszStr;
647}
#define towupper(c)
Definition: wctype.h:99

Referenced by StrCSpnIW(), and test_StrChrIW().

◆ StrChrW()

◆ StrCmpNA()

INT WINAPI StrCmpNA ( LPCSTR  lpszStr,
LPCSTR  lpszComp,
INT  iLen 
)

Definition at line 489 of file string.c.

490{
491 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
492 return CompareStringA(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
493}

Referenced by StrCmpNCA(), StrStrA(), and test_StrCmpA().

◆ StrCmpNIA()

INT WINAPI StrCmpNIA ( LPCSTR  lpszStr,
LPCSTR  lpszComp,
INT  iLen 
)

Definition at line 296 of file string.c.

297{
298 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
299 return CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
300}

Referenced by DoTestEntry(), StrCmpNICA(), StrRStrIA(), StrStrIA(), and test_StrCmpA().

◆ StrCmpNIW()

INT WINAPI StrCmpNIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp,
INT  iLen 
)

◆ StrCmpNW()

INT WINAPI StrCmpNW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp,
INT  iLen 
)

◆ StrCSpnA()

int WINAPI StrCSpnA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 452 of file string.c.

453{
454 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
455
456 return COMCTL32_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, TRUE);
457}
static int COMCTL32_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch, LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD), BOOL bInvert)
Definition: string.c:417
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:266

◆ StrCSpnIA()

int WINAPI StrCSpnIA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 746 of file string.c.

747{
748 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
749
750 return COMCTL32_StrSpnHelperA(lpszStr, lpszMatch, StrChrIA, TRUE);
751}
LPSTR WINAPI StrChrIA(LPCSTR lpszStr, WORD ch)
Definition: string.c:610

◆ StrCSpnIW()

int WINAPI StrCSpnIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 758 of file string.c.

759{
760 LPCWSTR lpszRead = lpszStr;
761
762 TRACE("(%s,%s)\n",debugstr_w(lpszStr), debugstr_w(lpszMatch));
763
764 if (lpszStr && *lpszStr && lpszMatch)
765 {
766 while (*lpszRead)
767 {
768 if (StrChrIW(lpszMatch, *lpszRead)) break;
769 lpszRead++;
770 }
771 }
772 return lpszRead - lpszStr;
773}
LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:631
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ StrCSpnW()

int WINAPI StrCSpnW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 839 of file string.c.

840{
841 if (!lpszStr || !lpszMatch) return 0;
842 return wcscspn( lpszStr, lpszMatch );
843}
_Check_return_ _CRTIMP size_t __cdecl wcscspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)

◆ StrRChrA()

LPSTR WINAPI StrRChrA ( LPCSTR  lpszStr,
LPCSTR  lpszEnd,
WORD  ch 
)

Definition at line 521 of file string.c.

522{
523 LPCSTR lpszRet = NULL;
524
525 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
526
527 if (lpszStr)
528 {
529 WORD ch2;
530
531 if (!lpszEnd)
532 lpszEnd = lpszStr + lstrlenA(lpszStr);
533
534 while (*lpszStr && lpszStr <= lpszEnd)
535 {
536 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
537
538 if (!COMCTL32_ChrCmpA(ch, ch2))
539 lpszRet = lpszStr;
540 lpszStr = CharNextA(lpszStr);
541 }
542 }
543 return (LPSTR)lpszRet;
544}
unsigned short WORD
Definition: ntddk_ex.h:93
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145

Referenced by test_StrRChrA().

◆ StrRChrIA()

LPSTR WINAPI StrRChrIA ( LPCSTR  lpszStr,
LPCSTR  lpszEnd,
WORD  ch 
)

Definition at line 790 of file string.c.

791{
792 LPCSTR lpszRet = NULL;
793
794 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
795
796 if (lpszStr)
797 {
798 WORD ch2;
799
800 if (!lpszEnd)
801 lpszEnd = lpszStr + lstrlenA(lpszStr);
802
803 while (*lpszStr && lpszStr <= lpszEnd)
804 {
805 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
806
807 if (ch == ch2)
808 lpszRet = lpszStr;
809 lpszStr = CharNextA(lpszStr);
810 }
811 }
812 return (LPSTR)lpszRet;
813}

◆ StrRChrIW()

LPWSTR WINAPI StrRChrIW ( LPCWSTR  str,
LPCWSTR  end,
WORD  ch 
)

Definition at line 820 of file string.c.

821{
822 WCHAR *ret = NULL;
823
824 if (!str) return NULL;
825 if (!end) end = str + lstrlenW(str);
826 while (str < end)
827 {
828 if (!COMCTL32_ChrCmpIW(*str, ch)) ret = (WCHAR *)str;
829 str++;
830 }
831 return ret;
832}
static BOOL COMCTL32_ChrCmpIW(WCHAR ch1, WCHAR ch2)
Definition: string.c:114
const WCHAR * str
int ret

◆ StrRChrW()

LPWSTR WINAPI StrRChrW ( LPCWSTR  str,
LPCWSTR  end,
WORD  ch 
)

Definition at line 552 of file string.c.

553{
554 WCHAR *ret = NULL;
555
556 if (!str) return NULL;
557 if (!end) end = str + lstrlenW(str);
558 while (str < end)
559 {
560 if (*str == ch) ret = (WCHAR *)str;
561 str++;
562 }
563 return ret;
564}

Referenced by add_file_to_entry(), CopySdbToAppPatch(), CIniPropertyBag::LooksLikeAnAlternateStream(), SdbUninstall(), SHPathPrepareForWriteW(), test_StrRChrW(), and wildcard_to_file().

◆ StrRStrIA()

LPSTR WINAPI StrRStrIA ( LPCSTR  lpszStr,
LPCSTR  lpszEnd,
LPCSTR  lpszSearch 
)

Definition at line 662 of file string.c.

663{
664 LPSTR lpszRet = NULL;
665 WORD ch1, ch2;
666 INT iLen;
667
668 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
669
670 if (!lpszStr || !lpszSearch || !*lpszSearch)
671 return NULL;
672
673 if (IsDBCSLeadByte(*lpszSearch))
674 ch1 = *lpszSearch << 8 | (UCHAR)lpszSearch[1];
675 else
676 ch1 = *lpszSearch;
677 iLen = lstrlenA(lpszSearch);
678
679 if (!lpszEnd)
680 lpszEnd = lpszStr + lstrlenA(lpszStr);
681 else /* reproduce the broken behaviour on Windows */
682 lpszEnd += min(iLen - 1, lstrlenA(lpszEnd));
683
684 while (lpszStr + iLen <= lpszEnd && *lpszStr)
685 {
686 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | (UCHAR)lpszStr[1] : *lpszStr;
687 if (!COMCTL32_ChrCmpIA(ch1, ch2))
688 {
689 if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
690 lpszRet = (LPSTR)lpszStr;
691 }
692 lpszStr = CharNextA(lpszStr);
693 }
694 return lpszRet;
695}
INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:296
#define min(a, b)
Definition: monoChain.cc:55
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ StrRStrIW()

LPWSTR WINAPI StrRStrIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszEnd,
LPCWSTR  lpszSearch 
)

Definition at line 702 of file string.c.

703{
704 LPWSTR lpszRet = NULL;
705 INT iLen;
706
707 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
708
709 if (!lpszStr || !lpszSearch || !*lpszSearch)
710 return NULL;
711
712 iLen = lstrlenW(lpszSearch);
713
714 if (!lpszEnd)
715 lpszEnd = lpszStr + lstrlenW(lpszStr);
716 else /* reproduce the broken behaviour on Windows */
717 lpszEnd += min(iLen - 1, lstrlenW(lpszEnd));
718
719
720 while (lpszStr + iLen <= lpszEnd && *lpszStr)
721 {
722 if (!COMCTL32_ChrCmpIW(*lpszSearch, *lpszStr))
723 {
724 if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
725 lpszRet = (LPWSTR)lpszStr;
726 }
727 lpszStr++;
728 }
729 return lpszRet;
730}
INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:307

◆ StrStrA()

LPSTR WINAPI StrStrA ( LPCSTR  lpszStr,
LPCSTR  lpszSearch 
)

Definition at line 578 of file string.c.

579{
580 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
581
582 return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, StrCmpNA);
583}
static LPSTR COMCTL32_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch, INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT))
Definition: string.c:318
INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:489

Referenced by test_StrStrA().

◆ StrStrIA()

LPSTR WINAPI StrStrIA ( LPCSTR  lpszStr,
LPCSTR  lpszSearch 
)

Definition at line 351 of file string.c.

352{
353 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
354
355 return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, StrCmpNIA);
356}

Referenced by FTP_ParseNextFile(), test_loadlibraryshim(), and test_StrStrIA().

◆ StrStrIW()

LPWSTR WINAPI StrStrIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszSearch 
)

Definition at line 380 of file string.c.

381{
382 int iLen;
383 LPCWSTR end;
384
385 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
386
387 if (!lpszStr || !lpszSearch || !*lpszSearch)
388 return NULL;
389
390 iLen = lstrlenW(lpszSearch);
391 end = lpszStr + lstrlenW(lpszStr);
392
393 while (lpszStr + iLen <= end)
394 {
395 if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
396 return (LPWSTR)lpszStr;
397 lpszStr++;
398 }
399 return NULL;
400}

Referenced by EditTypeDlg_OnChangeIcon(), SearchPatternMatch(), SHELL_InRunDllProcess(), and test_StrStrIW().

◆ StrStrW()

LPWSTR WINAPI StrStrW ( LPCWSTR  lpszStr,
LPCWSTR  lpszSearch 
)

Definition at line 590 of file string.c.

591{
592 if (!lpszStr || !lpszSearch) return NULL;
593 return wcsstr( lpszStr, lpszSearch );
594}
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)

Referenced by IsUnnamed(), TEST_LocaleTests(), and test_StrStrW().

◆ StrToIntA()

INT WINAPI StrToIntA ( LPCSTR  lpszStr)

Definition at line 370 of file string.c.

371{
372 return atoi(lpszStr);
373}
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)

Referenced by Options_RunDLL(), Options_RunDLLA(), PathParseIconLocationA(), and test_StrToIntA().

◆ StrToIntW()

INT WINAPI StrToIntW ( LPCWSTR  lpString)

Definition at line 407 of file string.c.

408{
409 return wcstol(lpString, NULL, 10);
410}
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)

Referenced by _ILReadFromSharedMemory(), add_zone_to_listview(), Dde_OnExecute(), CConfigParser::GetInt(), Int64GetNumFormat(), Options_RunDLLW(), PathParseIconLocationW(), SHRegGetIntW(), and test_StrToIntW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commctrl  )