summarylogtreecommitdiffstats
path: root/0007-revert-posix-code.patch
blob: fa7c39eab16c18f20a160c05e009c85102fdb3d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--- lame-3.100/frontend/parse.c.orig	2017-10-15 11:49:51.389922000 +0200
+++ lame-3.100/frontend/parse.c	2017-10-15 11:56:02.377439500 +0200
@@ -70,8 +70,6 @@
 #ifdef HAVE_ICONV
 #include <iconv.h>
 #include <errno.h>
-#include <locale.h>
-#include <langinfo.h>
 #endif
 
 #if defined _ALLOW_INTERNAL_OPTIONS
@@ -153,7 +151,9 @@
     size_t n = 1;
     char dst[32];
     char* src = "A";
-    char* cur_code = nl_langinfo(CODESET);
+    char* env_lang = getenv("LANG");
+    char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+    char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
     iconv_t xiconv = iconv_open(cur_code, "ISO_8859-1");
     if (xiconv != (iconv_t)-1) {
         for (n = 0; n < 32; ++n) {
@@ -181,7 +181,9 @@
         size_t const n = l*4;
         dst = calloc(n+4, 4);
         if (dst != 0) {
-            char* cur_code = nl_langinfo(CODESET);
+            char* env_lang = getenv("LANG");
+            char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+            char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
             iconv_t xiconv = iconv_open(cur_code, "ISO_8859-1");
             if (xiconv != (iconv_t)-1) {
                 char* i_ptr = src;
@@ -205,7 +207,9 @@
         size_t const n = l*4;
         dst = calloc(n+4, 4);
         if (dst != 0) {
-            char* cur_code = nl_langinfo(CODESET);
+            char* env_lang = getenv("LANG");
+            char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+            char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
             iconv_t xiconv = iconv_open(cur_code, "UTF-16LE");
             if (xiconv != (iconv_t)-1) {
                 char* i_ptr = (char*)src;
@@ -231,7 +235,9 @@
         size_t const n = l*4;
         dst = calloc(n+4, 4);
         if (dst != 0) {
-            char* cur_code = nl_langinfo(CODESET);
+            char* env_lang = getenv("LANG");
+            char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+            char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
             iconv_t xiconv = iconv_open("ISO_8859-1//TRANSLIT", cur_code);
             if (xiconv != (iconv_t)-1) {
                 char* i_ptr = (char*)src;
@@ -257,7 +263,9 @@
         size_t const n = (l+1)*4;
         dst = calloc(n+4, 4);
         if (dst != 0) {
-            char* cur_code = nl_langinfo(CODESET);
+            char* env_lang = getenv("LANG");
+            char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+            char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
             iconv_t xiconv = iconv_open("UTF-16LE//TRANSLIT", cur_code);
             dst[0] = 0xff;
             dst[1] = 0xfe;
@@ -1513,9 +1521,6 @@
     enum TextEncoding id3_tenc = TENC_LATIN1;
 #endif
 
-#ifdef HAVE_ICONV
-    setlocale(LC_CTYPE, "");
-#endif
     inPath[0] = '\0';
     outPath[0] = '\0';
     /* turn on display options. user settings may turn them off below */