Commit a0e73a1f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 5090c22e
...@@ -42,8 +42,6 @@ ...@@ -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 ...@@ -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)
...@@ -176,32 +169,16 @@ static VOID SYSLINK_ClearDoc (SYSLINK_INFO *infoPtr) ...@@ -176,32 +169,16 @@ 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
* number of document items created. * number of document items created.
*/ */
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) ...@@ -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) ...@@ -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: ...@@ -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)
......
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