Mercurial > mplayer.hg
comparison mplayer.c @ 18857:0ba653cbc29f
more sizeof(char) fun
author | reynaldo |
---|---|
date | Fri, 30 Jun 2006 04:09:29 +0000 |
parents | ab94d003023d |
children | ab29b3c4f94e |
comparison
equal
deleted
inserted
replaced
18856:8f3099900d8c | 18857:0ba653cbc29f |
---|---|
2991 vo_vobsub=vobsub_open(vobsub_name,spudec_ifo,1,&vo_spudec); | 2991 vo_vobsub=vobsub_open(vobsub_name,spudec_ifo,1,&vo_spudec); |
2992 if(vo_vobsub==NULL) | 2992 if(vo_vobsub==NULL) |
2993 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,vobsub_name); | 2993 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,vobsub_name); |
2994 }else if(sub_auto && filename && (strlen(filename)>=5)){ | 2994 }else if(sub_auto && filename && (strlen(filename)>=5)){ |
2995 /* try to autodetect vobsub from movie filename ::atmos */ | 2995 /* try to autodetect vobsub from movie filename ::atmos */ |
2996 char *buf = malloc((strlen(filename)-3) * sizeof(char)),*psub; | 2996 char *buf = malloc((strlen(filename)-3)),*psub; |
2997 memset(buf,0,strlen(filename)-3); // make sure string is terminated | 2997 memset(buf,0,strlen(filename)-3); // make sure string is terminated |
2998 strncpy(buf, filename, strlen(filename)-4); | 2998 strncpy(buf, filename, strlen(filename)-4); |
2999 vo_vobsub=vobsub_open(buf,spudec_ifo,0,&vo_spudec); | 2999 vo_vobsub=vobsub_open(buf,spudec_ifo,0,&vo_spudec); |
3000 /* try from ~/.mplayer/sub */ | 3000 /* try from ~/.mplayer/sub */ |
3001 if(!vo_vobsub && (psub = get_path( "sub/" ))) { | 3001 if(!vo_vobsub && (psub = get_path( "sub/" ))) { |
3150 | 3150 |
3151 entry = play_tree_new(); | 3151 entry = play_tree_new(); |
3152 | 3152 |
3153 if (filename && !strcmp(mp_basename(playlist_entry),playlist_entry)) // add reference path of current file | 3153 if (filename && !strcmp(mp_basename(playlist_entry),playlist_entry)) // add reference path of current file |
3154 { | 3154 { |
3155 temp=malloc((strlen(filename)-strlen(mp_basename(filename))+strlen(playlist_entry)+1)*sizeof(char)); | 3155 temp=malloc((strlen(filename)-strlen(mp_basename(filename))+strlen(playlist_entry)+1)); |
3156 if (temp) | 3156 if (temp) |
3157 { | 3157 { |
3158 strncpy(temp, filename, strlen(filename)-strlen(mp_basename(filename))); | 3158 strncpy(temp, filename, strlen(filename)-strlen(mp_basename(filename))); |
3159 temp[strlen(filename)-strlen(mp_basename(filename))]='\0'; | 3159 temp[strlen(filename)-strlen(mp_basename(filename))]='\0'; |
3160 strcat(temp, playlist_entry); | 3160 strcat(temp, playlist_entry); |