X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..refs/heads/master:/stdio/FreeBSD/printfcommon.h diff --git a/stdio/FreeBSD/printfcommon.h b/stdio/FreeBSD/printfcommon.h index 01504f9..889b12e 100644 --- a/stdio/FreeBSD/printfcommon.h +++ b/stdio/FreeBSD/printfcommon.h @@ -79,14 +79,14 @@ io_init(struct io_state *iop, FILE *fp) * remain valid until io_flush() is called. */ static inline int -io_print(struct io_state *iop, const CHAR * __restrict ptr, int len) +io_print(struct io_state *iop, const CHAR * __restrict ptr, int len, locale_t loc) { iop->iov[iop->uio.uio_iovcnt].iov_base = (char *)ptr; iop->iov[iop->uio.uio_iovcnt].iov_len = len; iop->uio.uio_resid += len; if (++iop->uio.uio_iovcnt >= NIOV) - return (__sprint(iop->fp, &iop->uio)); + return (__sprint(iop->fp, loc, &iop->uio)); else return (0); } @@ -107,13 +107,13 @@ static const CHAR zeroes[PADSIZE] = * or the zeroes array. */ static inline int -io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with) +io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with, locale_t loc) { int n; while (howmany > 0) { n = (howmany >= PADSIZE) ? PADSIZE : howmany; - if (io_print(iop, with, n)) + if (io_print(iop, with, n, loc)) return (-1); howmany -= n; } @@ -126,27 +126,27 @@ io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with) */ static inline int io_printandpad(struct io_state *iop, const CHAR *p, const CHAR *ep, - int len, const CHAR * __restrict with) + int len, const CHAR * __restrict with, locale_t loc) { int p_len; - p_len = ep - p; + p_len = (int)(ep - p); if (p_len > len) p_len = len; if (p_len > 0) { - if (io_print(iop, p, p_len)) + if (io_print(iop, p, p_len, loc)) return (-1); } else { p_len = 0; } - return (io_pad(iop, len - p_len, with)); + return (io_pad(iop, len - p_len, with, loc)); } static inline int -io_flush(struct io_state *iop) +io_flush(struct io_state *iop, locale_t loc) { - return (__sprint(iop->fp, &iop->uio)); + return (__sprint(iop->fp, loc, &iop->uio)); } /* @@ -168,7 +168,7 @@ __ultoa(u_long val, CHAR *endp, int base, int octzero, const char *xdigs) switch (base) { case 10: if (val < 10) { /* many numbers are 1 digit */ - *--cp = to_char(val); + *--cp = (CHAR)to_char(val); return (cp); } /* @@ -205,7 +205,7 @@ __ultoa(u_long val, CHAR *endp, int base, int octzero, const char *xdigs) break; default: /* oops */ - abort(); + LIBC_ABORT("__ultoa: invalid base=%d", base); } return (cp); } @@ -255,7 +255,7 @@ __ujtoa(uintmax_t val, CHAR *endp, int base, int octzero, const char *xdigs) break; default: - abort(); + LIBC_ABORT("__ujtoa: invalid base=%d", base); } return (cp); } @@ -295,7 +295,7 @@ exponent(CHAR *p0, int exp, CHAR fmtch) *p++ = '0'; *p++ = to_char(exp); } - return (p - p0); + return (int)(p - p0); } #endif /* !NO_FLOATING_POINT */