- Check first for string length and second for the string end in string/stringw.

svn path=/trunk/; revision=7546
This commit is contained in:
Hartmut Birr 2004-01-10 14:22:14 +00:00
parent 7da5a1aca6
commit deb18d2120
6 changed files with 17 additions and 17 deletions

View file

@ -617,7 +617,7 @@ static int string(FILE *f, const char* s, int len, int field_width, int precisio
if (len == -1)
{
len = 0;
while (s[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
@ -661,7 +661,7 @@ static int stringw(FILE *f, const wchar_t* sw, int len, int field_width, int pre
if (len == -1)
{
len = 0;
while (sw[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else

View file

@ -608,7 +608,7 @@ static int string(FILE *f, const char* s, int len, int field_width, int precisio
if (len == -1)
{
len = 0;
while (s[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
@ -652,7 +652,7 @@ static int stringw(FILE *f, const wchar_t* sw, int len, int field_width, int pre
if (len == -1)
{
len = 0;
while (sw[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else
@ -685,7 +685,7 @@ static int stringw(FILE *f, const wchar_t* sw, int len, int field_width, int pre
int __vfwprintf(FILE *f, const wchar_t *fmt, va_list args)
{
int len;
int len = 0;
ULONGLONG num;
int base;
long double _ldouble;

View file

@ -1,4 +1,4 @@
/* $Id: sprintf.c,v 1.13 2003/09/12 17:51:48 vizzini Exp $
/* $Id: sprintf.c,v 1.14 2004/01/10 14:22:14 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -165,7 +165,7 @@ string(char* buf, char* end, const char* s, int len, int field_width, int precis
if (len == -1)
{
len = 0;
while (s[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
@ -210,7 +210,7 @@ stringw(char* buf, char* end, const wchar_t* sw, int len, int field_width, int p
if (len == -1)
{
len = 0;
while (sw[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else

View file

@ -1,4 +1,4 @@
/* $Id: swprintf.c,v 1.15 2003/09/12 17:51:48 vizzini Exp $
/* $Id: swprintf.c,v 1.16 2004/01/10 14:22:14 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -167,7 +167,7 @@ string(wchar_t* buf, wchar_t* end, const char* s, int len, int field_width, int
if (len == -1)
{
len = 0;
while (s[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
@ -212,7 +212,7 @@ stringw(wchar_t* buf, wchar_t* end, const wchar_t* sw, int len, int field_width,
if (len == -1)
{
len = 0;
while (sw[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else

View file

@ -1,4 +1,4 @@
/* $Id: sprintf.c,v 1.15 2003/12/30 18:52:06 fireball Exp $
/* $Id: sprintf.c,v 1.16 2004/01/10 14:22:14 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -182,7 +182,7 @@ string(char* buf, char* end, const char* s, int len, int field_width, int precis
if (len == -1)
{
len = 0;
while (s[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
@ -227,7 +227,7 @@ stringw(char* buf, char* end, const wchar_t* sw, int len, int field_width, int p
if (len == -1)
{
len = 0;
while (sw[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else

View file

@ -1,4 +1,4 @@
/* $Id: swprintf.c,v 1.13 2003/12/30 18:52:06 fireball Exp $
/* $Id: swprintf.c,v 1.14 2004/01/10 14:22:14 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -193,7 +193,7 @@ string(wchar_t* buf, wchar_t* end, const char* s, int len, int field_width, int
if (len == -1)
{
len = 0;
while (s[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
@ -238,7 +238,7 @@ stringw(wchar_t* buf, wchar_t* end, const wchar_t* sw, int len, int field_width,
if (len == -1)
{
len = 0;
while (sw[len] && (unsigned int)len < (unsigned int)precision)
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else