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,34 +261,29 @@ bool git_buf_text_gather_stats(
|
|||||||
/* Counting loop */
|
/* Counting loop */
|
||||||
while (scan < end) {
|
while (scan < end) {
|
||||||
unsigned char c = *scan++;
|
unsigned char c = *scan++;
|
||||||
if (c == '\r') {
|
|
||||||
stats->cr++;
|
if (c > 0x1F && c != 0x7F)
|
||||||
if (scan < end && *scan == '\n')
|
stats->printable++;
|
||||||
stats->crlf++;
|
else switch (c) {
|
||||||
continue;
|
case '\0':
|
||||||
}
|
stats->nul++;
|
||||||
if (c == '\n') {
|
stats->nonprintable++;
|
||||||
stats->lf++;
|
break;
|
||||||
continue;
|
case '\n':
|
||||||
}
|
stats->lf++;
|
||||||
if (c == 127)
|
break;
|
||||||
/* DEL */
|
case '\r':
|
||||||
stats->nonprintable++;
|
stats->cr++;
|
||||||
else if (c < 32) {
|
if (scan < end && *scan == '\n')
|
||||||
switch (c) {
|
stats->crlf++;
|
||||||
/* BS, HT, ESC and FF */
|
break;
|
||||||
case '\b': case '\t': case '\033': case '\014':
|
case '\t': case '\f': case '\v': case '\b': case 0x1b: /*ESC*/
|
||||||
stats->printable++;
|
stats->printable++;
|
||||||
break;
|
break;
|
||||||
case 0:
|
|
||||||
stats->nul++;
|
|
||||||
/* fall through */
|
|
||||||
default:
|
default:
|
||||||
stats->nonprintable++;
|
stats->nonprintable++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
stats->printable++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (stats->nul > 0 ||
|
return (stats->nul > 0 ||
|
||||||
|
Loading…
Reference in New Issue
Block a user