import cprintf from wine cvs 2006-05-23 as bug 1529 suggested, I was looking for this bug before it was reported.

it make most of msvcrt string test work, only one fail left to fix.

svn path=/trunk/; revision=22012
This commit is contained in:
Magnus Olsen 2006-05-24 18:56:29 +00:00
parent 983091eda8
commit 68f59759a3

View file

@ -1,27 +1,51 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* COPYRIGHT: Winehq
* PROJECT: wine
* FILE: msvcrt/conio/cprintf.c
* PURPOSE: C Runtime
* PROGRAMMER: Eric Kohl (Imported from DJGPP)
* PROGRAMMER: Magnus Olsen (Imported from wine cvs 2006-05-23)
*/
#include <precomp.h>
/*
* @unimplemented
* @implemented
*/
int
_cprintf(const char *fmt, ...)
{
int cnt;
char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */
char buf[2048], *mem = buf;
int written, resize = sizeof(buf), retval;
va_list valist;
while ((written = vsnprintf( mem, resize, fmt, valist )) == -1 ||
written > resize)
{
resize = (written == -1 ? resize * 2 : written + 1);
if (mem != buf)
free (mem);
if (!(mem = (char *)malloc(resize)))
return EOF;
va_start( valist, fmt );
}
va_end(valist);
retval = _cputs( mem );
if (mem != buf)
free (mem);
return retval;
/*
va_list ap;
va_start(ap, fmt);
cnt = vsprintf(buf, fmt, ap);
va_start(ap, fmt);
while (vsprintf(buf, fmt, ap)==-1)
{
if (cnt < 0)
va_end(ap);
_cputs(buf);
return cnt;
*/
}