Lines 127-133
Link Here
|
127 |
const CHAR *cp0 = cp; |
127 |
const CHAR *cp0 = cp; |
128 |
|
128 |
|
129 |
if (io_printandpad(iop, cp, ep, gs->lead, zeroes, locale)) |
129 |
if (io_printandpad(iop, cp, ep, gs->lead, zeroes, locale)) |
130 |
return (-1); |
130 |
return (EOF); |
131 |
cp += gs->lead; |
131 |
cp += gs->lead; |
132 |
while (gs->nseps > 0 || gs->nrepeats > 0) { |
132 |
while (gs->nseps > 0 || gs->nrepeats > 0) { |
133 |
if (gs->nrepeats > 0) |
133 |
if (gs->nrepeats > 0) |
Lines 137-145
Link Here
|
137 |
gs->nseps--; |
137 |
gs->nseps--; |
138 |
} |
138 |
} |
139 |
if (io_print(iop, gs->thousands_sep, gs->thousep_len, locale)) |
139 |
if (io_print(iop, gs->thousands_sep, gs->thousep_len, locale)) |
140 |
return (-1); |
140 |
return (EOF); |
141 |
if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes, locale)) |
141 |
if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes, locale)) |
142 |
return (-1); |
142 |
return (EOF); |
143 |
cp += *gs->grouping; |
143 |
cp += *gs->grouping; |
144 |
} |
144 |
} |
145 |
if (cp > ep) |
145 |
if (cp > ep) |
Lines 369-388
Link Here
|
369 |
|
369 |
|
370 |
/* BEWARE, these `goto error' on error. */ |
370 |
/* BEWARE, these `goto error' on error. */ |
371 |
#define PRINT(ptr, len) { \ |
371 |
#define PRINT(ptr, len) { \ |
372 |
if (io_print(&io, (ptr), (len), locale)) \ |
372 |
if (io_print(&io, (ptr), (len), locale)) { \ |
373 |
goto error; \ |
373 |
ret = EOF; \ |
|
|
374 |
goto error; \ |
375 |
} \ |
374 |
} |
376 |
} |
375 |
#define PAD(howmany, with) { \ |
377 |
#define PAD(howmany, with) { \ |
376 |
if (io_pad(&io, (howmany), (with), locale)) \ |
378 |
if (io_pad(&io, (howmany), (with), locale)) { \ |
|
|
379 |
ret = EOF; \ |
377 |
goto error; \ |
380 |
goto error; \ |
|
|
381 |
} \ |
378 |
} |
382 |
} |
379 |
#define PRINTANDPAD(p, ep, len, with) { \ |
383 |
#define PRINTANDPAD(p, ep, len, with) { \ |
380 |
if (io_printandpad(&io, (p), (ep), (len), (with), locale)) \ |
384 |
if (io_printandpad(&io, (p), (ep), (len), (with), locale)) { \ |
381 |
goto error; \ |
385 |
ret = EOF; \ |
|
|
386 |
goto error; \ |
387 |
} \ |
382 |
} |
388 |
} |
383 |
#define FLUSH() { \ |
389 |
#define FLUSH() { \ |
384 |
if (io_flush(&io, locale)) \ |
390 |
if (io_flush(&io, locale)) { \ |
|
|
391 |
ret = EOF; \ |
385 |
goto error; \ |
392 |
goto error; \ |
|
|
393 |
} \ |
386 |
} |
394 |
} |
387 |
|
395 |
|
388 |
/* |
396 |
/* |
Lines 617-622
Link Here
|
617 |
(wchar_t)GETARG(wint_t), &mbs); |
625 |
(wchar_t)GETARG(wint_t), &mbs); |
618 |
if (mbseqlen == (size_t)-1) { |
626 |
if (mbseqlen == (size_t)-1) { |
619 |
fp->_flags |= __SERR; |
627 |
fp->_flags |= __SERR; |
|
|
628 |
ret = EOF; |
620 |
goto error; |
629 |
goto error; |
621 |
} |
630 |
} |
622 |
size = (int)mbseqlen; |
631 |
size = (int)mbseqlen; |
Lines 828-833
Link Here
|
828 |
convbuf = __wcsconv(wcp, prec); |
837 |
convbuf = __wcsconv(wcp, prec); |
829 |
if (convbuf == NULL) { |
838 |
if (convbuf == NULL) { |
830 |
fp->_flags |= __SERR; |
839 |
fp->_flags |= __SERR; |
|
|
840 |
ret = EOF; |
831 |
goto error; |
841 |
goto error; |
832 |
} |
842 |
} |
833 |
cp = convbuf; |
843 |
cp = convbuf; |
Lines 962-969
Link Here
|
962 |
/* leading zeroes from decimal precision */ |
972 |
/* leading zeroes from decimal precision */ |
963 |
PAD(dprec - size, zeroes); |
973 |
PAD(dprec - size, zeroes); |
964 |
if (gs.grouping) { |
974 |
if (gs.grouping) { |
965 |
if (grouping_print(&gs, &io, cp, buf+BUF, locale) < 0) |
975 |
if (grouping_print(&gs, &io, cp, buf+BUF, locale) < 0) { |
|
|
976 |
ret = EOF; |
966 |
goto error; |
977 |
goto error; |
|
|
978 |
} |
967 |
} else { |
979 |
} else { |
968 |
PRINT(cp, size); |
980 |
PRINT(cp, size); |
969 |
} |
981 |
} |
Lines 979-988
Link Here
|
979 |
prec += expt; |
991 |
prec += expt; |
980 |
} else { |
992 |
} else { |
981 |
if (gs.grouping) { |
993 |
if (gs.grouping) { |
982 |
n = grouping_print(&gs, &io, |
994 |
if ((n = grouping_print(&gs, &io, |
983 |
cp, dtoaend, locale); |
995 |
cp, dtoaend, locale)) < 0) { |
984 |
if (n < 0) |
996 |
ret = EOF; |
985 |
goto error; |
997 |
goto error; |
|
|
998 |
} |
986 |
cp += n; |
999 |
cp += n; |
987 |
} else { |
1000 |
} else { |
988 |
PRINTANDPAD(cp, dtoaend, |
1001 |
PRINTANDPAD(cp, dtoaend, |
Lines 1024-1031
Link Here
|
1024 |
#endif |
1037 |
#endif |
1025 |
if (convbuf != NULL) |
1038 |
if (convbuf != NULL) |
1026 |
free(convbuf); |
1039 |
free(convbuf); |
1027 |
if (__sferror(fp)) |
|
|
1028 |
ret = EOF; |
1029 |
if ((argtable != NULL) && (argtable != statargtable)) |
1040 |
if ((argtable != NULL) && (argtable != statargtable)) |
1030 |
free (argtable); |
1041 |
free (argtable); |
1031 |
return (ret); |
1042 |
return (ret); |