Skip to content

Commit b5e98c3

Browse files
Fix fall through error in switch statement
1 parent f8cb9c6 commit b5e98c3

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

examples/cpp/advanced-convolution-deprecated.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ int main(int argc, char* argv[]) {
3939

4040
switch (argc) {
4141
case 4:
42-
pdfset1 = argv[2];
4342
pdfset2 = argv[3];
4443
// fall through
4544
case 3:
4645
pdfset1 = argv[2];
47-
pdfset2 = argv[2];
46+
// set the two PDFs the same if only one is provided
47+
if (argc == 3) pdfset2 = argv[2];
4848
// fall through
4949
case 2:
5050
filename = argv[1];

examples/cpp/advanced-convolution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ int main(int argc, char* argv[]) {
1616

1717
switch (argc) {
1818
case 4:
19-
pdfset1 = argv[2];
2019
pdfset2 = argv[3];
2120
// fall through
2221
case 3:
2322
pdfset1 = argv[2];
24-
pdfset2 = argv[2];
23+
// set the two PDFs the same if only one is provided
24+
if (argc == 3) pdfset2 = argv[2];
2525
// fall through
2626
case 2:
2727
filename = argv[1];

examples/cpp/convolve-grid.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ int main(int argc, char* argv[]) {
1717

1818
switch (argc) {
1919
case 4:
20-
pdfset1 = argv[2];
2120
pdfset2 = argv[3];
2221
// fall through
2322
case 3:
2423
pdfset1 = argv[2];
25-
pdfset2 = argv[2];
24+
// set the two PDFs the same if only one is provided
25+
if (argc == 3) pdfset2 = argv[2];
2626
// fall through
2727
case 2:
2828
filename = argv[1];

0 commit comments

Comments
 (0)