Skip to content

Commit

Permalink
Use clearer syntax for fallthrough in switch statement
Browse files Browse the repository at this point in the history
The previous syntax was not parsed correctly by Uncrustify, which would
lead to symantic changes when running code style scripts.
  • Loading branch information
shoogle committed Jul 21, 2020
1 parent 4983a59 commit 5367acf
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions libmscore/page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,15 @@ QString Page::replaceTextMacros(const QString& s) const
QChar nc = s[i+1];
switch(nc.toLatin1()) {
case 'p': // not on first page 1
if (_no) // FALLTHROUGH
if (!_no) {
break;
}
// FALLTHROUGH
case 'N': // on page 1 only if there are multiple pages
if ( (score()->npages() + score()->pageNumberOffset()) > 1 ) // FALLTHROUGH
if ( (score()->npages() + score()->pageNumberOffset()) <= 1 ) {
break;
}
// FALLTHROUGH
case 'P': // on all pages
{
int no = _no + 1 + score()->pageNumberOffset();
Expand All @@ -332,7 +338,10 @@ QString Page::replaceTextMacros(const QString& s) const
d += QString("%1").arg(score()->npages() + score()->pageNumberOffset());
break;
case 'i': // not on first page
if (_no) // FALLTHROUGH
if (!_no) {
break;
}
// FALLTHROUGH
case 'I':
d += score()->metaTag("partName").toHtmlEscaped();
break;
Expand Down Expand Up @@ -376,7 +385,10 @@ QString Page::replaceTextMacros(const QString& s) const
d += masterScore()->fileInfo()->lastModified().date().toString(Qt::DefaultLocaleShortDate);
break;
case 'C': // only on first page
if (!_no) // FALLTHROUGH
if (_no) {
break;
}
// FALLTHROUGH
case 'c':
d += score()->metaTag("copyright").toHtmlEscaped();
break;
Expand Down

0 comments on commit 5367acf

Please sign in to comment.