comparison Gui/skin/skin.c @ 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 e93d0faac02b
children 0e1471d9da74
comparison
equal deleted inserted replaced
15582:61307ab84587 15583:7490b7904417
684 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn ); 684 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn );
685 685
686 appInitStruct( skinAppMPlayer ); 686 appInitStruct( skinAppMPlayer );
687 687
688 linenumber=0; 688 linenumber=0;
689 while ( !feof( skinFile ) ) 689 while (fgets(tmp, 255, skinFile))
690 { 690 {
691 if (!fgets( tmp,255,skinFile )) {
692 mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
693 return -1;
694 }
695 linenumber++; 691 linenumber++;
696 692
697 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; 693 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
698 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; 694 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
699 for ( c=0;c<(int)strlen( tmp );c++ ) 695 for ( c=0;c<(int)strlen( tmp );c++ )
712 strlower( command ); 708 strlower( command );
713 for( i=0;i<ITEMS;i++ ) 709 for( i=0;i<ITEMS;i++ )
714 if ( !strcmp( command,skinItem[i].name ) ) 710 if ( !strcmp( command,skinItem[i].name ) )
715 if ( skinItem[i].func( param ) ) return -2; 711 if ( skinItem[i].func( param ) ) return -2;
716 } 712 }
717 return 0; 713 if (linenumber == 0) {
718 } 714 mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
715 return -1;
716 }
717 return 0;
718 }