sob

Simple output bar
git clone https://git.sinitax.com/codemadness/sob
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 0b974dd40e0a43e83656172f1af3067a438b86c4
parent 611985a88db127b299c44e334577c447457d4fd3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 24 Oct 2014 22:46:27 +0000

signed, unsigned fix

Diffstat:
Msob.c | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sob.c b/sob.c @@ -550,7 +550,8 @@ line_copywordcursor(char *buf, size_t bufsiz) static int readfd(int fd, char *buf, size_t len) { - size_t r, i = 0; + size_t i = 0; + ssize_t r; while(len > 0) { if((r = read(fd, &buf[i], len)) == -1) { @@ -562,15 +563,16 @@ readfd(int fd, char *buf, size_t len) { } else if(r == 0) { return i; } - i += r; - len -= r; + i += (size_t)r; + len -= (size_t)r; } return i; } static int writefd(int fd, char *buf, size_t len) { - size_t w, i = 0; + size_t i = 0; + ssize_t w; while(len > 0) { if((w = write(fd, &buf[i], len)) == -1) { @@ -582,8 +584,8 @@ writefd(int fd, char *buf, size_t len) { } else if(w == 0) { return i; } - i += w; - len -= w; + i += (size_t)w; + len -= (size_t)w; } return i; }