[MPlayer-cvslog] r32926 - trunk/gui/skin/font.c

ib subversion at mplayerhq.hu
Fri Feb 18 21:16:36 CET 2011


Author: ib
Date: Fri Feb 18 21:16:36 2011
New Revision: 32926

Log:
Cosmetic: Make conditions more readable by having assignments outside.

Modified:
   trunk/gui/skin/font.c

Modified: trunk/gui/skin/font.c
==============================================================================
--- trunk/gui/skin/font.c	Fri Feb 18 11:38:39 2011	(r32925)
+++ trunk/gui/skin/font.c	Fri Feb 18 21:16:36 2011	(r32926)
@@ -38,7 +38,9 @@ int fntAddNewFont( char * name )
 
  if ( id == MAX_FONTS ) return -2;
 
- if ( !( Fonts[id]=calloc( 1,sizeof( *Fonts[id] ) ) ) ) return -1;
+ Fonts[id]=calloc( 1,sizeof( *Fonts[id] ) );
+
+ if ( !Fonts[id] ) return -1;
 
  av_strlcpy( Fonts[id]->name,name,MAX_FONT_NAME );
  for ( i=0;i<ASCII_CHRS+EXTRA_CHRS;i++ )
@@ -69,11 +71,16 @@ int fntRead( char * path,char * fname )
  unsigned char   param[256];
  int             id, n;
 
- if ( ( id = fntAddNewFont( fname ) ) < 0 ) return id;
+ id = fntAddNewFont( fname );
+
+ if ( id < 0 ) return id;
 
  av_strlcpy( tmp,path,sizeof( tmp ) );
  av_strlcat( tmp,fname,sizeof( tmp ) ); av_strlcat( tmp,".fnt",sizeof( tmp ) );
- if ( !( f=fopen( tmp,"rt" ) ) )
+
+ f=fopen( tmp,"rt" );
+
+ if ( !f )
   {
    gfree( (void **) &Fonts[id] );
    return -3;
@@ -85,7 +92,8 @@ int fntRead( char * path,char * fname )
    tmp[strcspn(tmp, "\n\r")] = 0;
    strswap( tmp,'\t',' ' );
    trim( tmp );
-   if ((ptmp = strchr(tmp, ';')) && !(ptmp == tmp + 1 && tmp[0] == '"' && tmp[2] == '"')) *ptmp = '\0';
+   ptmp = strchr(tmp, ';');
+   if (ptmp && !(ptmp == tmp + 1 && tmp[0] == '"' && tmp[2] == '"')) *ptmp = '\0';
    if (!*tmp) continue;
    n = (strncmp(tmp, "\"=", 2) == 0 ? 1 : 0);
    cutItem( tmp,command,'=',n ); cutItem( tmp,param,'=',n+1 );


More information about the MPlayer-cvslog mailing list