[easytag/wip/core-refactoring: 11/11] Remove setlocale() calls around tag reading



commit d272b0bf3765ce4a7dd3efd9b53b697b31b3afbb
Author: David King <amigadave amigadave com>
Date:   Thu Feb 18 20:44:14 2016 +0000

    Remove setlocale() calls around tag reading
    
    It is unsafe to call setlocale() in a multi-threaded program (and EasyTAG is,
    because GLib creates a worker thread for handling D-Bus calls). Additionally,
    it is no longer necessary to change the locale when reading files, as all
    locale-sensitive tag reading code has been converted to be insensitive to the
    current locale.

 src/file_list.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
---
diff --git a/src/file_list.c b/src/file_list.c
index fb8aed3..e2b124b 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -210,7 +210,6 @@ et_file_list_add (GList *file_list,
     GFileInfo *fileinfo;
     gchar *filename;
     gchar *display_path;
-    const gchar  *locale_lc_ctype = getenv("LC_CTYPE");
     GError *error = NULL;
     gboolean success;
 
@@ -236,12 +235,6 @@ et_file_list_add (GList *file_list,
     FileTag = et_file_tag_new ();
     FileTag->saved = TRUE;    /* The file hasn't been changed, so it's saved */
 
-    /* Patch from Doruk Fisek and Onur Kucuk: avoid upper/lower conversion bugs
-     * (like I->i conversion in some locales) in tag parsing. The problem occurs
-     * for example with Turkish language where it can't read 'TITLE=' field if
-     * it is written as 'Title=' in the file */
-    setlocale(LC_CTYPE, "C");
-
     switch (description->TagType)
     {
 #ifdef ENABLE_MP3
@@ -444,9 +437,6 @@ et_file_list_add (GList *file_list,
         g_error_free (error);
     }
 
-    /* Restore previous value */
-    setlocale(LC_CTYPE, locale_lc_ctype ? locale_lc_ctype : "");
-
     /* Store the modification time of the file to check if the file was changed
      * before saving */
     fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED,


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