From e8a1cebee78b6fa9722d4bb066132f90cbee3369 Mon Sep 17 00:00:00 2001 From: Hiroshi Yamashita Date: Sat, 5 Jan 2013 16:13:14 +0900 Subject: [PATCH] fix segfault split.log open error --- fixass.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fixass.c b/fixass.c index 7ed62da..74c4cb7 100644 --- a/fixass.c +++ b/fixass.c @@ -30,13 +30,16 @@ char *getfixtimestr(double asstime,TCLIST *cutlist) int h,m; char *fixedstr; + cuttm = NULL; for(i=0;i= cuttm->cutstart && asstime <= cuttm->cutend) return NULL; if (asstime < cuttm->nextstart) break; } - wktime = asstime - cuttm->totalcut; + if (cuttm) wktime = asstime - cuttm->totalcut; + else wktime = asstime; + if (wktime<0) return NULL; h = wktime / 3600; m = (wktime - h*3600) / 60; @@ -122,12 +125,12 @@ TCLIST *readlog(char *logfile) fp = fopen(logfile,"r"); if (fp == NULL) return cutlist; chkflg=lcnt=0; - nextstart=totalcut=0; + nextstart=totalcut=0.0; while(fgets(rbuf,1024,fp)!=NULL) { if (lcnt==0) { // chk start 0 sec p=strstr(rbuf," duration "); - if (p) chkflg=1; + if (p) {chkflg=1;sttime=0.0;} } if (!chkflg) { // find Adjust Start pos @@ -210,7 +213,7 @@ main(int argc,char *argv[]) for(i=0;itotalcut,cuttm->nextstart,cuttm->cutstart,cuttm->cutend); + //fprintf(stderr,"%d total %f next %f start %f end %f\n",i,cuttm->totalcut,cuttm->nextstart,cuttm->cutstart,cuttm->cutend); } cutass(assfile,cutlist); -- 2.11.0