Use the Unicode string functions from wine/unicode.h instead of the

crtdll ones.
This commit is contained in:
Alexandre Julliard 2000-06-13 01:10:29 +00:00
parent 0d4a55804e
commit 5ea22474bb
11 changed files with 49 additions and 52 deletions

View file

@ -20,12 +20,12 @@
#include "winbase.h" #include "winbase.h"
#include "winerror.h" #include "winerror.h"
#include "wine/unicode.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);
extern HANDLE COMCTL32_hHeap; /* handle to the private heap */ extern HANDLE COMCTL32_hHeap; /* handle to the private heap */
@ -2128,7 +2128,7 @@ INT WINAPI COMCTL32_StrCSpnA( LPCSTR lpStr, LPCSTR lpSet) {
* *
*/ */
LPWSTR WINAPI COMCTL32_StrChrW( LPCWSTR lpStart, WORD wMatch) { LPWSTR WINAPI COMCTL32_StrChrW( LPCWSTR lpStart, WORD wMatch) {
return CRTDLL_wcschr(lpStart, wMatch); return strchrW(lpStart, wMatch);
} }
/************************************************************************** /**************************************************************************
@ -2152,7 +2152,7 @@ INT WINAPI COMCTL32_StrCmpNIA( 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 CRTDLL_wcsncmp(lpStr1, lpStr2, nChar); return strncmpW(lpStr1, lpStr2, nChar);
} }
/************************************************************************** /**************************************************************************
@ -2193,7 +2193,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 CRTDLL_wcsstr(lpFirst, lpSrch); return strstrW(lpFirst, lpSrch);
} }
/************************************************************************** /**************************************************************************
@ -2209,7 +2209,7 @@ INT WINAPI COMCTL32_StrSpnW( LPWSTR lpStr, LPWSTR lpSet) {
/* while(*lpLoop) { if lpLoop++; } */ /* while(*lpLoop) { if lpLoop++; } */
for(; (*lpLoop != 0); lpLoop++) for(; (*lpLoop != 0); lpLoop++)
if( CRTDLL_wcschr(lpSet, *(WORD*)lpLoop)) if( strchrW(lpSet, *(WORD*)lpLoop))
return (INT)(lpLoop-lpStr); return (INT)(lpLoop-lpStr);
return (INT)(lpLoop-lpStr); return (INT)(lpLoop-lpStr);

View file

@ -11,10 +11,10 @@
#include "debugtools.h" #include "debugtools.h"
#include "winreg.h" #include "winreg.h"
#include "winerror.h" #include "winerror.h"
#include "wine/unicode.h"
#include "file.h" #include "file.h"
#include "server.h" #include "server.h"
#include "ntddk.h" #include "ntddk.h"
#include "crtdll.h"
#include "ntdll_misc.h" #include "ntdll_misc.h"
DEFAULT_DEBUG_CHANNEL(ntdll); DEFAULT_DEBUG_CHANNEL(ntdll);
@ -64,19 +64,19 @@ static BOOLEAN _NtKeyToWinKey(
*KeyHandle = ObjectAttributes->RootDirectory; *KeyHandle = ObjectAttributes->RootDirectory;
} }
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKLM))) else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKLM)))
&& (0==CRTDLL__wcsnicmp(ObjectName->Buffer,KeyPath_HKLM,len))) && (0==strncmpiW(ObjectName->Buffer,KeyPath_HKLM,len)))
{ *KeyHandle = HKEY_LOCAL_MACHINE; { *KeyHandle = HKEY_LOCAL_MACHINE;
} }
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKU))) else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKU)))
&& (0==CRTDLL__wcsnicmp(ObjectName->Buffer,KeyPath_HKU,len))) && (0==strncmpiW(ObjectName->Buffer,KeyPath_HKU,len)))
{ *KeyHandle = HKEY_USERS; { *KeyHandle = HKEY_USERS;
} }
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCR))) else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCR)))
&& (0==CRTDLL__wcsnicmp(ObjectName->Buffer,KeyPath_HCR,len))) && (0==strncmpiW(ObjectName->Buffer,KeyPath_HCR,len)))
{ *KeyHandle = HKEY_CLASSES_ROOT; { *KeyHandle = HKEY_CLASSES_ROOT;
} }
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCC))) else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCC)))
&& (0==CRTDLL__wcsnicmp(ObjectName->Buffer,KeyPath_HCC,len))) && (0==strncmpiW(ObjectName->Buffer,KeyPath_HCC,len)))
{ *KeyHandle = HKEY_CURRENT_CONFIG; { *KeyHandle = HKEY_CURRENT_CONFIG;
} }
else else

View file

@ -38,6 +38,7 @@
#include "crtdll.h" #include "crtdll.h"
#include "wine/obj_oleview.h" #include "wine/obj_oleview.h"
#include "wine/obj_cache.h" #include "wine/obj_cache.h"
#include "wine/unicode.h"
#include "ole2.h" #include "ole2.h"
#include "debugtools.h" #include "debugtools.h"
@ -680,8 +681,8 @@ static BOOL DataCache_IsPresentationStream(const STATSTG *elem)
return (elem->type == STGTY_STREAM) return (elem->type == STGTY_STREAM)
&& (elem->cbSize.s.LowPart >= sizeof(PresentationDataHeader)) && (elem->cbSize.s.LowPart >= sizeof(PresentationDataHeader))
&& (CRTDLL_wcslen(name) == 11) && (strlenW(name) == 11)
&& (CRTDLL_wcsncmp(name, OlePres, 8) == 0) && (strncmpW(name, OlePres, 8) == 0)
&& CRTDLL_iswdigit(name[8]) && CRTDLL_iswdigit(name[8])
&& CRTDLL_iswdigit(name[9]) && CRTDLL_iswdigit(name[9])
&& CRTDLL_iswdigit(name[10]); && CRTDLL_iswdigit(name[10]);

View file

@ -20,7 +20,6 @@
#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"
DEFAULT_DEBUG_CHANNEL(ole); DEFAULT_DEBUG_CHANNEL(ole);

View file

@ -13,7 +13,6 @@
#include "winnls.h" #include "winnls.h"
#include "winversion.h" #include "winversion.h"
#include "heap.h" #include "heap.h"
#include "crtdll.h"
#include "shellapi.h" #include "shellapi.h"
#include "shlobj.h" #include "shlobj.h"

View file

