Mercurial > mplayer.hg
annotate gui/skin/cut.c @ 31325:e45b8fb721fd
Move wsSearch function and make it static.
author | reimar |
---|---|
date | Sun, 13 Jun 2010 18:25:26 +0000 |
parents | 32725ca88fed |
children | b34b8e47a844 |
rev | line source |
---|---|
26458 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
23077 | 18 |
19 #include <string.h> | |
20 #include <stdlib.h> | |
21 | |
30529 | 22 #include "cut.h" |
23 | |
23077 | 24 void cutItem( char * in,char * out,char sep,int num ) |
25 { | |
26 int i,n,c; | |
27 for ( c=0,n=0,i=0;i<strlen( in );i++ ) | |
28 { | |
29 if ( in[i] == sep ) n++; | |
30 if ( n >= num && in[i] != sep ) out[c++]=in[i]; | |
31 if ( n >= num && in[i+1] == sep ) { out[c]=0; return; } | |
32 } | |
33 out[c]=0; | |
34 } | |
35 | |
36 int cutItemToInt( char * in,char sep,int num ) | |
37 { | |
38 char tmp[512]; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26458
diff
changeset
|
39 cutItem( in,tmp,sep,num ); |
23077 | 40 return atoi( tmp ); |
41 } | |
42 | |
43 float cutItemToFloat( char * in,char sep,int num ) | |
44 { | |
45 char tmp[512]; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26458
diff
changeset
|
46 cutItem( in,tmp,sep,num ); |
23077 | 47 return atof( tmp ); |
48 } | |
49 | |
50 void cutChunk( char * in,char * s1 ) | |
51 { | |
52 cutItem( in,s1,'=',0 ); | |
53 memmove( in,strchr( in,'=' )+1,strlen( in ) - strlen( s1 ) ); | |
54 } |