Fixed text file auto-detection: treat EOF character 032 at the end of file as printable
Signed-off-by: Dmitry Kakurin <Dmitry.Kakurin@gmail.com> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dmitry Kakurin committed
Jul 11, 2008 at 18:48 UTC
f9dd4bf4e58af0b4828c7e7013080dba59f8a6b9
1 file changed
+4
convert.c
+4
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
61
else
62
stats->printable++;
63
}
64
+
65
+ /* If file ends with EOF then don't count this EOF as non-printable. */
66
+ if (size >= 1 && buf[size-1] == '\032')
67
+ stats->nonprintable--;
68
}
69
70
/*