From 89f079bfd1b145b8d7ef06192112c83dbd0d139b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 8 Aug 1999 18:54:47 +0000 Subject: [PATCH] Replaced a few calls to lstr* functions by their CRTDLL or libc equivalent. --- dlls/comctl32/comctl32undoc.c | 9 ++++----- dlls/commdlg/printdlg.c | 4 ++-- dlls/ntdll/rtlstr.c | 3 ++- dlls/shell32/shell32_main.c | 6 +++--- dlls/shell32/shellpath.c | 21 +++++++++++---------- dlls/version/info.c | 3 ++- files/dos_fs.c | 8 ++++---- if1632/thunk.c | 4 ++-- include/wine/winestring.h | 5 ----- loader/libres.c | 4 +++- loader/pe_resource.c | 3 ++- ole/ole2nls.c | 10 ++++------ win32/kernel32.c | 4 ++-- 13 files changed, 41 insertions(+), 43 deletions(-) diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c index 10d2502bdd0..9c88724424a 100644 --- a/dlls/comctl32/comctl32undoc.c +++ b/dlls/comctl32/comctl32undoc.c @@ -22,6 +22,7 @@ #include "winerror.h" #include "objbase.h" #include "commctrl.h" +#include "crtdll.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(commctrl) @@ -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 * 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 LPWSTR WINAPI lstrrchrw(LPCWSTR, LPCWSTR, WORD); -extern LPWSTR WINAPI strstrw(LPCWSTR, LPCWSTR); typedef struct _STREAMDATA @@ -1994,7 +1993,7 @@ LPWSTR WINAPI COMCTL32_StrChrW( LPCWSTR lpStart, WORD wMatch) { * */ 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) { * */ 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) { * */ LPWSTR WINAPI COMCTL32_StrStrW( LPCWSTR lpFirst, LPCWSTR lpSrch) { - return strstrw(lpFirst, lpSrch); + return CRTDLL_wcsstr(lpFirst, lpSrch); } /************************************************************************** diff --git a/dlls/commdlg/printdlg.c b/dlls/commdlg/printdlg.c index 897c24a4e91..d8be52509bc 100644 --- a/dlls/commdlg/printdlg.c +++ b/dlls/commdlg/printdlg.c @@ -298,8 +298,8 @@ static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructur LoadStringA(COMDLG32_hInstance, (1< #endif #include "wine/winestring.h" +#include "crtdll.h" #include "heap.h" #include "winnls.h" #include "debugtools.h" @@ -224,7 +225,7 @@ DWORD WINAPI RtlEqualUnicodeString(PUNICODE_STRING s1,PUNICODE_STRING s2,DWORD x return 0; if (s1->Length != s2->Length) return 1; - return !lstrncmpW(s1->Buffer,s2->Buffer,s1->Length/2); + return !CRTDLL_wcsncmp(s1->Buffer,s2->Buffer,s1->Length/2); } /************************************************************************** diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index ffbcf875267..05b0415d056 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -545,7 +545,7 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT ); SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template ); - if( !lstrncmpA( Template, "WINE", 4 ) ) + if( !strncmp( Template, "WINE", 4 ) ) SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template ); else { char* pch = Template + strlen(Template) - strlen(__appendix_str); @@ -554,8 +554,8 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, (WPARAM)-1, (LPARAM)Template ); } - lstrcpyA( Template, pstr ); - lstrcatA( Template, __appendix_str ); + strcpy( Template, pstr ); + strcat( Template, __appendix_str ); SetWindowTextA( hWndCtl, Template ); SetWindowLongA( hWnd, DWL_MSGRESULT, 1 ); return TRUE; diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 795cf87c6d0..75898d04936 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -10,6 +10,7 @@ #include "winnls.h" #include "winversion.h" #include "winreg.h" +#include "crtdll.h" #include "shlobj.h" #include "shell32_main.h" @@ -130,7 +131,7 @@ LPWSTR WINAPI PathAddBackslashW(LPWSTR path) { int len; TRACE("%p->%s\n",path,debugstr_w(path)); - len = lstrlenW(path); + len = CRTDLL_wcslen(path); if (len && path[len-1]!=(WCHAR)'\\') { path[len] = (WCHAR)'\\'; path[len+1]= 0x00; @@ -170,10 +171,10 @@ LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str) TRACE("%s\n",debugstr_w(str)); while (*x==' ') x++; if (x!=str) - lstrcpyW(str,x); + CRTDLL_wcscpy(str,x); if (!*str) return str; - x=str+lstrlenW(str)-1; + x=str+CRTDLL_wcslen(str)-1; while (*x==' ') x--; if (*x==' ') @@ -319,19 +320,19 @@ LPWSTR WINAPI PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile) if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) - { lstrcpyW(szDest,lpszDir); + { CRTDLL_wcscpy(szDest,lpszDir); return szDest; } /* if lpszFile is a complete path don't care about lpszDir */ if (PathIsRootW(lpszFile)) - { lstrcpyW(szDest,lpszFile); + { CRTDLL_wcscpy(szDest,lpszFile); } else - { lstrcpyW(sTemp,lpszDir); + { CRTDLL_wcscpy(sTemp,lpszDir); PathAddBackslashW(sTemp); - lstrcatW(sTemp,lpszFile); - lstrcpyW(szDest,sTemp); + CRTDLL_wcscat(sTemp,lpszFile); + CRTDLL_wcscpy(szDest,sTemp); } return szDest; } @@ -625,7 +626,7 @@ VOID WINAPI PathUnquoteSpacesA(LPSTR str) return; } VOID WINAPI PathUnquoteSpacesW(LPWSTR str) -{ DWORD len = lstrlenW(str); +{ DWORD len = CRTDLL_wcslen(str); TRACE("%s\n",debugstr_w(str)); @@ -634,7 +635,7 @@ VOID WINAPI PathUnquoteSpacesW(LPWSTR str) if (str[len-1]!='"') return; str[len-1]='\0'; - lstrcpyW(str,str+1); + CRTDLL_wcscpy(str,str+1); return; } VOID WINAPI PathUnquoteSpacesAW(LPVOID str) diff --git a/dlls/version/info.c b/dlls/version/info.c index 094f1a1e43b..4bd9392cd5c 100644 --- a/dlls/version/info.c +++ b/dlls/version/info.c @@ -14,6 +14,7 @@ #include "wine/winestring.h" #include "winerror.h" #include "heap.h" +#include "crtdll.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(ver) @@ -400,7 +401,7 @@ VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( VS_VERSION_INFO_STRUCT32 *inf while ( (DWORD)child < (DWORD)info + info->wLength ) { - if ( !lstrncmpiW( child->szKey, szKey, cbKey ) ) + if ( !CRTDLL__wcsnicmp( child->szKey, szKey, cbKey ) ) return child; child = VersionInfo32_Next( child ); diff --git a/files/dos_fs.c b/files/dos_fs.c index 40170ea0c85..f67d3bf97f0 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -545,7 +545,7 @@ BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf, { if (!ignore_case) { - if (!lstrncmpA( long_name, name, len )) break; + if (!strncmp( long_name, name, len )) break; } else { @@ -1867,15 +1867,15 @@ DWORD WINAPI QueryDosDeviceA(LPCSTR devname,LPSTR target,DWORD bufsize) TRACE_(dosfs)("(%s,...)\n",devname?devname:""); if (!devname) { /* return known MSDOS devices */ - lstrcpyA(buffer,"CON COM1 COM2 LPT1 NUL "); + strcpy(buffer,"CON COM1 COM2 LPT1 NUL "); while ((s=strchr(buffer,' '))) *s='\0'; lstrcpynA(target,buffer,bufsize); return strlen(buffer); } - lstrcpyA(buffer,"\\DEV\\"); - lstrcatA(buffer,devname); + strcpy(buffer,"\\DEV\\"); + strcat(buffer,devname); if ((s=strchr(buffer,':'))) *s='\0'; lstrcpynA(target,buffer,bufsize); return strlen(buffer); diff --git a/if1632/thunk.c b/if1632/thunk.c index 76a61e653b6..46fe8eff90a 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -945,14 +945,14 @@ UINT WINAPI ThunkConnect16( ) { BOOL directionSL; - if (!lstrncmpA(TD->magic, "SL01", 4)) + if (!strncmp(TD->magic, "SL01", 4)) { directionSL = TRUE; TRACE_(thunk)("SL01 thunk %s (%lx) -> %s (%s), Reason: %ld\n", module16, (DWORD)TD, module32, thunkfun32, dwReason); } - else if (!lstrncmpA(TD->magic, "LS01", 4)) + else if (!strncmp(TD->magic, "LS01", 4)) { directionSL = FALSE; diff --git a/include/wine/winestring.h b/include/wine/winestring.h index bf121ce85bf..7a1ffe487e8 100644 --- a/include/wine/winestring.h +++ b/include/wine/winestring.h @@ -7,12 +7,7 @@ INT16 WINAPI WideCharToLocal16(LPSTR,LPWSTR,INT16); INT WINAPI WideCharToLocal(LPSTR,LPWSTR,INT); INT16 WINAPI LocalToWideChar16(LPWSTR,LPSTR,INT16); 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 lstrncmpiW(LPCWSTR,LPCWSTR,INT); -#define lstrncmpi WINELIB_NAME_AW(lstrncmpi) LPWSTR WINAPI lstrcpyAtoW(LPWSTR,LPCSTR); LPSTR WINAPI lstrcpyWtoA(LPSTR,LPCWSTR); LPWSTR WINAPI lstrcpynAtoW(LPWSTR,LPCSTR,INT); diff --git a/loader/libres.c b/loader/libres.c index a1727c45bc2..68db7dcade7 100644 --- a/loader/libres.c +++ b/loader/libres.c @@ -10,6 +10,7 @@ #include "resource.h" #include "debugtools.h" #include "heap.h" +#include "crtdll.h" #include "xmalloc.h" DEFAULT_DEBUG_CHANNEL(resource) @@ -79,7 +80,8 @@ HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCWSTR name, LPCWSTR type ) for(Res=ResBlock->Resources; *Res; Res++) 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; } else diff --git a/loader/pe_resource.c b/loader/pe_resource.c index ed80a7d383e..9c752d37770 100644 --- a/loader/pe_resource.c +++ b/loader/pe_resource.c @@ -22,6 +22,7 @@ #include "libres.h" #include "stackframe.h" #include "neexe.h" +#include "crtdll.h" #include "debugtools.h" /********************************************************************** @@ -71,7 +72,7 @@ PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr, entryTable[entrynum].u1.s.NameOffset); if(namelen != str->Length) continue; - if(lstrncmpiW(name,str->NameString,str->Length)==0) + if(CRTDLL__wcsnicmp(name,str->NameString,str->Length)==0) return (PIMAGE_RESOURCE_DIRECTORY) ( root + entryTable[entrynum].u2.s.OffsetToDirectory); diff --git a/ole/ole2nls.c b/ole/ole2nls.c index 57ed2cc2834..7a6538b5095 100644 --- a/ole/ole2nls.c +++ b/ole/ole2nls.c @@ -15,6 +15,7 @@ #include "winreg.h" #include "winerror.h" #include "debugtools.h" +#include "crtdll.h" #include "main.h" DECLARE_DEBUG_CHANNEL(file) @@ -2401,7 +2402,7 @@ UINT WINAPI CompareStringW(DWORD lcid, DWORD fdwStyle, l2 = (l2==-1)?lstrlenW(s2):l2; len = l1magic, "SL01", 4)) + if (!strncmp(TD->magic, "SL01", 4)) { directionSL = TRUE; TRACE_(thunk)("SL01 thunk %s (%lx) <- %s (%s), Reason: %ld\n", module32, (DWORD)TD, module16, thunkfun16, dwReason); } - else if (!lstrncmpA(TD->magic, "LS01", 4)) + else if (!strncmp(TD->magic, "LS01", 4)) { directionSL = FALSE;