changeset 15583:7490b7904417

last patch broke skin reading completely, becasue last line of skin file is empty. Fix and simplify, since fgets can do feof's job, too...
author reimar
date Sat, 28 May 2005 21:12:11 +0000
parents 61307ab84587
children b5f111039c16
files Gui/skin/skin.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/skin/skin.c	Sat May 28 20:41:58 2005 +0000
+++ b/Gui/skin/skin.c	Sat May 28 21:12:11 2005 +0000
@@ -686,12 +686,8 @@
  appInitStruct( skinAppMPlayer );
 
  linenumber=0;
- while ( !feof( skinFile ) )
+ while (fgets(tmp, 255, skinFile))
   {
-   if (!fgets( tmp,255,skinFile )) {
-     mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
-     return -1;
-   }
    linenumber++;
 
    c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
@@ -714,5 +710,9 @@
     if ( !strcmp( command,skinItem[i].name ) )
      if ( skinItem[i].func( param ) ) return -2;
   }
+ if (linenumber == 0) {
+   mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
+   return -1;
+ }
  return 0;
 }