kernel32: Move lstr* string functions to kernelbase.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
31083dbaec
commit
2a455ce049
|
@ -1,7 +1,7 @@
|
|||
EXTRADEFS = -D_KERNEL32_ -D_NORMALIZE_
|
||||
MODULE = kernel32.dll
|
||||
IMPORTLIB = kernel32
|
||||
IMPORTS = winecrt0 ntdll
|
||||
IMPORTS = winecrt0 kernelbase ntdll
|
||||
EXTRALIBS = $(COREFOUNDATION_LIBS) $(POLL_LIBS) $(RT_LIBS)
|
||||
EXTRADLLFLAGS = -nodefaultlibs -Wb,-F,KERNEL32.dll -Wl,--image-base,0x7b400000
|
||||
|
||||
|
|
|
@ -1651,21 +1651,21 @@
|
|||
@ stdcall lstrcat(str str) lstrcatA
|
||||
@ stdcall lstrcatA(str str)
|
||||
@ stdcall lstrcatW(wstr wstr)
|
||||
@ stdcall lstrcmp(str str) lstrcmpA
|
||||
@ stdcall lstrcmpA(str str)
|
||||
@ stdcall lstrcmpW(wstr wstr)
|
||||
@ stdcall lstrcmpi(str str) lstrcmpiA
|
||||
@ stdcall lstrcmpiA(str str)
|
||||
@ stdcall lstrcmpiW(wstr wstr)
|
||||
@ stdcall -import lstrcmp(str str)
|
||||
@ stdcall -import lstrcmpA(str str)
|
||||
@ stdcall -import lstrcmpW(wstr wstr)
|
||||
@ stdcall -import lstrcmpi(str str)
|
||||
@ stdcall -import lstrcmpiA(str str)
|
||||
@ stdcall -import lstrcmpiW(wstr wstr)
|
||||
@ stdcall lstrcpy(ptr str) lstrcpyA
|
||||
@ stdcall lstrcpyA(ptr str)
|
||||
@ stdcall lstrcpyW(ptr wstr)
|
||||
@ stdcall lstrcpyn(ptr str long) lstrcpynA
|
||||
@ stdcall lstrcpynA(ptr str long)
|
||||
@ stdcall lstrcpynW(ptr wstr long)
|
||||
@ stdcall lstrlen(str) lstrlenA
|
||||
@ stdcall lstrlenA(str)
|
||||
@ stdcall lstrlenW(wstr)
|
||||
@ stdcall -import lstrcpyn(ptr str long)
|
||||
@ stdcall -import lstrcpynA(ptr str long)
|
||||
@ stdcall -import lstrcpynW(ptr wstr long)
|
||||
@ stdcall -import lstrlen(str)
|
||||
@ stdcall -import lstrlenA(str)
|
||||
@ stdcall -import lstrlenW(wstr)
|
||||
|
||||
################################################################
|
||||
# Wine internal extensions
|
||||
|
|
|
@ -4062,102 +4062,6 @@ INT WINAPI CompareStringOrdinal(const WCHAR *str1, INT len1, const WCHAR *str2,
|
|||
return CSTR_EQUAL;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* lstrcmp (KERNEL32.@)
|
||||
* lstrcmpA (KERNEL32.@)
|
||||
*
|
||||
* Compare two strings using the current thread locale.
|
||||
*
|
||||
* PARAMS
|
||||
* str1 [I] First string to compare
|
||||
* str2 [I] Second string to compare
|
||||
*
|
||||
* RETURNS
|
||||
* Success: A number less than, equal to or greater than 0 depending on whether
|
||||
* str1 is less than, equal to or greater than str2 respectively.
|
||||
* Failure: FALSE. Use GetLastError() to determine the cause.
|
||||
*/
|
||||
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((str1 == NULL) && (str2 == NULL)) return 0;
|
||||
if (str1 == NULL) return -1;
|
||||
if (str2 == NULL) return 1;
|
||||
|
||||
ret = CompareStringA(GetThreadLocale(), LOCALE_USE_CP_ACP, str1, -1, str2, -1);
|
||||
if (ret) ret -= 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* lstrcmpi (KERNEL32.@)
|
||||
* lstrcmpiA (KERNEL32.@)
|
||||
*
|
||||
* Compare two strings using the current thread locale, ignoring case.
|
||||
*
|
||||
* PARAMS
|
||||
* str1 [I] First string to compare
|
||||
* str2 [I] Second string to compare
|
||||
*
|
||||
* RETURNS
|
||||
* Success: A number less than, equal to or greater than 0 depending on whether
|
||||
* str2 is less than, equal to or greater than str1 respectively.
|
||||
* Failure: FALSE. Use GetLastError() to determine the cause.
|
||||
*/
|
||||
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((str1 == NULL) && (str2 == NULL)) return 0;
|
||||
if (str1 == NULL) return -1;
|
||||
if (str2 == NULL) return 1;
|
||||
|
||||
ret = CompareStringA(GetThreadLocale(), NORM_IGNORECASE|LOCALE_USE_CP_ACP, str1, -1, str2, -1);
|
||||
if (ret) ret -= 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* lstrcmpW (KERNEL32.@)
|
||||
*
|
||||
* See lstrcmpA.
|
||||
*/
|
||||
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((str1 == NULL) && (str2 == NULL)) return 0;
|
||||
if (str1 == NULL) return -1;
|
||||
if (str2 == NULL) return 1;
|
||||
|
||||
ret = CompareStringW(GetThreadLocale(), 0, str1, -1, str2, -1);
|
||||
if (ret) ret -= 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* lstrcmpiW (KERNEL32.@)
|
||||
*
|
||||
* See lstrcmpiA.
|
||||
*/
|
||||
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((str1 == NULL) && (str2 == NULL)) return 0;
|
||||
if (str1 == NULL) return -1;
|
||||
if (str2 == NULL) return 1;
|
||||
|
||||
ret = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, str1, -1, str2, -1);
|
||||
if (ret) ret -= 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* LOCALE_Init
|
||||
*/
|
||||
|
|
|
@ -111,113 +111,3 @@ LPWSTR WINAPI lstrcpyW( LPWSTR dst, LPCWSTR src )
|
|||
__ENDTRY
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* lstrcpynA (KERNEL32.@)
|
||||
* lstrcpyn (KERNEL32.@)
|
||||
*
|
||||
* Note: this function differs from the UNIX strncpy, it _always_ writes
|
||||
* a terminating \0.
|
||||
*
|
||||
* Note: n is an INT but Windows treats it as unsigned, and will happily
|
||||
* copy a gazillion chars if n is negative.
|
||||
*/
|
||||
LPSTR WINAPI lstrcpynA( LPSTR dst, LPCSTR src, INT n )
|
||||
{
|
||||
__TRY
|
||||
{
|
||||
LPSTR d = dst;
|
||||
LPCSTR s = src;
|
||||
UINT count = n;
|
||||
|
||||
while ((count > 1) && *s)
|
||||
{
|
||||
count--;
|
||||
*d++ = *s++;
|
||||
}
|
||||
if (count) *d = 0;
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* lstrcpynW (KERNEL32.@)
|
||||
*
|
||||
* Note: this function differs from the UNIX strncpy, it _always_ writes
|
||||
* a terminating \0
|
||||
*
|
||||
* Note: n is an INT but Windows treats it as unsigned, and will happily
|
||||
* copy a gazillion chars if n is negative.
|
||||
*/
|
||||
LPWSTR WINAPI lstrcpynW( LPWSTR dst, LPCWSTR src, INT n )
|
||||
{
|
||||
__TRY
|
||||
{
|
||||
LPWSTR d = dst;
|
||||
LPCWSTR s = src;
|
||||
UINT count = n;
|
||||
|
||||
while ((count > 1) && *s)
|
||||
{
|
||||
count--;
|
||||
*d++ = *s++;
|
||||
}
|
||||
if (count) *d = 0;
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* lstrlenA (KERNEL32.@)
|
||||
* lstrlen (KERNEL32.@)
|
||||
*/
|
||||
INT WINAPI lstrlenA( LPCSTR str )
|
||||
{
|
||||
INT ret;
|
||||
__TRY
|
||||
{
|
||||
ret = strlen(str);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* lstrlenW (KERNEL32.@)
|
||||
*/
|
||||
INT WINAPI lstrlenW( LPCWSTR str )
|
||||
{
|
||||
INT ret;
|
||||
__TRY
|
||||
{
|
||||
ret = strlenW(str);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1756,17 +1756,17 @@
|
|||
# @ stub exit
|
||||
# @ stub hgets
|
||||
# @ stub hwprintf
|
||||
@ stdcall lstrcmp(str str) kernel32.lstrcmp
|
||||
@ stdcall lstrcmpA(str str) kernel32.lstrcmpA
|
||||
@ stdcall lstrcmpW(wstr wstr) kernel32.lstrcmpW
|
||||
@ stdcall lstrcmpi(str str) kernel32.lstrcmpi
|
||||
@ stdcall lstrcmpiA(str str) kernel32.lstrcmpiA
|
||||
@ stdcall lstrcmpiW(wstr wstr) kernel32.lstrcmpiW
|
||||
@ stdcall lstrcpyn(ptr str long) kernel32.lstrcpyn
|
||||
@ stdcall lstrcpynA(ptr str long) kernel32.lstrcpynA
|
||||
@ stdcall lstrcpynW(ptr wstr long) kernel32.lstrcpynW
|
||||
@ stdcall lstrlen(str) kernel32.lstrlen
|
||||
@ stdcall lstrlenA(str) kernel32.lstrlenA
|
||||
@ stdcall lstrlenW(wstr) kernel32.lstrlenW
|
||||
@ stdcall lstrcmp(str str) lstrcmpA
|
||||
@ stdcall lstrcmpA(str str)
|
||||
@ stdcall lstrcmpW(wstr wstr)
|
||||
@ stdcall lstrcmpi(str str) lstrcmpiA
|
||||
@ stdcall lstrcmpiA(str str)
|
||||
@ stdcall lstrcmpiW(wstr wstr)
|
||||
@ stdcall lstrcpyn(ptr str long) KERNELBASE_lstrcpynA
|
||||
@ stdcall lstrcpynA(ptr str long) KERNELBASE_lstrcpynA
|
||||
@ stdcall lstrcpynW(ptr wstr long) KERNELBASE_lstrcpynW
|
||||
@ stdcall lstrlen(str) KERNELBASE_lstrlenA
|
||||
@ stdcall lstrlenA(str) KERNELBASE_lstrlenA
|
||||
@ stdcall lstrlenW(wstr) KERNELBASE_lstrlenW
|
||||
# @ stub time
|
||||
# @ stub wprintf
|
||||
|
|
|
@ -65,6 +65,130 @@ static BOOL char_compare(WORD ch1, WORD ch2, DWORD flags)
|
|||
return CompareStringA(GetThreadLocale(), flags, str1, -1, str2, -1) - CSTR_EQUAL;
|
||||
}
|
||||
|
||||
int WINAPI lstrcmpA( LPCSTR str1, LPCSTR str2 )
|
||||
{
|
||||
if (!str1 && !str2) return 0;
|
||||
if (!str1) return -1;
|
||||
if (!str2) return 1;
|
||||
return CompareStringA( GetThreadLocale(), LOCALE_USE_CP_ACP, str1, -1, str2, -1 ) - 2;
|
||||
}
|
||||
|
||||
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
|
||||
{
|
||||
if (!str1 && !str2) return 0;
|
||||
if (!str1) return -1;
|
||||
if (!str2) return 1;
|
||||
return CompareStringW( GetThreadLocale(), 0, str1, -1, str2, -1 ) - 2;
|
||||
}
|
||||
|
||||
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
|
||||
{
|
||||
if (!str1 && !str2) return 0;
|
||||
if (!str1) return -1;
|
||||
if (!str2) return 1;
|
||||
return CompareStringA( GetThreadLocale(), NORM_IGNORECASE|LOCALE_USE_CP_ACP, str1, -1, str2, -1 ) - 2;
|
||||
}
|
||||
|
||||
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
|
||||
{
|
||||
if (!str1 && !str2) return 0;
|
||||
if (!str1) return -1;
|
||||
if (!str2) return 1;
|
||||
return CompareStringW( GetThreadLocale(), NORM_IGNORECASE, str1, -1, str2, -1 ) - 2;
|
||||
}
|
||||
|
||||
LPSTR WINAPI KERNELBASE_lstrcpynA( LPSTR dst, LPCSTR src, INT n )
|
||||
{
|
||||
/* Note: this function differs from the UNIX strncpy, it _always_ writes
|
||||
* a terminating \0.
|
||||
*
|
||||
* Note: n is an INT but Windows treats it as unsigned, and will happily
|
||||
* copy a gazillion chars if n is negative.
|
||||
*/
|
||||
__TRY
|
||||
{
|
||||
LPSTR d = dst;
|
||||
LPCSTR s = src;
|
||||
UINT count = n;
|
||||
|
||||
while ((count > 1) && *s)
|
||||
{
|
||||
count--;
|
||||
*d++ = *s++;
|
||||
}
|
||||
if (count) *d = 0;
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return dst;
|
||||
}
|
||||
|
||||
LPWSTR WINAPI KERNELBASE_lstrcpynW( LPWSTR dst, LPCWSTR src, INT n )
|
||||
{
|
||||
/* Note: this function differs from the UNIX strncpy, it _always_ writes
|
||||
* a terminating \0
|
||||
*
|
||||
* Note: n is an INT but Windows treats it as unsigned, and will happily
|
||||
* copy a gazillion chars if n is negative.
|
||||
*/
|
||||
__TRY
|
||||
{
|
||||
LPWSTR d = dst;
|
||||
LPCWSTR s = src;
|
||||
UINT count = n;
|
||||
|
||||
while ((count > 1) && *s)
|
||||
{
|
||||
count--;
|
||||
*d++ = *s++;
|
||||
}
|
||||
if (count) *d = 0;
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return dst;
|
||||
}
|
||||
|
||||
INT WINAPI KERNELBASE_lstrlenA( LPCSTR str )
|
||||
{
|
||||
INT ret;
|
||||
__TRY
|
||||
{
|
||||
ret = strlen(str);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return ret;
|
||||
}
|
||||
|
||||
INT WINAPI KERNELBASE_lstrlenW( LPCWSTR str )
|
||||
{
|
||||
INT ret;
|
||||
__TRY
|
||||
{
|
||||
ret = wcslen(str);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return ret;
|
||||
}
|
||||
|
||||
DWORD WINAPI StrCmpCA(const char *str, const char *cmp)
|
||||
{
|
||||
return lstrcmpA(str, cmp);
|
||||
|
|
Loading…
Reference in New Issue