diff options
| author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-11-24 21:58:55 +0000 | 
|---|---|---|
| committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-11-24 21:58:55 +0000 | 
| commit | f3f4519561a47a1b7e488939a2cb27d39d7d40e1 (patch) | |
| tree | 977d259a98d1c7cf07b330ab8e0367a87750ec37 | |
| parent | a40e9961d905c97f59b23ebcbc7e928d387208df (diff) | |
| download | termo-f3f4519561a47a1b7e488939a2cb27d39d7d40e1.tar.gz termo-f3f4519561a47a1b7e488939a2cb27d39d7d40e1.tar.xz termo-f3f4519561a47a1b7e488939a2cb27d39d7d40e1.zip | |
Fixed some signed/unsigned integer mismatches, including one important bug
| -rw-r--r-- | termkey.c | 8 | 
1 files changed, 4 insertions, 4 deletions
| @@ -319,7 +319,7 @@ static void eat_bytes(termkey_t *tk, size_t count)    }  } -static inline int utf8_seqlen(long codepoint) +static inline unsigned int utf8_seqlen(long codepoint)  {    if(codepoint < 0x0000080) return 1;    if(codepoint < 0x0000800) return 2; @@ -470,7 +470,7 @@ static termkey_result getkey_simple(termkey_t *tk, termkey_key *key, int force)    }    else if(tk->flags & TERMKEY_FLAG_UTF8) {      // Some UTF-8 -    int nbytes; +    unsigned int nbytes;      long codepoint;      key->type = TERMKEY_TYPE_UNICODE; @@ -522,7 +522,7 @@ static termkey_result getkey_simple(termkey_t *tk, termkey_key *key, int force)        return TERMKEY_RES_KEY;      } -    for(int b = 1; b < nbytes; b++) { +    for(unsigned int b = 1; b < nbytes; b++) {        unsigned char cb = CHARAT(b);        if(cb < 0x80 || cb >= 0xc0) {          (*tk->method.emit_codepoint)(tk, UTF8_INVALID, key); @@ -769,7 +769,7 @@ void termkey_pushinput(termkey_t *tk, unsigned char *input, size_t inputlen)  termkey_result termkey_advisereadable(termkey_t *tk)  {    unsigned char buffer[64]; // Smaller than the default size -  size_t len = read(tk->fd, buffer, sizeof buffer); +  ssize_t len = read(tk->fd, buffer, sizeof buffer);    if(len == -1 && errno == EAGAIN)      return TERMKEY_RES_NONE; | 
