From 2b105a52129a3124f1d75273f7b4e01b25ab25df Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Fri, 29 Mar 2013 00:35:42 -0400 Subject: [PATCH] change wcwidth detection fix some compiler warnings --- llt/ios.c | 7 ++++--- string.c | 8 +++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/llt/ios.c b/llt/ios.c index 3eb723d..25cff02 100644 --- a/llt/ios.c +++ b/llt/ios.c @@ -45,6 +45,7 @@ void *memrchr(const void *s, int c, size_t n) extern void *memrchr(const void *s, int c, size_t n); #endif +#if 0 // poll for read, unless forwrite!=0 static void _fd_poll(long fd, int forwrite) { @@ -60,6 +61,7 @@ static void _fd_poll(long fd, int forwrite) #else #endif } +#endif static int _enonfatal(int err) { @@ -226,7 +228,6 @@ static size_t _ios_read(ios_t *s, char *dest, size_t n, int all) { size_t tot = 0; size_t got, avail; - int result; while (n > 0) { avail = s->size - s->bpos; @@ -260,9 +261,9 @@ static size_t _ios_read(ios_t *s, char *dest, size_t n, int all) if (n > MOST_OF(s->maxsize)) { // doesn't fit comfortably in buffer; go direct if (all) - result = _os_read_all(s->fd, dest, n, &got); + _os_read_all(s->fd, dest, n, &got); else - result = _os_read(s->fd, dest, n, &got); + _os_read(s->fd, dest, n, &got); tot += got; if (got == 0) s->_eof = 1; diff --git a/string.c b/string.c index 250e4dc..bbc652d 100644 --- a/string.c +++ b/string.c @@ -47,14 +47,12 @@ value_t fl_string_count(value_t *args, u_int32_t nargs) return size_wrap(u8_charnum(str+start, stop-start)); } - -#if defined( __WIN32__ ) || defined( __linux__ ) -extern int wcwidth( wchar_t ); +#if defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) +extern int wcwidth(uint32_t); #else -# error "I need int wcwidth( wchar_t );" +#error "wcwidth function not available" #endif - value_t fl_string_width(value_t *args, u_int32_t nargs) { argcount("string.width", nargs, 1);