mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Catch exceptions as const references (fixes #236)
This fix allows qpdf to compile/test cleanly with gcc 8.
This commit is contained in:
parent
3d6615b276
commit
a2f62935b3
@ -77,7 +77,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
process(whoami, argv[1], argv[2]);
|
||||
}
|
||||
catch (std::exception e)
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
std::cerr << whoami << ": exception: " << e.what() << std::endl;
|
||||
return 2;
|
||||
|
@ -421,7 +421,7 @@ MD5::checkFileChecksum(char const* const checksum,
|
||||
std::string actual_checksum = getFileChecksum(filename, up_to_size);
|
||||
result = (checksum == actual_checksum);
|
||||
}
|
||||
catch (std::runtime_error)
|
||||
catch (std::runtime_error const&)
|
||||
{
|
||||
// Ignore -- return false
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ void test_to_number(char const* str, int_T wanted, bool error,
|
||||
result = fn(str);
|
||||
worked = (wanted == result);
|
||||
}
|
||||
catch (std::runtime_error)
|
||||
catch (std::runtime_error const&)
|
||||
{
|
||||
threw = true;
|
||||
}
|
||||
@ -247,7 +247,7 @@ void same_file_test()
|
||||
fclose(QUtil::safe_fopen("qutil.out", "r"));
|
||||
fclose(QUtil::safe_fopen("other-file", "r"));
|
||||
}
|
||||
catch (std::exception)
|
||||
catch (std::exception const&)
|
||||
{
|
||||
std::cout << "same_file_test expects to have qutil.out and other-file"
|
||||
" exist in the current directory\n";
|
||||
|
@ -773,7 +773,7 @@ static std::vector<int> parse_numrange(char const* range, int max,
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::runtime_error e)
|
||||
catch (std::runtime_error const& e)
|
||||
{
|
||||
if (throw_error)
|
||||
{
|
||||
@ -1372,7 +1372,7 @@ static void parse_rotation_parameter(Options& o, std::string const& parameter)
|
||||
parse_numrange(range.c_str(), 0, true);
|
||||
range_valid = true;
|
||||
}
|
||||
catch (std::runtime_error)
|
||||
catch (std::runtime_error const&)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
// Do it wrong first...
|
||||
pdf.replaceObject(qdict.getObjGen(), qdict);
|
||||
}
|
||||
catch (std::logic_error)
|
||||
catch (std::logic_error const&)
|
||||
{
|
||||
std::cout << "caught logic error as expected" << std::endl;
|
||||
}
|
||||
@ -1003,7 +1003,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
res2.unparseResolved();
|
||||
std::cout << "oops -- didn't throw" << std::endl;
|
||||
}
|
||||
catch (std::logic_error e)
|
||||
catch (std::logic_error const& e)
|
||||
{
|
||||
std::cout << "logic error: " << e.what() << std::endl;
|
||||
}
|
||||
@ -1012,7 +1012,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
res2.makeDirect();
|
||||
std::cout << "oops -- didn't throw" << std::endl;
|
||||
}
|
||||
catch (std::logic_error e)
|
||||
catch (std::logic_error const& e)
|
||||
{
|
||||
std::cout << "logic error: " << e.what() << std::endl;
|
||||
}
|
||||
@ -1109,7 +1109,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
pdf.copyForeignObject(pdf.getTrailer().getKey("/QTest"));
|
||||
std::cout << "oops -- didn't throw" << std::endl;
|
||||
}
|
||||
catch (std::logic_error e)
|
||||
catch (std::logic_error const& e)
|
||||
{
|
||||
std::cout << "logic error: " << e.what() << std::endl;
|
||||
}
|
||||
@ -1118,7 +1118,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
pdf.copyForeignObject(QPDFObjectHandle::newInteger(1));
|
||||
std::cout << "oops -- didn't throw" << std::endl;
|
||||
}
|
||||
catch (std::logic_error e)
|
||||
catch (std::logic_error const& e)
|
||||
{
|
||||
std::cout << "logic error: " << e.what() << std::endl;
|
||||
}
|
||||
@ -1139,7 +1139,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
w.write();
|
||||
std::cout << "oops -- didn't throw" << std::endl;
|
||||
}
|
||||
catch (std::logic_error e)
|
||||
catch (std::logic_error const& e)
|
||||
{
|
||||
std::cout << "logic error: " << e.what() << std::endl;
|
||||
}
|
||||
@ -1185,7 +1185,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
QPDFObjectHandle::parse("[1 0 R]", "indirect test");
|
||||
std::cout << "oops -- didn't throw" << std::endl;
|
||||
}
|
||||
catch (std::logic_error e)
|
||||
catch (std::logic_error const& e)
|
||||
{
|
||||
std::cout << "logic error parsing indirect: " << e.what()
|
||||
<< std::endl;
|
||||
@ -1195,7 +1195,7 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
QPDFObjectHandle::parse("0 trailing", "trailing test");
|
||||
std::cout << "oops -- didn't throw" << std::endl;
|
||||
}
|
||||
catch (std::runtime_error e)
|
||||
catch (std::runtime_error const& e)
|
||||
{
|
||||
std::cout << "trailing data: " << e.what()
|
||||
<< std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user