comctl32/syslink: Don't use exported StrCmpNIW().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-01-27 16:49:04 +03:00 committed by Alexandre Julliard
parent 5090c22e40
commit a0e73a1fb3
1 changed files with 8 additions and 31 deletions

View File

@ -42,8 +42,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(syslink); WINE_DEFAULT_DEBUG_CHANNEL(syslink);
INT WINAPI StrCmpNIW(LPCWSTR,LPCWSTR,INT);
typedef struct typedef struct
{ {
int nChars; int nChars;
@ -99,11 +97,6 @@ typedef struct
BOOL IgnoreReturn; /* (infoPtr->Style & LWS_IGNORERETURN) on creation */ BOOL IgnoreReturn; /* (infoPtr->Style & LWS_IGNORERETURN) on creation */
} SYSLINK_INFO; } SYSLINK_INFO;
static const WCHAR SL_LINKOPEN[] = { '<','a', 0 };
static const WCHAR SL_HREF[] = { 'h','r','e','f','=','\"',0 };
static const WCHAR SL_ID[] = { 'i','d','=','\"',0 };
static const WCHAR SL_LINKCLOSE[] = { '<','/','a','>',0 };
/* Control configuration constants */ /* Control configuration constants */
#define SL_LEFTMARGIN (0) #define SL_LEFTMARGIN (0)
@ -175,26 +168,6 @@ static VOID SYSLINK_ClearDoc (SYSLINK_INFO *infoPtr)
} }
} }
/***********************************************************************
* SYSLINK_StrCmpNIW
* Wrapper for StrCmpNIW to ensure 'len' is not too big.
*/
static INT SYSLINK_StrCmpNIW (LPCWSTR str, LPCWSTR comp, INT len)
{
INT i;
for(i = 0; i < len; i++)
{
if(!str[i])
{
len = i + 1;
break;
}
}
return StrCmpNIW(str, comp, len);
}
/*********************************************************************** /***********************************************************************
* SYSLINK_ParseText * SYSLINK_ParseText
* Parses the window text string and creates a document. Returns the * Parses the window text string and creates a document. Returns the
@ -202,6 +175,10 @@ static INT SYSLINK_StrCmpNIW (LPCWSTR str, LPCWSTR comp, INT len)
*/ */
static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text) static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
{ {
static const WCHAR SL_LINKOPEN[] = { '<','a' };
static const WCHAR SL_HREF[] = { 'h','r','e','f','=','\"' };
static const WCHAR SL_ID[] = { 'i','d','=','\"' };
static const WCHAR SL_LINKCLOSE[] = { '<','/','a','>' };
LPCWSTR current, textstart = NULL, linktext = NULL, firsttag = NULL; LPCWSTR current, textstart = NULL, linktext = NULL, firsttag = NULL;
int taglen = 0, textlen = 0, linklen = 0, docitems = 0; int taglen = 0, textlen = 0, linklen = 0, docitems = 0;
PDOC_ITEM Last = NULL; PDOC_ITEM Last = NULL;
@ -215,7 +192,7 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
{ {
if(*current == '<') if(*current == '<')
{ {
if(!SYSLINK_StrCmpNIW(current, SL_LINKOPEN, 2) && (CurrentType == slText)) if(!strncmpiW(current, SL_LINKOPEN, sizeof(SL_LINKOPEN)/sizeof(SL_LINKOPEN[0])) && (CurrentType == slText))
{ {
BOOL ValidParam = FALSE, ValidLink = FALSE; BOOL ValidParam = FALSE, ValidLink = FALSE;
@ -243,14 +220,14 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
CheckParameter: CheckParameter:
/* compare the current position with all known parameters */ /* compare the current position with all known parameters */
if(!SYSLINK_StrCmpNIW(tmp, SL_HREF, 6)) if(!strncmpiW(tmp, SL_HREF, sizeof(SL_HREF)/sizeof(SL_HREF[0])))
{ {
taglen += 6; taglen += 6;
ValidParam = TRUE; ValidParam = TRUE;
CurrentParameter = &lpUrl; CurrentParameter = &lpUrl;
CurrentParameterLen = &lenUrl; CurrentParameterLen = &lenUrl;
} }
else if(!SYSLINK_StrCmpNIW(tmp, SL_ID, 4)) else if(!strncmpiW(tmp, SL_ID, sizeof(SL_ID)/sizeof(SL_ID[0])))
{ {
taglen += 4; taglen += 4;
ValidParam = TRUE; ValidParam = TRUE;
@ -324,7 +301,7 @@ CheckParameter:
} }
} }
} }
else if(!SYSLINK_StrCmpNIW(current, SL_LINKCLOSE, 4) && (CurrentType == slLink) && firsttag) else if(!strncmpiW(current, SL_LINKCLOSE, sizeof(SL_LINKCLOSE)/sizeof(SL_LINKCLOSE[0])) && (CurrentType == slLink) && firsttag)
{ {
/* there's a <a...> tag opened, first add the previous text, if present */ /* there's a <a...> tag opened, first add the previous text, if present */
if(textstart != NULL && textlen > 0 && firsttag > textstart) if(textstart != NULL && textlen > 0 && firsttag > textstart)