comparison gui/skin/skin.c @ 32843:084b39f800c7

Simplify input preparation (analogously to font.c).
author ib
date Sat, 19 Feb 2011 13:20:11 +0000
parents 01e248c1b369
children 002a3bf7ce85
comparison
equal deleted inserted replaced
32842:fe8f9b5d3ba2 32843:084b39f800c7
683 { 683 {
684 unsigned char tmp[255]; 684 unsigned char tmp[255];
685 unsigned char * ptmp; 685 unsigned char * ptmp;
686 unsigned char command[32]; 686 unsigned char command[32];
687 unsigned char param[256]; 687 unsigned char param[256];
688 int c,i; 688 int i;
689 689
690 setname( skinDirInHome,dname ); 690 setname( skinDirInHome,dname );
691 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) 691 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
692 { 692 {
693 setname( skinMPlayerDir,dname ); 693 setname( skinMPlayerDir,dname );
716 { 716 {
717 linenumber++; 717 linenumber++;
718 718
719 // remove any kind of newline, if any 719 // remove any kind of newline, if any
720 tmp[strcspn(tmp, "\n\r")] = 0; 720 tmp[strcspn(tmp, "\n\r")] = 0;
721 for ( c=0;c<(int)strlen( tmp );c++ ) 721 strswap( tmp,'\t',' ' );
722 if ( tmp[c] == ';' ) 722 trim( tmp );
723 { 723 ptmp = strchr(tmp, ';');
724 tmp[c]=0; 724 if (ptmp) *ptmp = 0;
725 break; 725 if (!*tmp) continue;
726 } 726 cutItem( tmp,command,'=',0 ); cutItem( tmp,param,'=',1 );
727 if ( strlen( tmp ) == 0 ) continue;
728 ptmp=trimleft( tmp );
729 if ( strlen( ptmp ) == 0 ) continue;
730 ptmp=strswap( ptmp,'\t',' ' );
731 ptmp=trim( ptmp );
732
733 cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 );
734 strlower( command ); 727 strlower( command );
735 for( i=0;i<ITEMS;i++ ) 728 for( i=0;i<ITEMS;i++ )
736 if ( !strcmp( command,skinItem[i].name ) ) 729 if ( !strcmp( command,skinItem[i].name ) )
737 if ( skinItem[i].func( param ) ) return -2; 730 if ( skinItem[i].func( param ) ) return -2;
738 } 731 }