Changeset 4f32396e885b5e7074039c426cae5c466cc55ca1

Show
Ignore:
Timestamp:
19/09/07 21:04:03 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1190228643 +0000
git-parent:

[c67038de4e45078828681eaa12b0312e58e88c4c]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1190228643 +0000
Message:

Avoid setlocale - not thread-safe

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/text/wincp.c

    r9ad201e r4f32396  
    5656    if ((locale == NULL) || (strlen (locale) < 2) 
    5757     || !strcasecmp (locale, "POSIX")) 
    58         return "ASCII"; 
     58        return "CP1252"; /* Yeah, this is totally western-biased */ 
    5959 
    6060 
     
    194194    const char *psz_lang; 
    195195 
    196     /* Some systems (like Darwin, SunOS 4 or DJGPP) have only the C locale. 
    197      * Therefore we don't use setlocale here; it would return "C". */ 
    198 #  if defined (HAVE_SETLOCALE) && !defined ( __APPLE__) 
    199     psz_lang = setlocale (LC_ALL, NULL); 
    200     if (psz_lang == NULL) 
    201 #  endif 
     196    psz_lang = getenv ("LC_ALL"); 
     197    if ((psz_lang == NULL) || !*psz_lang) 
    202198    { 
    203         psz_lang = getenv ("LC_ALL"); 
     199        psz_lang = getenv ("LC_CTYPE"); 
    204200        if ((psz_lang == NULL) || !*psz_lang) 
    205         { 
    206             psz_lang = getenv ("LC_CTYPE"); 
    207             if ((psz_lang == NULL)) 
    208                 psz_lang = getenv ("LANG"); 
    209         } 
     201            psz_lang = getenv ("LANG"); 
    210202    } 
    211203