[Mplayer-cvslog] CVS: main subreader.c,1.17,1.18
Megyer Laszlo
laaz at users.sourceforge.net
Fri Jun 1 23:06:38 CEST 2001
Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv2890
Modified Files:
subreader.c
Log Message:
Gabucino (CGA user)'s request (finds default.subs well)
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** subreader.c 2001/06/01 20:05:12 1.17
--- subreader.c 2001/06/01 21:06:36 1.18
***************
*** 419,422 ****
--- 419,423 ----
char * sub_name1;
char * sub_name2;
+ char * aviptr1, * aviptr2, * tmp;
int i,j;
FILE * f;
***************
*** 434,437 ****
--- 435,439 ----
".TXT"};
+
if ( fname == NULL ) return NULL;
***************
*** 439,453 ****
if (!sub_name1) return NULL;
pos=sub_name1-fname;
! sub_name1=malloc(strlen(path)+strlen(fname)+8);
! strcpy(sub_name1,path);
! sub_name2=sub_name1+strlen(path);
! strncpy(sub_name2,fname,pos);
for(j=0;j<=1;j++){
char* sub_name=j?sub_name1:sub_name2;
for ( i=0;i<(sizeof(sub_exts)/sizeof(char*));i++ ) {
! strcpy(sub_name2+pos,sub_exts[i]);
! // printf("trying: '%s'\n",sub_name);
if((f=fopen( sub_name,"rt" ))) {
fclose( f );
--- 441,462 ----
if (!sub_name1) return NULL;
pos=sub_name1-fname;
+
+ sub_name1=malloc(strlen(fname)+8);
+ strcpy(sub_name1,fname);
+
+ sub_name2=malloc (strlen(path) + strlen(fname) + 8);
+ if (tmp=strrchr(fname,'/'))
+ sprintf (sub_name2, "%s%s", path, tmp+1);
+ else
+ sprintf (sub_name2, "%s%s", path, fname);
! aviptr1=strrchr(sub_name1,'.');
! aviptr2=strrchr(sub_name2,'.');
for(j=0;j<=1;j++){
char* sub_name=j?sub_name1:sub_name2;
for ( i=0;i<(sizeof(sub_exts)/sizeof(char*));i++ ) {
! strcpy(j?aviptr1:aviptr2,sub_exts[i]);
! printf("trying: '%s'\n",sub_name);
if((f=fopen( sub_name,"rt" ))) {
fclose( f );
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
More information about the MPlayer-cvslog
mailing list