MFp4: Catch up to recent __dtoa() interface changes and removal of cvt()'s
last argument.
This commit is contained in:
parent
ba71de6a3b
commit
91582a7223
@ -39,7 +39,7 @@
|
|||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
__FBSDID("FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.45 2002/09/06 11:23:55 tjr Exp ");
|
__FBSDID("$FreeBSD$");
|
||||||
#endif
|
#endif
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
@ -406,8 +406,10 @@ vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, va_list ap)
|
|||||||
#define BUF ((MAXEXP*2)+MAXFRACT+1) /* + decimal point */
|
#define BUF ((MAXEXP*2)+MAXFRACT+1) /* + decimal point */
|
||||||
#define DEFPREC 6
|
#define DEFPREC 6
|
||||||
|
|
||||||
static wchar_t *cvt(double, int, int, char *, int *, wchar_t, int *,
|
extern char *__dtoa(double, int, int, int *, int *, char **);
|
||||||
wchar_t **);
|
extern void __freedtoa(char *s);
|
||||||
|
|
||||||
|
static wchar_t *cvt(double, int, int, char *, int *, wchar_t, int *);
|
||||||
static int exponent(wchar_t *, int, wchar_t);
|
static int exponent(wchar_t *, int, wchar_t);
|
||||||
|
|
||||||
#else /* no FLOATING_POINT */
|
#else /* no FLOATING_POINT */
|
||||||
@ -807,8 +809,8 @@ fp_begin: if (prec == -1)
|
|||||||
free(dtoaresult);
|
free(dtoaresult);
|
||||||
dtoaresult = NULL;
|
dtoaresult = NULL;
|
||||||
}
|
}
|
||||||
cp = cvt(_double, prec, flags, &softsign,
|
dtoaresult = cp = cvt(_double, prec, flags, &softsign,
|
||||||
&expt, ch, &ndig, &dtoaresult);
|
&expt, ch, &ndig);
|
||||||
if (ch == 'g' || ch == 'G') {
|
if (ch == 'g' || ch == 'G') {
|
||||||
if (expt <= -4 || expt > prec)
|
if (expt <= -4 || expt > prec)
|
||||||
ch = (ch == 'g') ? 'e' : 'E';
|
ch = (ch == 'g') ? 'e' : 'E';
|
||||||
@ -1472,11 +1474,9 @@ __grow_type_table (int nextarg, enum typeid **typetable, int *tablesize)
|
|||||||
|
|
||||||
#ifdef FLOATING_POINT
|
#ifdef FLOATING_POINT
|
||||||
|
|
||||||
extern char *__dtoa(double, int, int, int *, int *, char **, char **);
|
|
||||||
|
|
||||||
static wchar_t *
|
static wchar_t *
|
||||||
cvt(double value, int ndigits, int flags, char *sign, int *decpt,
|
cvt(double value, int ndigits, int flags, char *sign, int *decpt,
|
||||||
wchar_t ch, int *length, wchar_t **dtoaresultp)
|
wchar_t ch, int *length)
|
||||||
{
|
{
|
||||||
int i, mode, dsgn;
|
int i, mode, dsgn;
|
||||||
wchar_t *digits, *bp, *result, *rve;
|
wchar_t *digits, *bp, *result, *rve;
|
||||||
@ -1494,14 +1494,13 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt,
|
|||||||
ndigits++;
|
ndigits++;
|
||||||
mode = 2; /* ndigits significant digits */
|
mode = 2; /* ndigits significant digits */
|
||||||
}
|
}
|
||||||
__dtoa(value, mode, ndigits, decpt, &dsgn, &trve, &tresult);
|
tresult = __dtoa(value, mode, ndigits, decpt, &dsgn, &trve);
|
||||||
if ((result = malloc((trve - tresult + 1) * sizeof(*result))) == NULL)
|
if ((result = malloc((trve - tresult + 1) * sizeof(*result))) == NULL)
|
||||||
abort(); /* XXX handle better */
|
abort(); /* XXX handle better */
|
||||||
for (i = 0; i < trve - tresult + 1; i++)
|
for (i = 0; i < trve - tresult + 1; i++)
|
||||||
result[i] = (wchar_t)(unsigned char)tresult[i];
|
result[i] = (wchar_t)(unsigned char)tresult[i];
|
||||||
rve = result + (trve - tresult);
|
rve = result + (trve - tresult);
|
||||||
free(tresult);
|
__freedtoa(tresult);
|
||||||
*dtoaresultp = result;
|
|
||||||
digits = result;
|
digits = result;
|
||||||
*sign = dsgn != 0;
|
*sign = dsgn != 0;
|
||||||
if ((ch != 'g' && ch != 'G') || flags & ALT) {
|
if ((ch != 'g' && ch != 'G') || flags & ALT) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user