2
* Copyright (C) 2009,2010 Toni Gundogdu <legatvs@gmail.com>
2
* Copyright (C) 2009,2010,2011 Toni Gundogdu <legatvs@gmail.com>
4
4
* This library is free software; you can redistribute it and/or
5
5
* modify it under the terms of the GNU Lesser General Public
35
36
#include "curl_wrap.h"
39
char *freprintf(char **dst, const char *fmt, ...)
46
vasprintf(dst, fmt, args);
39
QUVIcode to_utf8(_quvi_video_t video)
53
QUVIcode to_utf8(_quvi_media_t video)
41
55
static const char to[] = "UTF-8";
42
56
size_t insize, avail, iconv_code;
69
81
cd = iconv_open(to, from);
71
83
/* If that fails, then without TRANSLIT. */
72
if (cd == (iconv_t) - 1) {
74
asprintf(&from, "%s", video->charset);
75
cd = iconv_open(to, from);
84
if (cd == (iconv_t) - 1)
87
asprintf(&from, "%s", video->charset);
88
cd = iconv_open(to, from);
78
if (cd == (iconv_t) - 1) {
80
seterr("conversion from %s to %s unavailable", from, to);
91
if (cd == (iconv_t) - 1)
95
freprintf(&video->quvi->errmsg,
96
"conversion from %s to %s unavailable", from, to);
82
100
#ifdef HAVE_STRERROR
83
seterr("iconv_open: %s", strerror(errno));
101
freprintf(&video->quvi->errmsg, "iconv_open: %s",
104
perror("iconv_open");
94
113
iconv_code = iconv(cd, &inptr, &insize, &wptr, &avail);
98
if (iconv_code == (size_t) - 1) {
99
seterr("converting characters from '%s' to '%s' failed", from, to);
103
setvid(video->title, "%s", outbuf);
117
if (iconv_code == (size_t) - 1)
119
freprintf(&video->quvi->errmsg,
120
"converting characters from '%s' to '%s' failed", from,
127
freprintf(&video->title, "%s", outbuf);
181
213
vasprintf((char **)&qvl->url, fmt, args);
189
222
return (llst_add(lst, qvl));
225
char *dirname_from(const char *s)
228
char *p = strdup(dirname(t));
233
/* vim: set ts=2 sw=2 tw=72 expandtab: */