Thread (72 messages) flat view 72 messages, 20 authors, 2016-06-15
STALE3710d

[PATCH 07/12] Fixed text file auto-detection: treat EOF character 032 at the end of file as printable

From: Steffen Prohaska <hidden>
Date: 2016-06-15 22:44:52
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

From: Dmitry Kakurin <redacted>

Signed-off-by: Dmitry Kakurin <redacted>
Signed-off-by: Steffen Prohaska <redacted>
---
 convert.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/convert.c b/convert.c
index 1c66844..f24ac25 100644
--- a/convert.c
+++ b/convert.c
@@ -61,6 +61,10 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
 		else
 			stats->printable++;
 	}
+
+	// If file ends with EOF then don't count this EOF as non-printable
+	if ( size >= 1 && buf[size-1] == '\032' )
+		stats->nonprintable--;
 }
 
 /*
-- 
1.5.6.1.255.g32571
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help