diff gui/skin/font.c @ 23703:9fb716ab06a3

Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy instead of plain strlcat/strlcpy
author reimar
date Thu, 05 Jul 2007 22:01:07 +0000
parents 17bf4f4b0715
children 10dfbc523184
line wrap: on
line diff
--- a/gui/skin/font.c	Thu Jul 05 10:18:58 2007 +0000
+++ b/gui/skin/font.c	Thu Jul 05 22:01:07 2007 +0000
@@ -10,6 +10,7 @@
 #include "font.h"
 #include "cut.h"
 #include "../mp_msg.h"
+#include "../libavutil/avstring.h"
 
 int items;
 
@@ -27,7 +28,7 @@
 
  if ( ( Fonts[id]=calloc( 1,sizeof( bmpFont ) ) ) == NULL ) return -1;
 
- strlcpy( Fonts[id]->name,name,128 ); // FIXME: as defined in font.h
+ av_strlcpy( Fonts[id]->name,name,128 ); // FIXME: as defined in font.h
  for ( i=0;i<256;i++ ) 
    Fonts[id]->Fnt[i].x=Fonts[id]->Fnt[i].y=Fonts[id]->Fnt[i].sx=Fonts[id]->Fnt[i].sy=-1;
 
@@ -60,8 +61,8 @@
  
  if ( id < 0 ) return id;
 
- strlcpy( tmp,path,sizeof( tmp ) );
- strlcat( tmp,fname,sizeof( tmp ) ); strlcat( tmp,".fnt",sizeof( tmp ) );
+ av_strlcpy( tmp,path,sizeof( tmp ) );
+ av_strlcat( tmp,fname,sizeof( tmp ) ); av_strlcat( tmp,".fnt",sizeof( tmp ) );
  if ( ( f=fopen( tmp,"rt" ) ) == NULL ) 
    { free( Fonts[id] ); return -3; }
    
@@ -94,7 +95,7 @@
      {
       if ( !strcmp( command,"image" ) )
        {
-        strlcpy( tmp,path,sizeof( tmp )  ); strlcat( tmp,param,sizeof( tmp ) );
+        av_strlcpy( tmp,path,sizeof( tmp )  ); av_strlcat( tmp,param,sizeof( tmp ) );
         mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] font imagefile: %s\n",tmp );
         if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) ) return -4;
        }