mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:52:59 +00:00
Fixed _wcsnicmp()
svn path=/trunk/; revision=981
This commit is contained in:
parent
326a3cd58b
commit
5f71c29e2c
3 changed files with 60 additions and 61 deletions
|
@ -1,14 +1,14 @@
|
|||
#include <crtdll/wchar.h>
|
||||
|
||||
int _wcsnicmp(const wchar_t * cs,const wchar_t * ct,size_t count)
|
||||
int _wcsnicmp (const wchar_t *cs, const wchar_t *ct, size_t count)
|
||||
{
|
||||
wchar_t *save = (wchar_t *)cs;
|
||||
while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count)
|
||||
{
|
||||
if (*cs == 0)
|
||||
if (count == 0)
|
||||
return 0;
|
||||
do {
|
||||
if (towupper(*cs) != towupper(*ct++))
|
||||
return towupper(*cs) - towupper(*--ct);
|
||||
if (*cs++ == 0)
|
||||
break;
|
||||
} while (--count != 0);
|
||||
return 0;
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
return towlower(*cs) - towlower(*ct);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: wstring.c,v 1.7 2000/02/05 23:45:46 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/ntdll/string/wstring.c
|
||||
|
@ -14,13 +15,10 @@
|
|||
#include <ddk/ntddk.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
// static wchar_t * ___wcstok = NULL;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
int _wcsicmp(const wchar_t* cs,const wchar_t * ct)
|
||||
int _wcsicmp (const wchar_t* cs, const wchar_t * ct)
|
||||
{
|
||||
while (towlower(*cs) == towlower(*ct))
|
||||
{
|
||||
|
@ -33,7 +31,7 @@ int _wcsicmp(const wchar_t* cs,const wchar_t * ct)
|
|||
}
|
||||
|
||||
|
||||
wchar_t* _wcslwr(wchar_t *x)
|
||||
wchar_t *_wcslwr (wchar_t *x)
|
||||
{
|
||||
wchar_t *y=x;
|
||||
|
||||
|
@ -44,17 +42,18 @@ wchar_t* _wcslwr(wchar_t *x)
|
|||
return x;
|
||||
}
|
||||
|
||||
int _wcsnicmp(const wchar_t * cs,const wchar_t * ct,size_t count)
|
||||
|
||||
int _wcsnicmp (const wchar_t * cs, const wchar_t * ct, size_t count)
|
||||
{
|
||||
wchar_t *save = (wchar_t *)cs;
|
||||
while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count)
|
||||
{
|
||||
if (*cs == 0)
|
||||
if (count == 0)
|
||||
return 0;
|
||||
do {
|
||||
if (towupper(*cs) != towupper(*ct++))
|
||||
return towupper(*cs) - towupper(*--ct);
|
||||
if (*cs++ == 0)
|
||||
break;
|
||||
} while (--count != 0);
|
||||
return 0;
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
return towlower(*cs) - towlower(*ct);
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +69,7 @@ wchar_t *_wcsupr(wchar_t *x)
|
|||
}
|
||||
|
||||
|
||||
wchar_t* wcscat(wchar_t *dest, const wchar_t *src)
|
||||
wchar_t *wcscat (wchar_t *dest, const wchar_t *src)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -85,7 +84,7 @@ wchar_t* wcscat(wchar_t *dest, const wchar_t *src)
|
|||
return dest;
|
||||
}
|
||||
|
||||
wchar_t* wcschr(const wchar_t *str, wchar_t ch)
|
||||
wchar_t *wcschr (const wchar_t *str, wchar_t ch)
|
||||
{
|
||||
while ((*str) != ((wchar_t) 0))
|
||||
{
|
||||
|
@ -155,8 +154,7 @@ size_t wcslen(const wchar_t *s)
|
|||
return len;
|
||||
}
|
||||
|
||||
wchar_t *
|
||||
wcsncat(wchar_t *dest, const wchar_t *src, size_t count)
|
||||
wchar_t *wcsncat(wchar_t *dest, const wchar_t *src, size_t count)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -286,3 +284,5 @@ wchar_t *wcsstr(const wchar_t *s,const wchar_t *b)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -31,7 +31,7 @@ int _wcsicmp (const wchar_t* cs, const wchar_t* ct)
|
|||
return *cs - *ct;
|
||||
}
|
||||
|
||||
wchar_t * _wcslwr (wchar_t *x)
|
||||
wchar_t *_wcslwr (wchar_t *x)
|
||||
{
|
||||
wchar_t *y=x;
|
||||
|
||||
|
@ -46,19 +46,19 @@ wchar_t * _wcslwr (wchar_t *x)
|
|||
|
||||
int _wcsnicmp (const wchar_t * cs,const wchar_t * ct,size_t count)
|
||||
{
|
||||
wchar_t *save = (wchar_t *)cs;
|
||||
while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count)
|
||||
{
|
||||
if (*cs == 0)
|
||||
if (count == 0)
|
||||
return 0;
|
||||
do {
|
||||
if (towupper(*cs) != towupper(*ct++))
|
||||
return towupper(*cs) - towupper(*--ct);
|
||||
if (*cs++ == 0)
|
||||
break;
|
||||
} while (--count != 0);
|
||||
return 0;
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
return towlower(*cs) - towlower(*ct);
|
||||
}
|
||||
|
||||
|
||||
wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill)
|
||||
wchar_t *_wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill)
|
||||
{
|
||||
wchar_t *t = wsToFill;
|
||||
int i = 0;
|
||||
|
@ -72,7 +72,7 @@ wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill)
|
|||
}
|
||||
|
||||
|
||||
wchar_t * _wcsrev(wchar_t *s)
|
||||
wchar_t *_wcsrev(wchar_t *s)
|
||||
{
|
||||
wchar_t *e;
|
||||
wchar_t a;
|
||||
|
@ -235,8 +235,7 @@ int wcsncmp(const wchar_t *cs, const wchar_t *ct, size_t count)
|
|||
}
|
||||
|
||||
|
||||
wchar_t *
|
||||
wcsncpy(wchar_t *dest, const wchar_t *src, size_t count)
|
||||
wchar_t *wcsncpy(wchar_t *dest, const wchar_t *src, size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -254,7 +253,7 @@ wcsncpy(wchar_t *dest, const wchar_t *src, size_t count)
|
|||
}
|
||||
|
||||
|
||||
wchar_t * wcsrchr(const wchar_t *str, wchar_t ch)
|
||||
wchar_t *wcsrchr(const wchar_t *str, wchar_t ch)
|
||||
{
|
||||
unsigned int len = 0;
|
||||
while (str[len] != ((wchar_t)0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue