From a0e73a1fb32a0a20ed5ed97df6e837046c1ce697 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 27 Jan 2017 16:49:04 +0300 Subject: [PATCH] comctl32/syslink: Don't use exported StrCmpNIW(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/comctl32/syslink.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c index 08e5230c55d..339c7282477 100644 --- a/dlls/comctl32/syslink.c +++ b/dlls/comctl32/syslink.c @@ -42,8 +42,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(syslink); -INT WINAPI StrCmpNIW(LPCWSTR,LPCWSTR,INT); - typedef struct { int nChars; @@ -99,11 +97,6 @@ typedef struct BOOL IgnoreReturn; /* (infoPtr->Style & LWS_IGNORERETURN) on creation */ } 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 */ #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 * 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 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; int taglen = 0, textlen = 0, linklen = 0, docitems = 0; PDOC_ITEM Last = NULL; @@ -215,7 +192,7 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text) { 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; @@ -243,14 +220,14 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text) CheckParameter: /* 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; ValidParam = TRUE; CurrentParameter = &lpUrl; 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; 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 tag opened, first add the previous text, if present */ if(textstart != NULL && textlen > 0 && firsttag > textstart)