From e6933b61d2fe971d4e753b2939c664578ff456da Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 19 Nov 2013 11:06:56 -0500 Subject: [PATCH] cmScore.c : Fixed bug in _cmScParseFile() where _cmScParseSectionColumn() overwrote 'rc' and thereby prevented the functio from returning the correct result code on fail. --- app/cmScore.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/app/cmScore.c b/app/cmScore.c index 355fa41..8637a24 100644 --- a/app/cmScore.c +++ b/app/cmScore.c @@ -1306,27 +1306,30 @@ cmScRC_t _cmScParseFile( cmSc_t* p, cmCtx_t* ctx, const cmChar_t* fn ) break; } - if( secs != DBL_MAX ) - cur_secs = secs; - - // form the section list - if( j > 0 ) - if((rc = _cmScParseSectionColumn(p,i,j-1,p->sectList)) != kOkScRC ) - break; - - // the bar lines don't have times so set the time of the bar line to the - // time of the first event in the bar. - if( barEvtIdx != cmInvalidIdx && secs != DBL_MAX ) + if( rc == kOkScRC ) { - assert( p->array[ barEvtIdx ].type == kBarEvtScId ); - p->array[ barEvtIdx ].secs = secs; + if( secs != DBL_MAX ) + cur_secs = secs; - // handle the case where the previous bar had no events - // BUG BUG BUG this is a hack which will fail if the first bar does not have events. - if( barEvtIdx>=1 && p->array[ barEvtIdx-1].type == kBarEvtScId ) - p->array[ barEvtIdx-1].secs = secs; + // form the section list + if( j > 0 ) + if((rc = _cmScParseSectionColumn(p,i,j-1,p->sectList)) != kOkScRC ) + break; - barEvtIdx = cmInvalidIdx; + // the bar lines don't have times so set the time of the bar line to the + // time of the first event in the bar. + if( barEvtIdx != cmInvalidIdx && secs != DBL_MAX ) + { + assert( p->array[ barEvtIdx ].type == kBarEvtScId ); + p->array[ barEvtIdx ].secs = secs; + + // handle the case where the previous bar had no events + // BUG BUG BUG this is a hack which will fail if the first bar does not have events. + if( barEvtIdx>=1 && p->array[ barEvtIdx-1].type == kBarEvtScId ) + p->array[ barEvtIdx-1].secs = secs; + + barEvtIdx = cmInvalidIdx; + } } }