tweaks: adjust whitespace and comments after the preceding change

master
Benno Schulenberg 2017-05-05 21:52:32 +02:00
parent a9abc3d95f
commit f5155786e1
1 changed files with 24 additions and 24 deletions

View File

@ -376,34 +376,34 @@ size_t move_mbleft(const char *buf, size_t pos)
{ {
#ifdef ENABLE_UTF8 #ifdef ENABLE_UTF8
if (use_utf8) { if (use_utf8) {
size_t before, char_len = 0; size_t before, char_len = 0;
/* There is no library function to move backward one multibyte if (pos < 4)
* character. So we just start groping for one at the farthest before = 0;
* possible point. */ else {
if (pos < 4) const char *ptr = buf + pos;
before = 0;
else {
const char *ptr = buf + pos;
if ((signed char)*(--ptr) > -65) /* Probe for a valid starter byte in the preceding four bytes. */
before = pos - 1; if ((signed char)*(--ptr) > -65)
else if ((signed char)*(--ptr) > -65) before = pos - 1;
before = pos - 2; else if ((signed char)*(--ptr) > -65)
else if ((signed char)*(--ptr) > -65) before = pos - 2;
before = pos - 3; else if ((signed char)*(--ptr) > -65)
else if ((signed char)*(--ptr) > -65) before = pos - 3;
before = pos - 4; else if ((signed char)*(--ptr) > -65)
else before = pos - 4;
before = pos - 1; else
} before = pos - 1;
}
while (before < pos) { /* Move forward again until we reach the original character,
char_len = parse_mbchar(buf + before, NULL, NULL); * so we know the length of its preceding the character. */
before += char_len; while (before < pos) {
} char_len = parse_mbchar(buf + before, NULL, NULL);
before += char_len;
}
return before - char_len; return before - char_len;
} else } else
#endif #endif
return (pos == 0 ? 0 : pos - 1); return (pos == 0 ? 0 : pos - 1);