mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 14:39:10 +00:00
Fix the initial line
This commit is contained in:
parent
19bee769d4
commit
b74d4478df
@ -261,35 +261,30 @@ bool git_buf_text_gather_stats(
|
||||
/* Counting loop */
|
||||
while (scan < end) {
|
||||
unsigned char c = *scan++;
|
||||
if (c == '\r') {
|
||||
|
||||
if (c > 0x1F && c != 0x7F)
|
||||
stats->printable++;
|
||||
else switch (c) {
|
||||
case '\0':
|
||||
stats->nul++;
|
||||
stats->nonprintable++;
|
||||
break;
|
||||
case '\n':
|
||||
stats->lf++;
|
||||
break;
|
||||
case '\r':
|
||||
stats->cr++;
|
||||
if (scan < end && *scan == '\n')
|
||||
stats->crlf++;
|
||||
continue;
|
||||
}
|
||||
if (c == '\n') {
|
||||
stats->lf++;
|
||||
continue;
|
||||
}
|
||||
if (c == 127)
|
||||
/* DEL */
|
||||
stats->nonprintable++;
|
||||
else if (c < 32) {
|
||||
switch (c) {
|
||||
/* BS, HT, ESC and FF */
|
||||
case '\b': case '\t': case '\033': case '\014':
|
||||
break;
|
||||
case '\t': case '\f': case '\v': case '\b': case 0x1b: /*ESC*/
|
||||
stats->printable++;
|
||||
break;
|
||||
case 0:
|
||||
stats->nul++;
|
||||
/* fall through */
|
||||
default:
|
||||
stats->nonprintable++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
stats->printable++;
|
||||
}
|
||||
|
||||
return (stats->nul > 0 ||
|
||||
((stats->printable >> 7) < stats->nonprintable));
|
||||
|
Loading…
Reference in New Issue
Block a user