[Mplayer-cvslog] CVS: main subreader.c,1.110,1.111
Adam Tla/lka CVS
atlka at mplayerhq.hu
Tue Jul 1 10:49:35 CEST 2003
Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv22049
Modified Files:
subreader.c
Log Message:
sub_utf8 fiddling
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- subreader.c 1 Jul 2003 07:16:39 -0000 1.110
+++ subreader.c 1 Jul 2003 08:49:14 -0000 1.111
@@ -930,12 +930,11 @@
extern float sub_fps;
#ifdef USE_ICONV
-static iconv_t icdsc;
+static iconv_t icdsc = (iconv_t)(-1);
void subcp_open (void)
{
char *tocp = "UTF-8";
- icdsc = (iconv_t)(-1);
if (sub_cp){
if ((icdsc = iconv_open (tocp, sub_cp)) != (iconv_t)(-1)){
@@ -1178,23 +1177,31 @@
#ifdef USE_ICONV
sub_utf8_prev=sub_utf8;
{
- int l;
+ int l,k;
+ k = -1;
if ((l=strlen(filename))>4){
int k;
char *exts[] = {".utf", ".utf8", ".utf-8" };
for (k=3;--k>=0;)
if (!strcasecmp(filename+(l - strlen(exts[k])), exts[k])){
sub_utf8 = 1;
+ fprintf(stderr,"UTF-8 detected\n");
break;
}
}
+ if (k<0) subcp_open();
}
- if (!(sub_utf8 & 1)) subcp_open();
#endif
sub_num=0;n_max=32;
first=(subtitle *)malloc(n_max*sizeof(subtitle));
- if(!first) return NULL;
+ if(!first){
+#ifdef USE_ICONV
+ subcp_close();
+ sub_utf8=sub_utf8_prev;
+#endif
+ return NULL;
+ }
#ifdef USE_SORTSUB
sub = (subtitle *)malloc(sizeof(subtitle));
@@ -1223,7 +1230,6 @@
{
#ifdef USE_ICONV
subcp_close();
- sub_utf8=sub_utf8_prev;
#endif
if ( first ) free(first);
return NULL;
More information about the MPlayer-cvslog
mailing list