Date: Tue, 02 Apr 2019 05:55:45 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 236935] libxo =text and XOF_FLUSH does not print the first value Message-ID: <bug-236935-227-lktvl0xqOH@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-236935-227@https.bugs.freebsd.org/bugzilla/> References: <bug-236935-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236935 --- Comment #5 from Phil Shafer <phil@freebsd.org> --- The fix is: +++ b/libxo/xo_buf.h @@ -114,7 +114,12 @@ static inline int xo_buf_has_room (xo_buffer_t *xbp, ssize_t len) { if (xbp->xb_curp + len >=3D xbp->xb_bufp + xbp->xb_size) { - ssize_t sz =3D xbp->xb_size + XO_BUFSIZ; + /* + * Find out how much new space we need, round it up to XO_BUFSIZ + */ + ssize_t sz =3D (xbp->xb_curp + len) - xbp->xb_bufp; + sz =3D (sz + XO_BUFSIZ - 1) & ~(XO_BUFSIZ - 1); + Instead of rounding up to XO_BUFSIZ, I was just adding XO_BUFSIZ. For large strings, this obviously fails. Thanks, Phil --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236935-227-lktvl0xqOH>