Minor code cleanup

* Return rather than exiting from realmain in qpdf.cc
* Remove extraneous blank line
* Don't assign temporary to const reference
This commit is contained in:
Jay Berkenbilt 2020-10-22 15:18:13 -04:00
parent 232f5fc9f3
commit 30bb4c64ee
3 changed files with 9 additions and 10 deletions

View File

@ -1464,7 +1464,6 @@ QPDF::fixDanglingReferences(bool force)
queue.push_back(sub);
}
}
}
}

View File

@ -2370,7 +2370,7 @@ QPDFWriter::generateObjectStreams()
// This code doesn't do anything with /Extends.
std::vector<QPDFObjGen> const& eligible =
std::vector<QPDFObjGen> eligible =
QPDF::Writer::getCompressibleObjGens(this->m->pdf);
size_t n_object_streams = (eligible.size() + 99U) / 100U;
if (n_object_streams == 0)

View File

@ -5730,7 +5730,7 @@ int realmain(int argc, char* argv[])
{
// Allow --is-encrypted and --requires-password to
// work when an incorrect password is supplied.
exit(0);
return 0;
}
throw e;
}
@ -5739,22 +5739,22 @@ int realmain(int argc, char* argv[])
{
if (pdf.isEncrypted())
{
exit(0);
return 0;
}
else
{
exit(EXIT_IS_NOT_ENCRYPTED);
return EXIT_IS_NOT_ENCRYPTED;
}
}
else if (o.check_requires_password)
{
if (pdf.isEncrypted())
{
exit(EXIT_CORRECT_PASSWORD);
return EXIT_CORRECT_PASSWORD;
}
else
{
exit(EXIT_IS_NOT_ENCRYPTED);
return EXIT_IS_NOT_ENCRYPTED;
}
}
if (! o.page_specs.empty())
@ -5788,14 +5788,14 @@ int realmain(int argc, char* argv[])
<< " resulting file may have some problems"
<< std::endl;
}
// Still exit with warning code even if warnings were suppressed.
exit(EXIT_WARNING);
// Still return with warning code even if warnings were suppressed.
return EXIT_WARNING;
}
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
exit(EXIT_ERROR);
return EXIT_ERROR;
}
return 0;