ReactOS 0.4.15-dev-5667-ged97270
string.c File Reference
#include "config.h"
#include "wine/port.h"
#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/unicode.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 88 of file string.c.

89{
90 return COMCTL32_ChrCmpHelperA(ch1, ch2, 0);
91}
static BOOL COMCTL32_ChrCmpHelperA(WORD ch1, WORD ch2, DWORD dwFlags)
Definition: string.c:58

Referenced by StrChrA(), and StrRChrA().

◆ COMCTL32_ChrCmpHelperA()

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

Definition at line 58 of file string.c.

59{
60 char str1[3], str2[3];
61
62 str1[0] = LOBYTE(ch1);
63 if (IsDBCSLeadByte(str1[0]))
64 {
65 str1[1] = HIBYTE(ch1);
66 str1[2] = '\0';
67 }
68 else
69 str1[1] = '\0';
70
71 str2[0] = LOBYTE(ch2);
72 if (IsDBCSLeadByte(str2[0]))
73 {
74 str2[1] = HIBYTE(ch2);
75 str2[2] = '\0';
76 }
77 else
78 str2[1] = '\0';
79
80 return CompareStringA(GetThreadLocale(), dwFlags, str1, -1, str2, -1) - CSTR_EQUAL;
81}
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2359
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1453
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: lang.c:2303
_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 106 of file string.c.

107{
108 TRACE("(%d,%d)\n", ch1, ch2);
109
110 return COMCTL32_ChrCmpHelperA(ch1, ch2, NORM_IGNORECASE);
111}
#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 118 of file string.c.

119{
120 return CompareStringW(GetThreadLocale(), NORM_IGNORECASE, &ch1, 1, &ch2, 1) - CSTR_EQUAL;
121}
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2279

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 421 of file string.c.

424{
425 LPCSTR lpszRead = lpszStr;
426 if (lpszStr && *lpszStr && lpszMatch)
427 {
428 while (*lpszRead)
429 {
430 LPCSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
431
432 if (!bInvert && !lpszTest)
433 break;
434 if (bInvert && lpszTest)
435 break;
436 lpszRead = CharNextA(lpszRead);
437 };
438 }
439 return lpszRead - lpszStr;
440}
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 322 of file string.c.

324{
325 size_t iLen;
326 LPCSTR end;
327
328 if (!lpszStr || !lpszSearch || !*lpszSearch)
329 return NULL;
330
331 iLen = strlen(lpszSearch);
332 end = lpszStr + strlen(lpszStr);
333
334 while (lpszStr + iLen <= end)
335 {
336 if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
337 return (LPSTR)lpszStr;
338 lpszStr = CharNextA(lpszStr);
339 }
340 return NULL;
341}
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 864 of file string.c.

