diff options
author | Jay Berkenbilt <ejb@ql.org> | 2009-09-26 20:36:04 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2009-09-26 20:36:04 +0200 |
commit | f3d7c26de1f575a14017a161ad1fdd2b93385e03 (patch) | |
tree | 065d6b0e12534a7371974bfb17e77c91d7b217d6 /libqpdf/QUtil.cc | |
parent | 64546cfa0ddc2cf4c91e0865e979947c6b20ca46 (diff) | |
download | qpdf-f3d7c26de1f575a14017a161ad1fdd2b93385e03.tar.zst |
removed qexc; non-compatible ABI change
git-svn-id: svn+q:///qpdf/trunk@709 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf/QUtil.cc')
-rw-r--r-- | libqpdf/QUtil.cc | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 0d0b4667..1b9ca924 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -1,4 +1,4 @@ - +#include <qpdf/DLL.hh> #include <qpdf/QUtil.hh> #include <stdio.h> #include <errno.h> @@ -25,9 +25,9 @@ QUtil::int_to_string(int num, int fullpad) // -2 or -1 to leave space for the possible negative sign and for NUL... if (abs(fullpad) > (int)sizeof(t) - ((num < 0)?2:1)) { - throw QEXC::Internal("Util::int_to_string has been called with " - "a padding value greater than its internal " - "limit"); + throw std::logic_error("Util::int_to_string has been called with " + "a padding value greater than its internal " + "limit"); } if (fullpad) @@ -62,9 +62,9 @@ QUtil::double_to_string(double num, int decimal_places) // always pass in those cases. if (decimal_places + 1 + (int)lhs.length() > (int)sizeof(t) - 1) { - throw QEXC::Internal("Util::double_to_string has been called with " - "a number and a decimal places specification " - "that would break an internal limit"); + throw std::logic_error("Util::double_to_string has been called with " + "a number and a decimal places specification " + "that would break an internal limit"); } if (decimal_places) @@ -79,23 +79,30 @@ QUtil::double_to_string(double num, int decimal_places) } DLL_EXPORT +void +QUtil::throw_system_error(std::string const& description) +{ + throw std::runtime_error(description + ": " + strerror(errno)); +} + +DLL_EXPORT int -QUtil::os_wrapper(std::string const& description, int status) throw (QEXC::System) +QUtil::os_wrapper(std::string const& description, int status) { if (status == -1) { - throw QEXC::System(description, errno); + throw_system_error(description); } return status; } DLL_EXPORT FILE* -QUtil::fopen_wrapper(std::string const& description, FILE* f) throw (QEXC::System) +QUtil::fopen_wrapper(std::string const& description, FILE* f) { if (f == 0) { - throw QEXC::System(description, errno); + throw_system_error(description); } return f; } @@ -240,7 +247,7 @@ QUtil::toUTF8(unsigned long uval) if (uval > 0x7fffffff) { - throw QEXC::General("bounds error in QUtil::toUTF8"); + throw std::runtime_error("bounds error in QUtil::toUTF8"); } else if (uval < 128) { @@ -267,7 +274,7 @@ QUtil::toUTF8(unsigned long uval) --cur_byte; if (cur_byte < bytes) { - throw QEXC::Internal("QUtil::toUTF8: overflow error"); + throw std::logic_error("QUtil::toUTF8: overflow error"); } } // If maxval is k bits long, the high (7 - k) bits of the |