[Mplayer-cvslog] CVS: main/TOOLS/subfont-c subfont.c,1.5,1.6

Arpi of Ize arpi at mplayer.dev.hu
Mon Aug 13 20:39:25 CEST 2001


Update of /cvsroot/mplayer/main/TOOLS/subfont-c
In directory mplayer:/var/tmp.root/cvs-serv10473

Modified Files:
	subfont.c 
Log Message:
return value of iconv fixed for glibc 2.1.3, using strrchr instead of basename, as basename is buggy

Index: subfont.c
===================================================================
RCS file: /cvsroot/mplayer/main/TOOLS/subfont-c/subfont.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- subfont.c	13 Aug 2001 18:37:10 -0000	1.5
+++ subfont.c	13 Aug 2001 18:39:23 -0000	1.6
@@ -61,6 +61,7 @@
 
 ////
 char		*command;
+char		*encoding_name;
 char		*font_path;
 //char		*font_metrics;
 int		append_mode = 0;
@@ -117,14 +118,14 @@
     int const max_name = 128;
     char name[max_name];
 
-    snprintf(name, max_name, "%s-b.raw", encoding);
+    snprintf(name, max_name, "%s-b.raw", encoding_name);
     f = fopen(name, "wb");
     if (f==NULL) ERROR("fopen failed.");
     write_header(f);
     fwrite(buffer, 1, width*height, f);
     fclose(f);
 
-    snprintf(name, max_name, "%s-a.raw", encoding);
+    snprintf(name, max_name, "%s-a.raw", encoding_name);
     f = fopen(name, "wb");
     if (f==NULL) ERROR("fopen failed.");
     write_header(f);
@@ -233,7 +234,7 @@
     /* print font.desc header */
     if (append_mode) {
 	fprintf(f, "\n\n# Subtitle font for %s encoding, face \"%s%s%s\", ppem=%i\n",
-		encoding,
+		encoding_name,
 		face->family_name,
 		face->style_name ? " ":"", face->style_name ? face->style_name:"",
 		ppem);
@@ -241,7 +242,7 @@
 	fprintf(f, "# This file was generated with subfont for Mplayer.\n# Subfont by Artur Zaprzala <zybi at fanthom.irc.pl>.\n\n");
 	fprintf(f, "[info]\n");
 	fprintf(f, "name 'Subtitle font for %s encoding, face \"%s%s%s\", ppem=%i'\n",
-		encoding,
+		encoding_name,
 		face->family_name,
 		face->style_name ? " ":"", face->style_name ? face->style_name:"",
 		ppem);
@@ -251,8 +252,8 @@
 	fprintf(f, "height %i\n",		f266toInt(face->size->metrics.height));
     }
     fprintf(f, "\n[files]\n");
-    fprintf(f, "alpha %s-a.raw\n",	encoding);
-    fprintf(f, "bitmap %s-b.raw\n",	encoding);
+    fprintf(f, "alpha %s-a.raw\n",	encoding_name);
+    fprintf(f, "bitmap %s-b.raw\n",	encoding_name);
     fprintf(f, "\n[characters]\n");
 
 
@@ -377,7 +378,8 @@
     int outbytesleft = sizeof(FT_ULong);
 
     size_t count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
-    if (count==-1) o = 0;
+//    if (count==-1) o = 0; // not OK, at least my iconv() returns E2BIG for all
+    if (outbytesleft!=0) o = 0;
 
     /* convert unicode BE -> LE */
     o = ((o>>24)&0xff)
@@ -435,7 +437,7 @@
 	    ++charset_size;
 	}
 	fclose(f);
-	encoding = basename(encoding);
+//	encoding = basename(encoding);
     }
     if (charset_size==0) ERROR("No characters to render!");
 }
@@ -661,6 +663,10 @@
 
     if (argv[a][0]!=0)
 	encoding = argv[a];
+    encoding_name = strrchr(encoding, '/');
+    if (!encoding_name) encoding_name=encoding;
+    else ++encoding_name;
+    
     ++a; --argc;
 
     i = atoi(argv[a]);




More information about the MPlayer-cvslog mailing list