Commit 89f079bf authored by Alexandre Julliard's avatar Alexandre Julliard

Replaced a few calls to lstr* functions by their CRTDLL or libc

equivalent.
parent 7147e4cf
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "winerror.h" #include "winerror.h"
#include "objbase.h" #include "objbase.h"
#include "commctrl.h" #include "commctrl.h"
#include "crtdll.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(commctrl) DEFAULT_DEBUG_CHANNEL(commctrl)
...@@ -33,10 +34,8 @@ extern HANDLE COMCTL32_hHeap; /* handle to the private heap */ ...@@ -33,10 +34,8 @@ extern HANDLE COMCTL32_hHeap; /* handle to the private heap */
* We put some function prototypes here that don't seem to belong in * We put some function prototypes here that don't seem to belong in
* any header file. When they find their place, we can remove them. * any header file. When they find their place, we can remove them.
*/ */
extern LPWSTR __cdecl CRTDLL_wcschr(LPCWSTR, WCHAR);
extern LPSTR WINAPI lstrrchr(LPCSTR, LPCSTR, WORD); extern LPSTR WINAPI lstrrchr(LPCSTR, LPCSTR, WORD);
extern LPWSTR WINAPI lstrrchrw(LPCWSTR, LPCWSTR, WORD); extern LPWSTR WINAPI lstrrchrw(LPCWSTR, LPCWSTR, WORD);
extern LPWSTR WINAPI strstrw(LPCWSTR, LPCWSTR);
typedef struct _STREAMDATA typedef struct _STREAMDATA
...@@ -1994,7 +1993,7 @@ LPWSTR WINAPI COMCTL32_StrChrW( LPCWSTR lpStart, WORD wMatch) { ...@@ -1994,7 +1993,7 @@ LPWSTR WINAPI COMCTL32_StrChrW( LPCWSTR lpStart, WORD wMatch) {
* *
*/ */
INT WINAPI COMCTL32_StrCmpNA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) { INT WINAPI COMCTL32_StrCmpNA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) {
return lstrncmpA(lpStr1, lpStr2, nChar); return strncmp(lpStr1, lpStr2, nChar);
} }
/************************************************************************** /**************************************************************************
...@@ -2002,7 +2001,7 @@ INT WINAPI COMCTL32_StrCmpNA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) { ...@@ -2002,7 +2001,7 @@ INT WINAPI COMCTL32_StrCmpNA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) {
* *
*/ */
INT WINAPI COMCTL32_StrCmpNW( LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar) { INT WINAPI COMCTL32_StrCmpNW( LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar) {
return lstrncmpW(lpStr1, lpStr2, nChar); return CRTDLL_wcsncmp(lpStr1, lpStr2, nChar);
} }
/************************************************************************** /**************************************************************************
...@@ -2034,7 +2033,7 @@ LPSTR WINAPI COMCTL32_StrStrA( LPCSTR lpFirst, LPCSTR lpSrch) { ...@@ -2034,7 +2033,7 @@ LPSTR WINAPI COMCTL32_StrStrA( LPCSTR lpFirst, LPCSTR lpSrch) {
* *
*/ */
LPWSTR WINAPI COMCTL32_StrStrW( LPCWSTR lpFirst, LPCWSTR lpSrch) { LPWSTR WINAPI COMCTL32_StrStrW( LPCWSTR lpFirst, LPCWSTR lpSrch) {
return strstrw(lpFirst, lpSrch); return CRTDLL_wcsstr(lpFirst, lpSrch);
} }
/************************************************************************** /**************************************************************************
......
...@@ -298,8 +298,8 @@ static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructur ...@@ -298,8 +298,8 @@ static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructur
LoadStringA(COMDLG32_hInstance, (1<<i), LoadStringA(COMDLG32_hInstance, (1<<i),
ResourceString, 255); ResourceString, 255);
if (StatusMsg[0]!='\0') /* append ; before next item */ if (StatusMsg[0]!='\0') /* append ; before next item */
lstrcatA(StatusMsg, "; "); strcat(StatusMsg, "; ");
lstrcatA(StatusMsg,ResourceString); strcat(StatusMsg,ResourceString);
} }
} }
if (StatusMsg[0]=='\0') /* no Status ??? */ if (StatusMsg[0]=='\0') /* no Status ??? */
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# include <wctype.h> # include <wctype.h>
#endif #endif
#include "wine/winestring.h" #include "wine/winestring.h"
#include "crtdll.h"
#include "heap.h" #include "heap.h"
#include "winnls.h" #include "winnls.h"
#include "debugtools.h" #include "debugtools.h"
...@@ -224,7 +225,7 @@ DWORD WINAPI RtlEqualUnicodeString(PUNICODE_STRING s1,PUNICODE_STRING s2,DWORD x ...@@ -224,7 +225,7 @@ DWORD WINAPI RtlEqualUnicodeString(PUNICODE_STRING s1,PUNICODE_STRING s2,DWORD x
return 0; return 0;
if (s1->Length != s2->Length) if (s1->Length != s2->Length)
return 1; return 1;
return !lstrncmpW(s1->Buffer,s2->Buffer,s1->Length/2); return !CRTDLL_wcsncmp(s1->Buffer,s2->Buffer,s1->Length/2);
} }
/************************************************************************** /**************************************************************************
......
...@@ -545,7 +545,7 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, ...@@ -545,7 +545,7 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT ); hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template ); SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
if( !lstrncmpA( Template, "WINE", 4 ) ) if( !strncmp( Template, "WINE", 4 ) )
SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template ); SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
else else
{ char* pch = Template + strlen(Template) - strlen(__appendix_str); { char* pch = Template + strlen(Template) - strlen(__appendix_str);
...@@ -554,8 +554,8 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, ...@@ -554,8 +554,8 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
(WPARAM)-1, (LPARAM)Template ); (WPARAM)-1, (LPARAM)Template );
} }
lstrcpyA( Template, pstr ); strcpy( Template, pstr );
lstrcatA( Template, __appendix_str ); strcat( Template, __appendix_str );
SetWindowTextA( hWndCtl, Template ); SetWindowTextA( hWndCtl, Template );
SetWindowLongA( hWnd, DWL_MSGRESULT, 1 ); SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
return TRUE; return TRUE;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "winnls.h" #include "winnls.h"
#include "winversion.h" #include "winversion.h"
#include "winreg.h" #include "winreg.h"
#include "crtdll.h"
#include "shlobj.h" #include "shlobj.h"
#include "shell32_main.h" #include "shell32_main.h"
...@@ -130,7 +131,7 @@ LPWSTR WINAPI PathAddBackslashW(LPWSTR path) ...@@ -130,7 +131,7 @@ LPWSTR WINAPI PathAddBackslashW(LPWSTR path)
{ int len; { int len;
TRACE("%p->%s\n",path,debugstr_w(path)); TRACE("%p->%s\n",path,debugstr_w(path));
len = lstrlenW(path); len = CRTDLL_wcslen(path);
if (len && path[len-1]!=(WCHAR)'\\') if (len && path[len-1]!=(WCHAR)'\\')
{ path[len] = (WCHAR)'\\'; { path[len] = (WCHAR)'\\';
path[len+1]= 0x00; path[len+1]= 0x00;
...@@ -170,10 +171,10 @@ LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str) ...@@ -170,10 +171,10 @@ LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str)
TRACE("%s\n",debugstr_w(str)); TRACE("%s\n",debugstr_w(str));
while (*x==' ') x++; while (*x==' ') x++;
if (x!=str) if (x!=str)
lstrcpyW(str,x); CRTDLL_wcscpy(str,x);
if (!*str) if (!*str)
return str; return str;
x=str+lstrlenW(str)-1; x=str+CRTDLL_wcslen(str)-1;
while (*x==' ') while (*x==' ')
x--; x--;
if (*x==' ') if (*x==' ')
...@@ -319,19 +320,19 @@ LPWSTR WINAPI PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile) ...@@ -319,19 +320,19 @@ LPWSTR WINAPI PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) )
{ lstrcpyW(szDest,lpszDir); { CRTDLL_wcscpy(szDest,lpszDir);
return szDest; return szDest;
} }
/* if lpszFile is a complete path don't care about lpszDir */ /* if lpszFile is a complete path don't care about lpszDir */
if (PathIsRootW(lpszFile)) if (PathIsRootW(lpszFile))
{ lstrcpyW(szDest,lpszFile); { CRTDLL_wcscpy(szDest,lpszFile);
} }
else else
{ lstrcpyW(sTemp,lpszDir); { CRTDLL_wcscpy(sTemp,lpszDir);
PathAddBackslashW(sTemp); PathAddBackslashW(sTemp);
lstrcatW(sTemp,lpszFile); CRTDLL_wcscat(sTemp,lpszFile);
lstrcpyW(szDest,sTemp); CRTDLL_wcscpy(szDest,sTemp);
} }
return szDest; return szDest;
} }
...@@ -625,7 +626,7 @@ VOID WINAPI PathUnquoteSpacesA(LPSTR str) ...@@ -625,7 +626,7 @@ VOID WINAPI PathUnquoteSpacesA(LPSTR str)
return; return;
} }
VOID WINAPI PathUnquoteSpacesW(LPWSTR str) VOID WINAPI PathUnquoteSpacesW(LPWSTR str)
{ DWORD len = lstrlenW(str); { DWORD len = CRTDLL_wcslen(str);
TRACE("%s\n",debugstr_w(str)); TRACE("%s\n",debugstr_w(str));
...@@ -634,7 +635,7 @@ VOID WINAPI PathUnquoteSpacesW(LPWSTR str) ...@@ -634,7 +635,7 @@ VOID WINAPI PathUnquoteSpacesW(LPWSTR str)
if (str[len-1]!='"') if (str[len-1]!='"')
return; return;
str[len-1]='\0'; str[len-1]='\0';
lstrcpyW(str,str+1); CRTDLL_wcscpy(str,str+1);
return; return;
} }
VOID WINAPI PathUnquoteSpacesAW(LPVOID str) VOID WINAPI PathUnquoteSpacesAW(LPVOID str)
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "wine/winestring.h" #include "wine/winestring.h"
#include "winerror.h" #include "winerror.h"
#include "heap.h" #include "heap.h"
#include "crtdll.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(ver) DEFAULT_DEBUG_CHANNEL(ver)
...@@ -400,7 +401,7 @@ VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( VS_VERSION_INFO_STRUCT32 *inf ...@@ -400,7 +401,7 @@ VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( VS_VERSION_INFO_STRUCT32 *inf
while ( (DWORD)child < (DWORD)info + info->wLength ) while ( (DWORD)child < (DWORD)info + info->wLength )
{ {
if ( !lstrncmpiW( child->szKey, szKey, cbKey ) ) if ( !CRTDLL__wcsnicmp( child->szKey, szKey, cbKey ) )
return child; return child;
child = VersionInfo32_Next( child ); child = VersionInfo32_Next( child );
......
...@@ -545,7 +545,7 @@ BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf, ...@@ -545,7 +545,7 @@ BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
{ {
if (!ignore_case) if (!ignore_case)
{ {
if (!lstrncmpA( long_name, name, len )) break; if (!strncmp( long_name, name, len )) break;
} }
else else
{ {
...@@ -1867,15 +1867,15 @@ DWORD WINAPI QueryDosDeviceA(LPCSTR devname,LPSTR target,DWORD bufsize) ...@@ -1867,15 +1867,15 @@ DWORD WINAPI QueryDosDeviceA(LPCSTR devname,LPSTR target,DWORD bufsize)
TRACE_(dosfs)("(%s,...)\n",devname?devname:"<null>"); TRACE_(dosfs)("(%s,...)\n",devname?devname:"<null>");
if (!devname) { if (!devname) {
/* return known MSDOS devices */ /* return known MSDOS devices */
lstrcpyA(buffer,"CON COM1 COM2 LPT1 NUL "); strcpy(buffer,"CON COM1 COM2 LPT1 NUL ");
while ((s=strchr(buffer,' '))) while ((s=strchr(buffer,' ')))
*s='\0'; *s='\0';
lstrcpynA(target,buffer,bufsize); lstrcpynA(target,buffer,bufsize);
return strlen(buffer); return strlen(buffer);
} }
lstrcpyA(buffer,"\\DEV\\"); strcpy(buffer,"\\DEV\\");
lstrcatA(buffer,devname); strcat(buffer,devname);
if ((s=strchr(buffer,':'))) *s='\0'; if ((s=strchr(buffer,':'))) *s='\0';
lstrcpynA(target,buffer,bufsize); lstrcpynA(target,buffer,bufsize);
return strlen(buffer); return strlen(buffer);
......
...@@ -945,14 +945,14 @@ UINT WINAPI ThunkConnect16( ...@@ -945,14 +945,14 @@ UINT WINAPI ThunkConnect16(
) { ) {
BOOL directionSL; BOOL directionSL;
if (!lstrncmpA(TD->magic, "SL01", 4)) if (!strncmp(TD->magic, "SL01", 4))
{ {
directionSL = TRUE; directionSL = TRUE;
TRACE_(thunk)("SL01 thunk %s (%lx) -> %s (%s), Reason: %ld\n", TRACE_(thunk)("SL01 thunk %s (%lx) -> %s (%s), Reason: %ld\n",
module16, (DWORD)TD, module32, thunkfun32, dwReason); module16, (DWORD)TD, module32, thunkfun32, dwReason);
} }
else if (!lstrncmpA(TD->magic, "LS01", 4)) else if (!strncmp(TD->magic, "LS01", 4))
{ {
directionSL = FALSE; directionSL = FALSE;
......
...@@ -7,12 +7,7 @@ INT16 WINAPI WideCharToLocal16(LPSTR,LPWSTR,INT16); ...@@ -7,12 +7,7 @@ INT16 WINAPI WideCharToLocal16(LPSTR,LPWSTR,INT16);
INT WINAPI WideCharToLocal(LPSTR,LPWSTR,INT); INT WINAPI WideCharToLocal(LPSTR,LPWSTR,INT);
INT16 WINAPI LocalToWideChar16(LPWSTR,LPSTR,INT16); INT16 WINAPI LocalToWideChar16(LPWSTR,LPSTR,INT16);
INT WINAPI LocalToWideChar(LPWSTR,LPSTR,INT); INT WINAPI LocalToWideChar(LPWSTR,LPSTR,INT);
INT WINAPI lstrncmpA(LPCSTR,LPCSTR,INT);
INT WINAPI lstrncmpW(LPCWSTR,LPCWSTR,INT);
#define lstrncmp WINELIB_NAME_AW(lstrncmp)
INT WINAPI lstrncmpiA(LPCSTR,LPCSTR,INT); INT WINAPI lstrncmpiA(LPCSTR,LPCSTR,INT);
INT WINAPI lstrncmpiW(LPCWSTR,LPCWSTR,INT);
#define lstrncmpi WINELIB_NAME_AW(lstrncmpi)
LPWSTR WINAPI lstrcpyAtoW(LPWSTR,LPCSTR); LPWSTR WINAPI lstrcpyAtoW(LPWSTR,LPCSTR);
LPSTR WINAPI lstrcpyWtoA(LPSTR,LPCWSTR); LPSTR WINAPI lstrcpyWtoA(LPSTR,LPCWSTR);
LPWSTR WINAPI lstrcpynAtoW(LPWSTR,LPCSTR,INT); LPWSTR WINAPI lstrcpynAtoW(LPWSTR,LPCSTR,INT);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "resource.h" #include "resource.h"
#include "debugtools.h" #include "debugtools.h"
#include "heap.h" #include "heap.h"
#include "crtdll.h"
#include "xmalloc.h" #include "xmalloc.h"
DEFAULT_DEBUG_CHANNEL(resource) DEFAULT_DEBUG_CHANNEL(resource)
...@@ -79,7 +80,8 @@ HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCWSTR name, LPCWSTR type ) ...@@ -79,7 +80,8 @@ HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
for(Res=ResBlock->Resources; *Res; Res++) for(Res=ResBlock->Resources; *Res; Res++)
if(name) if(name)
{ {
if((*Res)->restype==typeid && !lstrncmpiW((LPCWSTR)((*Res)->resname+1), name, *((*Res)->resname))) if((*Res)->restype==typeid &&
!CRTDLL__wcsnicmp((LPCWSTR)((*Res)->resname+1), name, *((*Res)->resname)))
return (HRSRC)*Res; return (HRSRC)*Res;
} }
else else
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "libres.h" #include "libres.h"
#include "stackframe.h" #include "stackframe.h"
#include "neexe.h" #include "neexe.h"
#include "crtdll.h"
#include "debugtools.h" #include "debugtools.h"
/********************************************************************** /**********************************************************************
...@@ -71,7 +72,7 @@ PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr, ...@@ -71,7 +72,7 @@ PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr,
entryTable[entrynum].u1.s.NameOffset); entryTable[entrynum].u1.s.NameOffset);
if(namelen != str->Length) if(namelen != str->Length)
continue; continue;
if(lstrncmpiW(name,str->NameString,str->Length)==0) if(CRTDLL__wcsnicmp(name,str->NameString,str->Length)==0)
return (PIMAGE_RESOURCE_DIRECTORY) ( return (PIMAGE_RESOURCE_DIRECTORY) (
root + root +
entryTable[entrynum].u2.s.OffsetToDirectory); entryTable[entrynum].u2.s.OffsetToDirectory);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "winreg.h" #include "winreg.h"
#include "winerror.h" #include "winerror.h"
#include "debugtools.h" #include "debugtools.h"
#include "crtdll.h"
#include "main.h" #include "main.h"
DECLARE_DEBUG_CHANNEL(file) DECLARE_DEBUG_CHANNEL(file)
...@@ -2401,7 +2402,7 @@ UINT WINAPI CompareStringW(DWORD lcid, DWORD fdwStyle, ...@@ -2401,7 +2402,7 @@ UINT WINAPI CompareStringW(DWORD lcid, DWORD fdwStyle,
l2 = (l2==-1)?lstrlenW(s2):l2; l2 = (l2==-1)?lstrlenW(s2):l2;
len = l1<l2 ? l1:l2; len = l1<l2 ? l1:l2;
ret = (fdwStyle & NORM_IGNORECASE) ? ret = (fdwStyle & NORM_IGNORECASE) ?
lstrncmpiW(s1,s2,len) : lstrncmpW(s1,s2,len); CRTDLL__wcsnicmp(s1,s2,len) : CRTDLL_wcsncmp(s1,s2,len);
/* not equal, return 1 or 3 */ /* not equal, return 1 or 3 */
if(ret!=0) return ret+2; if(ret!=0) return ret+2;
/* same len, return 2 */ /* same len, return 2 */
...@@ -2801,13 +2802,10 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags, ...@@ -2801,13 +2802,10 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
/* cat buf onto the output */ /* cat buf onto the output */
outlen = lstrlenW(buf); outlen = lstrlenW(buf);
if (outpos + buflen < outlen) { if (outpos + buflen < outlen) {
output[outpos] = 0; /* a "hook" for strcat */ lstrcpyW( output + outpos, buf );
lstrcatW(output, buf);
outpos += buflen; outpos += buflen;
} else { } else {
output[outpos] = 0; lstrcpynW( output + outpos, buf, outlen - outpos );
lstrcatnW(output, buf, outlen - outpos);
output[outlen - 1] = 0;
Overflow = 1; Overflow = 1;
break; /* Abnormal exit */ break; /* Abnormal exit */
} }
......
...@@ -207,14 +207,14 @@ UINT WINAPI ThunkConnect32( ...@@ -207,14 +207,14 @@ UINT WINAPI ThunkConnect32(
) { ) {
BOOL directionSL; BOOL directionSL;
if (!lstrncmpA(TD->magic, "SL01", 4)) if (!strncmp(TD->magic, "SL01", 4))
{ {
directionSL = TRUE; directionSL = TRUE;
TRACE_(thunk)("SL01 thunk %s (%lx) <- %s (%s), Reason: %ld\n", TRACE_(thunk)("SL01 thunk %s (%lx) <- %s (%s), Reason: %ld\n",
module32, (DWORD)TD, module16, thunkfun16, dwReason); module32, (DWORD)TD, module16, thunkfun16, dwReason);
} }
else if (!lstrncmpA(TD->magic, "LS01", 4)) else if (!strncmp(TD->magic, "LS01", 4))
{ {
directionSL = FALSE; directionSL = FALSE;
......
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