@ -10,16 +10,16 @@
#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"
#include "windef.h" #include "windef.h"
#include "options.h" #include "options.h"
#include "wine/undocshell.h" #include "wine/undocshell.h"
#include "wine/unicode.h"
#include "shlwapi.h" #include "shlwapi.h"
DEFAULT_DEBUG_CHANNEL(shell) DEFAULT_DEBUG_CHANNEL(shell);
/* /*
Combining and Constructing paths Combining and Constructing paths
@ -128,28 +128,28 @@ LPWSTR WINAPI PathCombineW(
if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) )
{ {
CRTDLL_wcscpy(szDest,lpszDir); strcpyW(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 (PathGetDriveNumberW(lpszFile) != -1) if (PathGetDriveNumberW(lpszFile) != -1)
{ {
CRTDLL_wcscpy(szDest,lpszFile); strcpyW(szDest,lpszFile);
} }
else if (lpszFile[0] == (WCHAR)'\\' ) else if (lpszFile[0] == (WCHAR)'\\' )
{ {
CRTDLL_wcscpy(sTemp,lpszDir); strcpyW(sTemp,lpszDir);
PathStripToRootW(sTemp); PathStripToRootW(sTemp);
CRTDLL_wcscat(sTemp,lpszFile); strcatW(sTemp,lpszFile);
CRTDLL_wcscpy(szDest,sTemp); strcpyW(szDest,sTemp);
} }
else else
{ {
CRTDLL_wcscpy(sTemp,lpszDir); strcpyW(sTemp,lpszDir);
PathAddBackslashW(sTemp); PathAddBackslashW(sTemp);
CRTDLL_wcscat(sTemp,lpszFile); strcatW(sTemp,lpszFile);
CRTDLL_wcscpy(szDest,sTemp); strcpyW(szDest,sTemp);
} }
return szDest; return szDest;
} }
@ -196,7 +196,7 @@ LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
int len; int len;
TRACE("%p->%s\n",lpszPath,debugstr_w(lpszPath)); TRACE("%p->%s\n",lpszPath,debugstr_w(lpszPath));
len = CRTDLL_wcslen(lpszPath); len = strlenW(lpszPath);
if (len && lpszPath[len-1]!=(WCHAR)'\\') if (len && lpszPath[len-1]!=(WCHAR)'\\')
{ {
lpszPath[len] = (WCHAR)'\\'; lpszPath[len] = (WCHAR)'\\';
@ -468,12 +468,12 @@ int WINAPI PathGetDriveNumberA(LPCSTR lpszPath)
*/ */
int WINAPI PathGetDriveNumberW(LPCWSTR lpszPath) int WINAPI PathGetDriveNumberW(LPCWSTR lpszPath)
{ {
int chr = CRTDLL_towlower(lpszPath[0]); int chr = tolowerW(lpszPath[0]);
TRACE ("%s\n",debugstr_w(lpszPath)); TRACE ("%s\n",debugstr_w(lpszPath));
if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1;
return tolower(lpszPath[0]) - 'a' ; return tolowerW(lpszPath[0]) - 'a' ;
} }
/************************************************************************* /*************************************************************************
@ -854,10 +854,10 @@ LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str)
while (*x==' ') x++; while (*x==' ') x++;
if (x!=str) if (x!=str)
CRTDLL_wcscpy(str,x); strcpyW(str,x);
if (!*str) if (!*str)
return str; return str;
x=str+CRTDLL_wcslen(str)-1; x=str+strlenW(str)-1;
while (*x==' ') while (*x==' ')
x--; x--;
if (*x==' ') if (*x==' ')
@ -931,7 +931,7 @@ VOID WINAPI PathUnquoteSpacesA(LPSTR str)
*/ */
VOID WINAPI PathUnquoteSpacesW(LPWSTR str) VOID WINAPI PathUnquoteSpacesW(LPWSTR str)
{ {
DWORD len = CRTDLL_wcslen(str); DWORD len = strlenW(str);
TRACE("%s\n",debugstr_w(str)); TRACE("%s\n",debugstr_w(str));
@ -940,7 +940,7 @@ VOID WINAPI PathUnquoteSpacesW(LPWSTR str)
if (str[len-1]!='"') if (str[len-1]!='"')
return; return;
str[len-1]='\0'; str[len-1]='\0';
CRTDLL_wcscpy(str,str+1); strcpyW(str,str+1);
return; return;
} }
@ -977,7 +977,7 @@ int WINAPI PathParseIconLocationA(LPSTR lpszPath)
*/ */
int WINAPI PathParseIconLocationW(LPWSTR lpszPath) int WINAPI PathParseIconLocationW(LPWSTR lpszPath)
{ {
LPWSTR lpstrComma = CRTDLL_wcschr(lpszPath, ','); LPWSTR lpstrComma = strchrW(lpszPath, ',');
FIXME("%s stub\n", debugstr_w(lpszPath)); FIXME("%s stub\n", debugstr_w(lpszPath));
@ -1170,7 +1170,7 @@ BOOL WINAPI PathIsExeW (LPCWSTR lpszPath)
TRACE("path=%s\n",debugstr_w(lpszPath)); TRACE("path=%s\n",debugstr_w(lpszPath));
for(i=0; lpszExtensions[i]; i++) for(i=0; lpszExtensions[i]; i++)
if (!CRTDLL__wcsicmp(lpszExtension,lpszExtensions[i])) return TRUE; if (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE;
return FALSE; return FALSE;
} }
@ -1313,7 +1313,7 @@ static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask)
} while (*name++); } while (*name++);
return 0; return 0;
} }
if (CRTDLL_towupper(*mask)!=CRTDLL_towupper(*name) && *mask!='?') return 0; if (toupperW(*mask)!=toupperW(*name) && *mask!='?') return 0;
name++; name++;
mask++; mask++;
} }
@ -1428,7 +1428,7 @@ BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2)
if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE; if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE;
/* usual path */ /* usual path */
if ( CRTDLL_towupper(lpszPath1[0])==CRTDLL_towupper(lpszPath2[0]) && if ( toupperW(lpszPath1[0])==toupperW(lpszPath2[0]) &&
lpszPath1[1]==':' && lpszPath2[1]==':' && lpszPath1[1]==':' && lpszPath2[1]==':' &&
lpszPath1[2]=='\\' && lpszPath2[2]=='\\') lpszPath1[2]=='\\' && lpszPath2[2]=='\\')
return TRUE; return TRUE;
@ -1503,14 +1503,14 @@ BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
if(!lpstrPath) return FALSE; if(!lpstrPath) return FALSE;
/* get protocol */ /* get protocol */
lpstrRes = CRTDLL_wcschr(lpstrPath,':'); lpstrRes = strchrW(lpstrPath,':');
if(!lpstrRes) return FALSE; if(!lpstrRes) return FALSE;
iSize = lpstrRes - lpstrPath; iSize = lpstrRes - lpstrPath;
while(SupportedProtocol[i]) while(SupportedProtocol[i])
{ {
if (iSize == CRTDLL_wcslen(SupportedProtocol[i])) if (iSize == strlenW(SupportedProtocol[i]))
if(!CRTDLL__wcsnicmp(lpstrPath, SupportedProtocol[i], iSize)); if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize));
return TRUE; return TRUE;
i++; i++;
} }

View file

@ -9,7 +9,6 @@
#include "winnls.h" #include "winnls.h"
#include "winversion.h" #include "winversion.h"
#include "heap.h" #include "heap.h"
#include "crtdll.h"
#include "shellapi.h" #include "shellapi.h"
#include "shlobj.h" #include "shlobj.h"

View file

