mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:15:41 +00:00
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:
parent
b254c4649e
commit
d62e9d48be
2 changed files with 26 additions and 2 deletions
|
@ -241,6 +241,8 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
unsigned long long num;
|
unsigned long long num;
|
||||||
|
double _double;
|
||||||
|
|
||||||
int base;
|
int base;
|
||||||
char *str, *end;
|
char *str, *end;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -258,7 +260,7 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
|
||||||
str = buf;
|
str = buf;
|
||||||
end = buf + cnt - 1;
|
end = buf + cnt - 1;
|
||||||
if (end < buf - 1) {
|
if (end < buf - 1) {
|
||||||
end = ((void *) -1);
|
end = ((char *) -1);
|
||||||
cnt = end - buf + 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);
|
*ip = (str - buf);
|
||||||
}
|
}
|
||||||
continue;
|
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" */
|
/* integer number formats - set up the flags and "break" */
|
||||||
case 'o':
|
case 'o':
|
||||||
|
|
|
@ -245,6 +245,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
|
||||||
wchar_t * str, * end;
|
wchar_t * str, * end;
|
||||||
const char *s;
|
const char *s;
|
||||||
const wchar_t *sw;
|
const wchar_t *sw;
|
||||||
|
double _double;
|
||||||
|
|
||||||
int flags; /* flags to number() */
|
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;
|
str = buf;
|
||||||
end = buf + cnt - 1;
|
end = buf + cnt - 1;
|
||||||
if (end < buf - 1) {
|
if (end < buf - 1) {
|
||||||
end = ((void *) -1);
|
end = ((wchar_t *) -1);
|
||||||
cnt = end - buf + 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);
|
*ip = (str - buf);
|
||||||
}
|
}
|
||||||
continue;
|
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" */
|
/* integer number formats - set up the flags and "break" */
|
||||||
case L'o':
|
case L'o':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue