[MPlayer-dev-eng] patch for font_load.c and AmigaOS

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Aug 10 14:14:11 CEST 2006


Hello,
On Thu, Aug 10, 2006 at 01:58:57PM +0200, Diego Biurrun wrote:
> On Thu, Aug 10, 2006 at 01:14:10PM +0200, Andrea Palmat? wrote:
> > Attached a patch to load fonts correctly under amiga platforms
> 
> This patch is ugly as heck.  Littering the code with #ifdef for specific
> operating systems (much less obscure ones) is not acceptable.  Rejected.

I agree. Maybe the attached patch is an acceptable compromise, though I
can't even test it.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libvo/font_load.c
===================================================================
--- libvo/font_load.c	(revision 19363)
+++ libvo/font_load.c	(working copy)
@@ -160,19 +160,26 @@
       }
   } else    
 
+#ifdef SYS_AMIGAOS4
+#define FONT_PATH_SEP ""
+#else
+//! path seperator for font paths, may not be more than one character
+#define FONT_PATH_SEP "/"
+#endif
+
   if(strcmp(section,"[files]")==0){
-      char *default_dir=MPLAYER_DATADIR "/font";
+      char *default_dir=MPLAYER_DATADIR FONT_PATH_SEP "font";
       if(pdb==2 && strcmp(p[0],"alpha")==0){
     	  char *cp;
 	  if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) goto fail_out;
 
-	  snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s",
+	  snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
 		desc->fpath,p[1]);
           if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
 		free(cp);
 		if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) 
 		   goto fail_out;
-		snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s",
+		snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
 			 default_dir,p[1]);
 		if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
 		   mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]);
@@ -187,13 +194,13 @@
     	  char *cp;
 	  if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) goto fail_out;
 
-	  snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s",
+	  snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
 		desc->fpath,p[1]);
           if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
 		free(cp);
 		if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) 
 		   goto fail_out;
-		snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s",
+		snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
 			 default_dir,p[1]);
 		if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
 		   mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]);


More information about the MPlayer-dev-eng mailing list