@ -7,11 +7,11 @@
#include "winerror.h" #include "winerror.h"
#include "debugtools.h" #include "debugtools.h"
#include "winversion.h" #include "winversion.h"
#include "crtdll.h"
#include "heap.h" #include "heap.h"
#include "shellapi.h" #include "shellapi.h"
#include "wine/undocshell.h" #include "wine/undocshell.h"
#include "wine/unicode.h"
DEFAULT_DEBUG_CHANNEL(shell); DEFAULT_DEBUG_CHANNEL(shell);
@ -137,7 +137,7 @@ LPSTR WINAPI StrChrA (LPCSTR str, INT c)
LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x ) LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
{ {
TRACE("%s 0x%04x\n",debugstr_w(str),x); TRACE("%s 0x%04x\n",debugstr_w(str),x);
return CRTDLL_wcschr(str, x); return strchrW(str, x);
} }
/************************************************************************* /*************************************************************************
@ -155,7 +155,7 @@ INT WINAPI StrCmpNA ( LPCSTR str1, LPCSTR str2, INT len)
INT WINAPI StrCmpNW ( LPCWSTR wstr1, LPCWSTR wstr2, INT len) INT WINAPI StrCmpNW ( LPCWSTR wstr1, LPCWSTR wstr2, INT len)
{ {
TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
return CRTDLL_wcsncmp(wstr1, wstr2, len); return strncmpW(wstr1, wstr2, len);
} }
/************************************************************************* /*************************************************************************
@ -173,7 +173,7 @@ int WINAPI StrCmpNIA ( LPCSTR str1, LPCSTR str2, int len)
int WINAPI StrCmpNIW ( LPCWSTR wstr1, LPCWSTR wstr2, int len) int WINAPI StrCmpNIW ( LPCWSTR wstr1, LPCWSTR wstr2, int len)
{ {
TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
return CRTDLL__wcsnicmp(wstr1, wstr2, len); return strncmpiW(wstr1, wstr2, len);
} }
/************************************************************************* /*************************************************************************
@ -229,7 +229,7 @@ LPWSTR WINAPI StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch)
while (*lpFirst) while (*lpFirst)
{ {
LPCWSTR p1 = lpFirst, p2 = lpSrch; LPCWSTR p1 = lpFirst, p2 = lpSrch;
while (*p1 && *p2 && CRTDLL_towupper(*p1) == CRTDLL_towupper(*p2)) { p1++; p2++; } while (*p1 && *p2 && toupperW(*p1) == toupperW(*p2)) { p1++; p2++; }
if (!*p2) return (LPWSTR)lpFirst; if (!*p2) return (LPWSTR)lpFirst;
lpFirst++; lpFirst++;
} }

View file

@ -12,9 +12,9 @@
#include "winreg.h" #include "winreg.h"
#include "winver.h" #include "winver.h"
#include "wine/winestring.h" #include "wine/winestring.h"
#include "wine/unicode.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)
@ -404,7 +404,7 @@ static VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( VS_VERSION_INFO_STRUCT
while ( (DWORD)child < (DWORD)info + info->wLength ) while ( (DWORD)child < (DWORD)info + info->wLength )
{ {
if ( !CRTDLL__wcsnicmp( child->szKey, szKey, cbKey ) ) if ( !strncmpiW( child->szKey, szKey, cbKey ) )
return child; return child;
child = VersionInfo32_Next( child ); child = VersionInfo32_Next( child );

View file

@ -13,6 +13,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include "wine/winestring.h" #include "wine/winestring.h"
#include "wine/unicode.h"
#include "windef.h" #include "windef.h"
#include "winnls.h" #include "winnls.h"
#include "pe_image.h" #include "pe_image.h"
@ -22,7 +23,6 @@
#include "process.h" #include "process.h"
#include "stackframe.h" #include "stackframe.h"
#include "neexe.h" #include "neexe.h"
#include "crtdll.h"
#include "debugtools.h" #include "debugtools.h"
/********************************************************************** /**********************************************************************
@ -72,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(CRTDLL__wcsnicmp(name,str->NameString,str->Length)==0) if(strncmpiW(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);

View file

@ -14,6 +14,7 @@
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "wine/unicode.h"
#include "heap.h" #include "heap.h"
#include "options.h" #include "options.h"
#include "winver.h" #include "winver.h"
@ -21,7 +22,6 @@
#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"
DEFAULT_DEBUG_CHANNEL(ole); DEFAULT_DEBUG_CHANNEL(ole);
@ -2939,8 +2939,7 @@ UINT WINAPI CompareStringW(DWORD lcid, DWORD fdwStyle,
l1 = (l1==-1)?lstrlenW(s1):l1; l1 = (l1==-1)?lstrlenW(s1):l1;
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) ? strncmpiW(s1,s2,len) : strncmpW(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 */