[nautilus] file-operations: replace control characters for FAT fs operations



commit 8ff0bf18f9db9ec328b6c0c460ca2d9c462ddbdd
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Aug 16 18:32:50 2013 +0200

    file-operations: replace control characters for FAT fs operations
    
    Those are invalid - if we find one, replace it with an underscore as
    well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706131

 libnautilus-private/nautilus-file-operations.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 7002d88..fccccf6 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -3080,16 +3080,16 @@ get_max_name_length (GFile *file_dir)
 #define FAT_FORBIDDEN_CHARACTERS "/:;*?\"<>"
 
 static gboolean
-str_replace (char *str,
-            const char *chars_to_replace,
-            char replacement)
+fat_str_replace (char *str,
+                char replacement)
 {
        gboolean success;
        int i;
 
        success = FALSE;
        for (i = 0; str[i] != '\0'; i++) {
-               if (strchr (chars_to_replace, str[i])) {
+               if (strchr (FAT_FORBIDDEN_CHARACTERS, str[i]) ||
+                   str[i] < 32) {
                        success = TRUE;
                        str[i] = replacement;
                }
@@ -3110,7 +3110,7 @@ make_file_name_valid_for_dest_fs (char *filename,
                        gboolean ret;
                        int i, old_len;
 
-                       ret = str_replace (filename, FAT_FORBIDDEN_CHARACTERS, '_');
+                       ret = fat_str_replace (filename, '_');
 
                        old_len = strlen (filename);
                        for (i = 0; i < old_len; i++) {


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