[BACK]Return to utf8.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/utf8.c between version 1.37 and 1.38

version 1.37, 2017/05/31 17:56:48 version 1.38, 2017/06/04 09:02:36
Line 207 
Line 207 
         return (len);          return (len);
 }  }
   
   /* Does this string contain anything that isn't valid UTF-8? */
   int
   utf8_isvalid(const char *s)
   {
           struct utf8_data         ud;
           const char              *end;
           enum utf8_state          more;
           size_t                   i;
   
           end = s + strlen(s);
           while (s < end) {
                   if ((more = utf8_open(&ud, *s)) == UTF8_MORE) {
                           while (++s < end && more == UTF8_MORE)
                                   more = utf8_append(&ud, *s);
                           if (more == UTF8_DONE)
                                   continue;
                           return (0);
                   }
                   if (*s < 0x20 || *s > 0x7e)
                           return (0);
                   s++;
           }
           return (1);
   }
   
 /*  /*
  * Sanitize a string, changing any UTF-8 characters to '_'. Caller should free   * Sanitize a string, changing any UTF-8 characters to '_'. Caller should free
  * the returned string. Anything not valid printable ASCII or UTF-8 is   * the returned string. Anything not valid printable ASCII or UTF-8 is

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38