change wcwidth detection

fix some compiler warnings
This commit is contained in:
Jeff Bezanson 2013-03-29 00:35:42 -04:00
parent 8a63b14754
commit 2b105a5212
2 changed files with 7 additions and 8 deletions

View File

@ -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); extern void *memrchr(const void *s, int c, size_t n);
#endif #endif
#if 0
// poll for read, unless forwrite!=0 // poll for read, unless forwrite!=0
static void _fd_poll(long fd, int forwrite) static void _fd_poll(long fd, int forwrite)
{ {
@ -60,6 +61,7 @@ static void _fd_poll(long fd, int forwrite)
#else #else
#endif #endif
} }
#endif
static int _enonfatal(int err) 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 tot = 0;
size_t got, avail; size_t got, avail;
int result;
while (n > 0) { while (n > 0) {
avail = s->size - s->bpos; 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)) { if (n > MOST_OF(s->maxsize)) {
// doesn't fit comfortably in buffer; go direct // doesn't fit comfortably in buffer; go direct
if (all) if (all)
result = _os_read_all(s->fd, dest, n, &got); _os_read_all(s->fd, dest, n, &got);
else else
result = _os_read(s->fd, dest, n, &got); _os_read(s->fd, dest, n, &got);
tot += got; tot += got;
if (got == 0) if (got == 0)
s->_eof = 1; s->_eof = 1;

View File

@ -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)); return size_wrap(u8_charnum(str+start, stop-start));
} }
#if defined(__linux__) || (defined(__APPLE__) && defined(__MACH__))
#if defined( __WIN32__ ) || defined( __linux__ ) extern int wcwidth(uint32_t);
extern int wcwidth( wchar_t );
#else #else
# error "I need int wcwidth( wchar_t );" #error "wcwidth function not available"
#endif #endif
value_t fl_string_width(value_t *args, u_int32_t nargs) value_t fl_string_width(value_t *args, u_int32_t nargs)
{ {
argcount("string.width", nargs, 1); argcount("string.width", nargs, 1);