mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 12:32:47 +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
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/ismbpun.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
* FILE: lib/sdk/crt/mbstring/mbslwr.c
|
||||
* PURPOSE: Multibyte lowercase functions
|
||||
* PROGRAMER: Eric Kohl
|
||||
* Samuel Serapion, adapted from PROJECT C Library
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
@ -33,14 +31,24 @@ unsigned int _mbctolower(unsigned int c)
|
|||
*/
|
||||
unsigned char * _mbslwr(unsigned char *x)
|
||||
{
|
||||
unsigned char *y=x;
|
||||
unsigned char *y=x;
|
||||
|
||||
while (*y) {
|
||||
if (!_ismbblead(*y)) {
|
||||
if (x == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (*y)
|
||||
{
|
||||
if (!_ismbblead(*y))
|
||||
{
|
||||
*y = tolower(*y);
|
||||
} else {
|
||||
*y=_mbctolower(*(unsigned short *)y);
|
||||
y++;
|
||||
y++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*y = _mbctolower(*(unsigned short *)y);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
|
|
Loading…
Reference in a new issue