top: utf8 utils should observe indentation conventions
Gosh, all this time we used indents of 4 spaces, not 3 spaces which were always the top standard indentation. [ and we made our 'utf8_embody' a little more robust ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
3afadf56e4
commit
474f4da5d1
@ -527,12 +527,14 @@ static int utf8_embody (const char *str, int width) {
|
|||||||
const unsigned char *p = (const unsigned char *)str;
|
const unsigned char *p = (const unsigned char *)str;
|
||||||
int clen, cnum = 0;
|
int clen, cnum = 0;
|
||||||
|
|
||||||
|
if (width > 0) {
|
||||||
while (*p) {
|
while (*p) {
|
||||||
// -1 represents a decoding error, pretend it's untranslated ...
|
// -1 represents a decoding error, pretend it's untranslated ...
|
||||||
if (0 > (clen = UTF8_tab[*p])) return width;
|
if (0 > (clen = UTF8_tab[*p])) return width;
|
||||||
p += clen;
|
p += clen;
|
||||||
if (++cnum >= width) break;
|
if (++cnum >= width) break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (int)((const char *)p - str);
|
return (int)((const char *)p - str);
|
||||||
} // end: utf8_embody
|
} // end: utf8_embody
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user