From 1efe9d9cd19aa77f57289f6b839107b3f91c9da4 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 29 Jan 2008 14:19:46 +0000 Subject: [PATCH] Don't treat whitespace as control chars. 2008-01-29 Alexander Larsson * gcontenttype.c (looks_like_text): Don't treat whitespace as control chars. svn path=/trunk/; revision=6414 --- gio/ChangeLog | 5 +++++ gio/gcontenttype.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index 762f7440c..3fc948f25 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,8 @@ +2008-01-29 Alexander Larsson + + * gcontenttype.c (looks_like_text): + Don't treat whitespace as control chars. + 2008-01-29 Alexander Larsson * gdesktopappinfo.c: diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c index 97eef6a01..a5cc41faf 100644 --- a/gio/gcontenttype.c +++ b/gio/gcontenttype.c @@ -671,9 +671,14 @@ static gboolean looks_like_text (const guchar *data, gsize data_size) { gsize i; + char c; + for (i = 0; i < data_size; i++) { - if g_ascii_iscntrl (data[i]) + c = data[i]; + + if (g_ascii_iscntrl (c) && + !g_ascii_isspace (c)) return FALSE; } return TRUE;