* 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);
}
* 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;
}
*/
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));
}
/*
switch (base) {
case 10:
if (val < 10) { /* many numbers are 1 digit */
- *--cp = to_char(val);
+ *--cp = (CHAR)to_char(val);
return (cp);
}
/*
break;
default: /* oops */
- abort();
+ LIBC_ABORT("__ultoa: invalid base=%d", base);
}
return (cp);
}
break;
default:
- abort();
+ LIBC_ABORT("__ujtoa: invalid base=%d", base);
}
return (cp);
}
*p++ = '0';
*p++ = to_char(exp);
}
- return (p - p0);
+ return (int)(p - p0);
}
#endif /* !NO_FLOATING_POINT */