starteted implement float into sprintf, snprintf and alot other printf api. this is more like a start how to implement it. This commit is more market for me. so I do not forget where string functions of *printf api (the main api functions) are. One more thing if u change on sprintf.c same change must be done in swprintf.c or changes into swprintf.c same changes must be done in swprintf.c, other wise the efect of bugfix or change will not be excutected in reactos, for u do not know if program pic the ansi or unicode version.

svn path=/trunk/; revision=22083
This commit is contained in:
Magnus Olsen 2006-05-28 04:58:27 +00:00
parent b254c4649e
commit d62e9d48be
2 changed files with 26 additions and 2 deletions

View file

@ -241,6 +241,8 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
{
int len;
unsigned long long num;
double _double;
int base;
char *str, *end;
const char *s;
@ -258,7 +260,7 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
str = buf;
end = buf + cnt - 1;
if (end < buf - 1) {
end = ((void *) -1);
end = ((char *) -1);
cnt = end - buf + 1;
}
@ -441,6 +443,17 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
*ip = (str - buf);
}
continue;
/* float number formats - set up the flags and "break" */
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
_double = (double)va_arg(args, double);
str = number(str, end, (int)_double, base, field_width, precision, flags);
continue;
/* integer number formats - set up the flags and "break" */
case 'o':

View file

@ -245,6 +245,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
wchar_t * str, * end;
const char *s;
const wchar_t *sw;
double _double;
int flags; /* flags to number() */
@ -256,7 +257,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
str = buf;
end = buf + cnt - 1;
if (end < buf - 1) {
end = ((void *) -1);
end = ((wchar_t *) -1);
cnt = end - buf + 1;
}
@ -439,6 +440,16 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
*ip = (str - buf);
}
continue;
/* float number formats - set up the flags and "break" */
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
_double = (double)va_arg(args, double);
str = number(str, end, (int)_double, base, field_width, precision, flags);
continue;
/* integer number formats - set up the flags and "break" */
case L'o':