[glib/glib-2-22] Bug 598712 - can't detect text file with backspace



commit 8a190a155c57de6fc0330ff0b25b91579a4be215
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Nov 20 12:54:35 2009 -0600

    Bug 598712 - can't detect text file with backspace
    
    looks_like_text(): Allow '\b' to appear in text files.
    (cherry picked from commit 48e2a570439373882cf755567e1d147bc5dd50e5)

 gio/gcontenttype.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c
index 3c7b16f..0a95e5b 100644
--- a/gio/gcontenttype.c
+++ b/gio/gcontenttype.c
@@ -295,7 +295,7 @@ looks_like_text (const guchar *data,
   for (i = 0; i < data_size; i++)
     {
       c = data[i];
-      if (g_ascii_iscntrl (c) && !g_ascii_isspace (c))
+      if (g_ascii_iscntrl (c) && !g_ascii_isspace (c) && c != '\b')
 	return FALSE;
     }
   return TRUE;
@@ -832,7 +832,8 @@ looks_like_text (const guchar *data, gsize data_size)
       c = data[i];
       
       if (g_ascii_iscntrl (c) &&
-	  !g_ascii_isspace (c))
+	  !g_ascii_isspace (c) &&
+	  c != '\b')
 	return FALSE;
     }
   return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]