mirror of
https://github.com/reactos/reactos.git
synced 2025-03-10 18:24:02 +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)
|
||||
return 0;
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
return towlower(*cs) - towlower(*ct);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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,28 +15,25 @@
|
|||
#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))
|
||||
{
|
||||
if (*cs == 0)
|
||||
return 0;
|
||||
cs++;
|
||||
ct++;
|
||||
if (*cs == 0)
|
||||
return 0;
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
return towlower(*cs) - towlower(*ct);
|
||||
}
|
||||
|
||||
|
||||
wchar_t* _wcslwr(wchar_t *x)
|
||||
wchar_t *_wcslwr (wchar_t *x)
|
||||
{
|
||||
wchar_t *y=x;
|
||||
wchar_t *y=x;
|
||||
|
||||
while (*y) {
|
||||
*y=towlower(*y);
|
||||
|
@ -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)
|
||||
return 0;
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
return towlower(*cs) - towlower(*ct);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,10 +69,10 @@ 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;
|
||||
|
||||
|
||||
for (j = 0; dest[j] != 0; j++)
|
||||
;
|
||||
for (i = 0; src[i] != 0; i++)
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -130,12 +129,12 @@ size_t wcscspn(const wchar_t *str,const wchar_t *reject)
|
|||
s=(wchar_t *)str;
|
||||
do {
|
||||
t=(wchar_t *)reject;
|
||||
while (*t) {
|
||||
if (*t==*s)
|
||||
while (*t) {
|
||||
if (*t==*s)
|
||||
break;
|
||||
t++;
|
||||
}
|
||||
if (*t)
|
||||
if (*t)
|
||||
break;
|
||||
s++;
|
||||
} while (*s);
|
||||
|
@ -147,7 +146,7 @@ size_t wcslen(const wchar_t *s)
|
|||
{
|
||||
unsigned int len = 0;
|
||||
|
||||
while (s[len] != 0)
|
||||
while (s[len] != 0)
|
||||
{
|
||||
len++;
|
||||
}
|
||||
|
@ -155,11 +154,10 @@ 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;
|
||||
|
||||
|
||||
for (j = 0; dest[j] != 0; j++)
|
||||
;
|
||||
for (i = 0; i < count; i++)
|
||||
|
@ -252,12 +250,12 @@ size_t wcsspn(const wchar_t *str,const wchar_t *accept)
|
|||
s=(wchar_t *)str;
|
||||
do {
|
||||
t=(wchar_t *)accept;
|
||||
while (*t) {
|
||||
if (*t==*s)
|
||||
while (*t) {
|
||||
if (*t==*s)
|
||||
break;
|
||||
t++;
|
||||
}
|
||||
if (!*t)
|
||||
if (!*t)
|
||||
break;
|
||||
s++;
|
||||
} while (*s);
|
||||
|
@ -275,9 +273,9 @@ wchar_t *wcsstr(const wchar_t *s,const wchar_t *b)
|
|||
if (*x==*b) {
|
||||
y=x;
|
||||
c=(wchar_t *)b;
|
||||
while (*y && *c && *y==*c) {
|
||||
while (*y && *c && *y==*c) {
|
||||
c++;
|
||||
y++;
|
||||
y++;
|
||||
}
|
||||
if (!*c)
|
||||
return x;
|
||||
|
@ -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)
|
||||
return 0;
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
return towlower(*cs) - towlower(*ct);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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…
Reference in a new issue