866{
868 int iRet;
869
870 TRACE("(%d,%s,%s,%d)\n", bCase,
871 debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
872
873 /* FIXME: This flag is undocumented and unknown by our CompareString.
874 */
876 if (!bCase) dwFlags |= NORM_IGNORECASE;
877
879 dwFlags, lpszStr, iLen, lpszComp, iLen);
880
881 if (!iRet)
882 iRet = CompareStringA(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
883
884 return iRet == CSTR_EQUAL;
885}
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 892 of file string.c.

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

◆ Str_GetPtrA()

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

Definition at line 136 of file string.c.

137{
138 INT len;
139
140 TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
141
142 if ((!lpDest || nMaxLen == 0) && lpSrc)
143 return (strlen(lpSrc) + 1);
144
145 if (nMaxLen == 0)
146 return 0;
147
148 if (lpSrc == NULL) {
149 lpDest[0] = '\0';
150 return 0;
151 }
152
153 len = strlen(lpSrc) + 1;
154 if (len >= nMaxLen)
155 len = nMaxLen;
156
157 RtlMoveMemory (lpDest, lpSrc, len - 1);
158 lpDest[len - 1] = '\0';
159
160 return len;
161}
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 204 of file string.c.

205{
206 INT len;
207
208 TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
209
210 if (!lpDest && lpSrc)
211 return strlenW (lpSrc);
212
213 if (nMaxLen == 0)
214 return 0;
215
216 if (lpSrc == NULL) {
217 lpDest[0] = '\0';
218 return 0;
219 }
220
221 len = strlenW (lpSrc);
222 if (len >= nMaxLen)
223 len = nMaxLen - 1;
224
225 RtlMoveMemory (lpDest, lpSrc, len*sizeof(WCHAR));
226 lpDest[len] = '\0';
227
228 return len;
229}
#define strlenW(s)
Definition: unicode.h:28
__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 180 of file string.c.

181{
182 TRACE("(%p %p)\n", lppDest, lpSrc);
183
184 if (lpSrc) {
185 LPSTR ptr = ReAlloc (*lppDest, strlen (lpSrc) + 1);
186 if (!ptr)
187 return FALSE;
188 strcpy (ptr, lpSrc);
189 *lppDest = ptr;
190 }
191 else {
192 Free (*lppDest);
193 *lppDest = NULL;
194 }
195
196 return TRUE;
197}
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 236 of file string.c.

237{
238 TRACE("(%p %s)\n", lppDest, debugstr_w(lpSrc));
239
240 if (lpSrc) {
241 INT len = strlenW (lpSrc) + 1;
242 LPWSTR ptr = ReAlloc (*lppDest, len * sizeof(WCHAR));
243 if (!ptr)
244 return FALSE;
245 strcpyW (ptr, lpSrc);
246 *lppDest = ptr;
247 }
248 else {
249 Free (*lppDest);
250 *lppDest = NULL;
251 }
252
253 return TRUE;
254}
#define strcpyW(d, s)
Definition: unicode.h:29
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 270 of file string.c.

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

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 614 of file string.c.

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

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

◆ StrChrIW()

LPWSTR WINAPI StrChrIW ( LPCWSTR  lpszStr,
WCHAR  ch 
)

Definition at line 635 of file string.c.

636{
637 TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
638
639 if (lpszStr)
640 {
641 ch = toupperW(ch);
642 while (*lpszStr)
643 {
644 if (toupperW(*lpszStr) == ch)
645 return (LPWSTR)lpszStr;
646 lpszStr++;
647 }
648 lpszStr = NULL;
649 }
650 return (LPWSTR)lpszStr;
651}
#define toupperW(n)
Definition: unicode.h:45

Referenced by StrCSpnIW(), and test_StrChrIW().

◆ StrChrW()

◆ StrCmpNA()

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

Definition at line 493 of file string.c.

494{
495 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
496 return CompareStringA(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
497}

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

◆ StrCmpNIA()

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

Definition at line 300 of file string.c.

301{
302 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
303 return CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
304}

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 
)

Definition at line 504 of file string.c.

505{
506 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
507 return CompareStringW(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
508}

Referenced by compare_uris(), CCommonFolder< TSelf, TItemId, TExtractIcon >::CompareName(), MapTypeNameToType(), CCommonFolder< TSelf, TItemId, TExtractIcon >::ParseDisplayName(), StrCmpNCW(), and test_StrCmpW().

◆ StrCSpnA()

int WINAPI StrCSpnA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 456 of file string.c.

457{
458 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
459
460 return COMCTL32_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, TRUE);
461}
static int COMCTL32_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch, LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD), BOOL bInvert)
Definition: string.c:421
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270

◆ StrCSpnIA()

int WINAPI StrCSpnIA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 750 of file string.c.

751{
752 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
753
754 return COMCTL32_StrSpnHelperA(lpszStr, lpszMatch, StrChrIA, TRUE);
755}
LPSTR WINAPI StrChrIA(LPCSTR lpszStr, WORD ch)
Definition: string.c:614

◆ StrCSpnIW()

int WINAPI StrCSpnIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 762 of file string.c.

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

◆ StrCSpnW()

int WINAPI StrCSpnW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 843 of file string.c.

844{
845 if (!lpszStr || !lpszMatch) return 0;
846 return strcspnW( lpszStr, lpszMatch );
847}
#define strcspnW(d, s)
Definition: unicode.h:31

◆ StrRChrA()

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

Definition at line 525 of file string.c.

526{
527 LPCSTR lpszRet = NULL;
528
529 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
530
531 if (lpszStr)
532 {
533 WORD ch2;
534
535 if (!lpszEnd)
536 lpszEnd = lpszStr + lstrlenA(lpszStr);
537
538 while (*lpszStr && lpszStr <= lpszEnd)
539 {
540 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
541
542 if (!COMCTL32_ChrCmpA(ch, ch2))
543 lpszRet = lpszStr;
544 lpszStr = CharNextA(lpszStr);
545 }
546 }
547 return (LPSTR)lpszRet;
548}
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 794 of file string.c.

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

◆ StrRChrIW()

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

Definition at line 824 of file string.c.

825{
826 WCHAR *ret = NULL;
827
828 if (!str) return NULL;
829 if (!end) end = str + strlenW(str);
830 while (str < end)
831 {
832 if (!COMCTL32_ChrCmpIW(*str, ch)) ret = (WCHAR *)str;
833 str++;
834 }
835 return ret;
836}
static BOOL COMCTL32_ChrCmpIW(WCHAR ch1, WCHAR ch2)
Definition: string.c:118
const WCHAR * str
int ret

◆ StrRChrW()

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

Definition at line 556 of file string.c.

557{
558 WCHAR *ret = NULL;
559
560 if (!str) return NULL;
561 if (!end) end = str + strlenW(str);
562 while (str < end)
563 {
564 if (*str == ch) ret = (WCHAR *)str;
565 str++;
566 }
567 return ret;
568}

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

◆ StrRStrIA()

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

Definition at line 666 of file string.c.

667{
668 LPSTR lpszRet = NULL;
669 WORD ch1, ch2;
670 INT iLen;
671
672 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
673
674 if (!lpszStr || !lpszSearch || !*lpszSearch)
675 return NULL;
676
677 if (IsDBCSLeadByte(*lpszSearch))
678 ch1 = *lpszSearch << 8 | (UCHAR)lpszSearch[1];
679 else
680 ch1 = *lpszSearch;
681 iLen = lstrlenA(lpszSearch);
682
683 if (!lpszEnd)
684 lpszEnd = lpszStr + lstrlenA(lpszStr);
685 else /* reproduce the broken behaviour on Windows */
686 lpszEnd += min(iLen - 1, lstrlenA(lpszEnd));
687
688 while (lpszStr + iLen <= lpszEnd && *lpszStr)
689 {
690 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | (UCHAR)lpszStr[1] : *lpszStr;
691 if (!COMCTL32_ChrCmpIA(ch1, ch2))
692 {
693 if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
694 lpszRet = (LPSTR)lpszStr;
695 }
696 lpszStr = CharNextA(lpszStr);
697 }
698 return lpszRet;
699}
INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:300
#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 706 of file string.c.

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

◆ StrStrA()

LPSTR WINAPI StrStrA ( LPCSTR  lpszStr,
LPCSTR  lpszSearch 
)

Definition at line 582 of file string.c.

583{
584 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
585
586 return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, StrCmpNA);
587}
static LPSTR COMCTL32_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch, INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT))
Definition: string.c:322
INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:493

Referenced by test_StrStrA().

◆ StrStrIA()

LPSTR WINAPI StrStrIA ( LPCSTR  lpszStr,
LPCSTR  lpszSearch 
)

Definition at line 355 of file string.c.

356{
357 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
358
359 return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, StrCmpNIA);
360}

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

◆ StrStrIW()

LPWSTR WINAPI StrStrIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszSearch 
)

Definition at line 384 of file string.c.

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

Referenced by EnumProc(), SearchPatternMatch(), and test_StrStrIW().

◆ StrStrW()

LPWSTR WINAPI StrStrW ( LPCWSTR  lpszStr,
LPCWSTR  lpszSearch 
)

Definition at line 594 of file string.c.

595{
596 if (!lpszStr || !lpszSearch) return NULL;
597 return strstrW( lpszStr, lpszSearch );
598}
#define strstrW(d, s)
Definition: unicode.h:32

Referenced by IsUnnamed(), and test_StrStrW().

◆ StrToIntA()

INT WINAPI StrToIntA ( LPCSTR  lpszStr)

Definition at line 374 of file string.c.

375{
376 return atoi(lpszStr);
377}
_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 411 of file string.c.

412{
413 return atoiW(lpString);
414}
#define atoiW(s)
Definition: unicode.h:54

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

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commctrl  )