Remove (more or less) unused character conversion functions.

We're true UTF-8 now.
This commit is contained in:
Andreas Öman 2008-10-14 18:56:15 +00:00
parent 447486883a
commit 448d945fdd
3 changed files with 1 additions and 70 deletions

View file

@ -132,7 +132,7 @@ channel_set_name(channel_t *ch, const char *name)
l = strlen(name);
ch->ch_sname = cp = malloc(l + 1);
n2 = utf8toprintable(name);
n2 = strdup(name);
for(i = 0; i < strlen(n2); i++) {
c = tolower(n2[i]);

67
main.c
View file

@ -341,73 +341,6 @@ main(int argc, char **argv)
}
static char *
convert_to(const char *in, const char *target_encoding)
{
iconv_t ic;
size_t inlen, outlen, alloced, pos;
char *out, *start;
int r;
inlen = strlen(in);
alloced = 100;
outlen = alloced;
ic = iconv_open(target_encoding, "UTF8");
if(ic == NULL)
return NULL;
out = start = malloc(alloced + 1);
while(inlen > 0) {
r = iconv(ic, (char **)&in, &inlen, &out, &outlen);
if(r == (size_t) -1) {
if(errno == EILSEQ) {
in++;
inlen--;
continue;
}
if(errno == E2BIG) {
pos = alloced - outlen;
alloced *= 2;
start = realloc(start, alloced + 1);
out = start + pos;
outlen = alloced - pos;
continue;
}
break;
}
}
iconv_close(ic);
pos = alloced - outlen;
start[pos] = 0;
return start;
}
char *
utf8toprintable(const char *in)
{
return convert_to(in, "ISO_8859-1");
}
char *
utf8tofilename(const char *in)
{
return convert_to(in, "LATIN1");
}
/**
*
*/

View file

@ -832,8 +832,6 @@ typedef struct th_muxstream {
#endif
char *utf8toprintable(const char *in);
char *utf8tofilename(const char *in);
const char *streaming_component_type2txt(streaming_component_type_t s);
static inline unsigned int tvh_strhash(const char *s, unsigned int mod)