Added function _wcsncmp
* Compare WCHAR strings up to n characters
This commit is contained in:
parent
96aef5f1af
commit
ed57dd37b9
@ -61,6 +61,7 @@ extern "C"
|
||||
WINPR_API int _strnicmp(const char* string1, const char* string2, size_t count);
|
||||
|
||||
WINPR_API int _wcscmp(const WCHAR* string1, const WCHAR* string2);
|
||||
WINPR_API int _wcsncmp(const WCHAR* string1, const WCHAR* string2, size_t count);
|
||||
|
||||
WINPR_API size_t _wcslen(const WCHAR* str);
|
||||
WINPR_API size_t _wcsnlen(const WCHAR* str, size_t maxNumberOfElements);
|
||||
@ -74,6 +75,7 @@ extern "C"
|
||||
#else
|
||||
|
||||
#define _wcscmp wcscmp
|
||||
#define _wcsncmp wcsncmp
|
||||
#define _wcslen wcslen
|
||||
#define _wcsnlen wcsnlen
|
||||
#define _wcschr wcschr
|
||||
|
@ -108,7 +108,20 @@ int _wcscmp(const WCHAR* string1, const WCHAR* string2)
|
||||
|
||||
Data_Read_UINT16(string1, value1);
|
||||
Data_Read_UINT16(string2, value2);
|
||||
return value1 - value2;
|
||||
return (int)value1 - value2;
|
||||
}
|
||||
|
||||
int _wcsncmp(const WCHAR* string1, const WCHAR* string2, size_t count)
|
||||
{
|
||||
for (size_t x = 0; x < count; x++)
|
||||
{
|
||||
const WCHAR a = string1[x];
|
||||
const WCHAR b = string2[x];
|
||||
|
||||
if (a != b)
|
||||
return (int)a - b;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* _wcslen -> wcslen */
|
||||
|
Loading…
Reference in New Issue
Block a user