Commit 30bb4c64eeddef030132e467c6388d5695a4117c
1 parent
232f5fc9
Minor code cleanup
* Return rather than exiting from realmain in qpdf.cc * Remove extraneous blank line * Don't assign temporary to const reference
Showing
3 changed files
with
9 additions
and
10 deletions
libqpdf/QPDF.cc
libqpdf/QPDFWriter.cc
| ... | ... | @@ -2370,7 +2370,7 @@ QPDFWriter::generateObjectStreams() |
| 2370 | 2370 | |
| 2371 | 2371 | // This code doesn't do anything with /Extends. |
| 2372 | 2372 | |
| 2373 | - std::vector<QPDFObjGen> const& eligible = | |
| 2373 | + std::vector<QPDFObjGen> eligible = | |
| 2374 | 2374 | QPDF::Writer::getCompressibleObjGens(this->m->pdf); |
| 2375 | 2375 | size_t n_object_streams = (eligible.size() + 99U) / 100U; |
| 2376 | 2376 | if (n_object_streams == 0) | ... | ... |
qpdf/qpdf.cc
| ... | ... | @@ -5730,7 +5730,7 @@ int realmain(int argc, char* argv[]) |
| 5730 | 5730 | { |
| 5731 | 5731 | // Allow --is-encrypted and --requires-password to |
| 5732 | 5732 | // work when an incorrect password is supplied. |
| 5733 | - exit(0); | |
| 5733 | + return 0; | |
| 5734 | 5734 | } |
| 5735 | 5735 | throw e; |
| 5736 | 5736 | } |
| ... | ... | @@ -5739,22 +5739,22 @@ int realmain(int argc, char* argv[]) |
| 5739 | 5739 | { |
| 5740 | 5740 | if (pdf.isEncrypted()) |
| 5741 | 5741 | { |
| 5742 | - exit(0); | |
| 5742 | + return 0; | |
| 5743 | 5743 | } |
| 5744 | 5744 | else |
| 5745 | 5745 | { |
| 5746 | - exit(EXIT_IS_NOT_ENCRYPTED); | |
| 5746 | + return EXIT_IS_NOT_ENCRYPTED; | |
| 5747 | 5747 | } |
| 5748 | 5748 | } |
| 5749 | 5749 | else if (o.check_requires_password) |
| 5750 | 5750 | { |
| 5751 | 5751 | if (pdf.isEncrypted()) |
| 5752 | 5752 | { |
| 5753 | - exit(EXIT_CORRECT_PASSWORD); | |
| 5753 | + return EXIT_CORRECT_PASSWORD; | |
| 5754 | 5754 | } |
| 5755 | 5755 | else |
| 5756 | 5756 | { |
| 5757 | - exit(EXIT_IS_NOT_ENCRYPTED); | |
| 5757 | + return EXIT_IS_NOT_ENCRYPTED; | |
| 5758 | 5758 | } |
| 5759 | 5759 | } |
| 5760 | 5760 | if (! o.page_specs.empty()) |
| ... | ... | @@ -5788,14 +5788,14 @@ int realmain(int argc, char* argv[]) |
| 5788 | 5788 | << " resulting file may have some problems" |
| 5789 | 5789 | << std::endl; |
| 5790 | 5790 | } |
| 5791 | - // Still exit with warning code even if warnings were suppressed. | |
| 5792 | - exit(EXIT_WARNING); | |
| 5791 | + // Still return with warning code even if warnings were suppressed. | |
| 5792 | + return EXIT_WARNING; | |
| 5793 | 5793 | } |
| 5794 | 5794 | } |
| 5795 | 5795 | catch (std::exception& e) |
| 5796 | 5796 | { |
| 5797 | 5797 | std::cerr << e.what() << std::endl; |
| 5798 | - exit(EXIT_ERROR); | |
| 5798 | + return EXIT_ERROR; | |
| 5799 | 5799 | } |
| 5800 | 5800 | |
| 5801 | 5801 | return 0; | ... | ... |