]> git.saurik.com Git - apple/libc.git/blobdiff - stdio/FreeBSD/printfcommon.h
Libc-1439.100.3.tar.gz
[apple/libc.git] / stdio / FreeBSD / printfcommon.h
index 01504f9c1a64f9350ac228172295b9f22eccd60e..889b12ec289e802217ed8cc397df8f9f81429541 100644 (file)
@@ -79,14 +79,14 @@ io_init(struct io_state *iop, FILE *fp)
  * remain valid until io_flush() is called.
  */
 static inline int
  * 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)
 {
 
        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);
 }
        else
                return (0);
 }
@@ -107,13 +107,13 @@ static const CHAR zeroes[PADSIZE] =
  * or the zeroes array.
  */
 static inline int
  * 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;
 {
        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;
        }
                        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,
  */
 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;
 
 {
        int p_len;
 
-       p_len = ep - p;
+       p_len = (int)(ep - p);
        if (p_len > len)
                p_len = len;
        if (p_len > 0) {
        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 (-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
 }
 
 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 */
        switch (base) {
        case 10:
                if (val < 10) { /* many numbers are 1 digit */
-                       *--cp = to_char(val);
+                       *--cp = (CHAR)to_char(val);
                        return (cp);
                }
                /*
                        return (cp);
                }
                /*
@@ -205,7 +205,7 @@ __ultoa(u_long val, CHAR *endp, int base, int octzero, const char *xdigs)
                break;
 
        default:                        /* oops */
                break;
 
        default:                        /* oops */
-               abort();
+               LIBC_ABORT("__ultoa: invalid base=%d", base);
        }
        return (cp);
 }
        }
        return (cp);
 }
@@ -255,7 +255,7 @@ __ujtoa(uintmax_t val, CHAR *endp, int base, int octzero, const char *xdigs)
                break;
 
        default:
                break;
 
        default:
-               abort();
+               LIBC_ABORT("__ujtoa: invalid base=%d", base);
        }
        return (cp);
 }
        }
        return (cp);
 }
@@ -295,7 +295,7 @@ exponent(CHAR *p0, int exp, CHAR fmtch)
                        *p++ = '0';
                *p++ = to_char(exp);
        }
                        *p++ = '0';
                *p++ = to_char(exp);
        }
-       return (p - p0);
+       return (int)(p - p0);
 }
 
 #endif /* !NO_FLOATING_POINT */
 }
 
 #endif /* !NO_FLOATING_POINT */