link against libnotimpl for ceilf (fix #5)
[openwrt.git] / openwrt / package / gmediaserver / patches / no_iconv.patch
1 diff -ruN gmediaserver-0.8.0-old/src/main.c gmediaserver-0.8.0-new/src/main.c
2 --- gmediaserver-0.8.0-old/src/main.c 2005-09-10 09:26:00.000000000 +0200
3 +++ gmediaserver-0.8.0-new/src/main.c 2005-09-17 20:48:01.000000000 +0200
4 @@ -32,8 +32,10 @@
5 #include <stdbool.h> /* Gnulib, C99 */
6 #include <signal.h> /* ? */
7 #include <locale.h> /* ? */
8 +#ifdef HAVE_ICONV
9 #include <iconv.h> /* Gnulib, POSIX */
10 #include "iconvme.h" /* Gnulib */
11 +#endif
12 #ifdef HAVE_NL_LANGINFO
13 #include <langinfo.h>
14 #endif
15 @@ -71,8 +73,10 @@
16 #ifdef HAVE_ID3LIB
17 { "disable-id3", no_argument, NULL, OPT_DISABLE_ID3 },
18 #endif
19 +#ifdef HAVE_ICONV
20 { "in-charset", required_argument, NULL, OPT_IN_CHARSET },
21 { "device-charset", required_argument, NULL, OPT_DEVICE_CHARSET },
22 +#endif
23 { "friendly-name", required_argument, NULL, OPT_FRIENDLY_NAME },
24 { "pid-file", required_argument, NULL, OPT_PIDFILE },
25 { "profile", required_argument, NULL, OPT_PROFILE, },
26 @@ -90,15 +94,21 @@
27 { NULL, 0, NULL, 0 }
28 };
29
30 +#ifdef HAVE_ICONV
31 iconv_t charset_convert = (iconv_t) -1;
32 +#endif
33 const char version_etc_copyright[] = "Copyright (C) 2005 Oskar Liljeblad.";
34
35 char *
36 convert_string(const char *str)
37 {
38 +#ifdef HAVE_ICONV
39 if (charset_convert == (iconv_t) -1)
40 return xstrdup(str);
41 return iconv_alloc(charset_convert, str);
42 +#else
43 + return xstrdup(str);
44 +#endif
45 }
46
47 static void
48 @@ -140,13 +150,17 @@
49 char *logfilename = NULL;
50 char *timestamp_format = NULL;
51 uint32_t expire_time;
52 +#ifdef HAVE_ICONV
53 char *in_charset = NULL;
54 char *device_charset = NULL;
55 +#endif
56
57 set_program_name(argv[0]);
58
59 +#ifdef LOCALE
60 if (setlocale(LC_ALL, "") == NULL)
61 warn(_("cannot set locale: %s\n"), errstr);
62 +#endif
63 #ifdef ENABLE_NLS
64 if (bindtextdomain(PACKAGE, LOCALEDIR) == NULL)
65 warn(_("cannot bind message domain: %s\n"), errstr);
66 @@ -174,12 +188,14 @@
67 id3_enabled = false;
68 break;
69 #endif
70 +#ifdef HAVE_ICONV
71 case OPT_IN_CHARSET:
72 in_charset = optarg;
73 break;
74 case OPT_DEVICE_CHARSET:
75 device_charset = optarg;
76 break;
77 +#endif
78 case OPT_FRIENDLY_NAME:
79 if (optarg[0] == '\0')
80 die(_("friendly name cannot be empty\n"));
81 @@ -320,6 +336,7 @@
82
83 init_logging(logfilename, timestamp_format);
84
85 +#ifdef HAVE_ICONV
86 if (device_charset != NULL) {
87 if (in_charset == NULL) {
88 #ifdef HAVE_NL_LANGINFO
89 @@ -336,6 +353,7 @@
90 if (charset_convert == (iconv_t) -1)
91 die(_("cannot create character set convertor\nTry using another value for --in-charset or --device-charset\n"));
92 }
93 +#endif
94
95 /* We could write pid before initiating logging too.
96 */
97 @@ -409,8 +427,10 @@
98 if (pidfilename != NULL)
99 unlink(pidfilename); /* ignore errors */
100
101 +#ifdef HAVE_ICONV
102 if (charset_convert != (iconv_t) -1)
103 iconv_close(charset_convert); /* ignore errors (only EINVAL) */
104 +#endif
105
106 finish_logging(true);
107
This page took 0.054865 seconds and 5 git commands to generate.