mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
- Fix mbslwr: increment pointer in both cases (prevents infinite loops)
- Check for null character pointers, apply somewhat readable formatting - Add some useful header information See issue #4755 for more details. svn path=/trunk/; revision=42363
This commit is contained in:
parent
7aa73a6110
commit
9d8f60cf81
1 changed files with 20 additions and 12 deletions
|
@ -1,12 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/sdk/crt/mbstring/ismbpun.c
|
* FILE: lib/sdk/crt/mbstring/mbslwr.c
|
||||||
* PURPOSE:
|
* PURPOSE: Multibyte lowercase functions
|
||||||
* PROGRAMER:
|
* PROGRAMER: Eric Kohl
|
||||||
* UPDATE HISTORY:
|
* Samuel Serapion, adapted from PROJECT C Library
|
||||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <precomp.h>
|
#include <precomp.h>
|
||||||
|
@ -33,14 +31,24 @@ unsigned int _mbctolower(unsigned int c)
|
||||||
*/
|
*/
|
||||||
unsigned char * _mbslwr(unsigned char *x)
|
unsigned char * _mbslwr(unsigned char *x)
|
||||||
{
|
{
|
||||||
unsigned char *y=x;
|
unsigned char *y=x;
|
||||||
|
|
||||||
while (*y) {
|
if (x == NULL)
|
||||||
if (!_ismbblead(*y)) {
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (*y)
|
||||||
|
{
|
||||||
|
if (!_ismbblead(*y))
|
||||||
|
{
|
||||||
*y = tolower(*y);
|
*y = tolower(*y);
|
||||||
} else {
|
y++;
|
||||||
*y=_mbctolower(*(unsigned short *)y);
|
}
|
||||||
y++;
|
else
|
||||||
|
{
|
||||||
|
*y = _mbctolower(*(unsigned short *)y);
|
||||||
|
y++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
|
|
Loading…
Reference in a new issue