diff options
Diffstat (limited to 'libqpdf')
62 files changed, 190 insertions, 334 deletions
diff --git a/libqpdf/BitStream.cc b/libqpdf/BitStream.cc index c30f1f2d..72a50706 100644 --- a/libqpdf/BitStream.cc +++ b/libqpdf/BitStream.cc @@ -38,7 +38,8 @@ BitStream::skipToNextByte() unsigned int bits_to_skip = bit_offset + 1; if (bits_available < bits_to_skip) { - throw QEXC::Internal("overflow skipping to next byte in bitstream"); + throw std::logic_error( + "INTERNAL ERROR: overflow skipping to next byte in bitstream"); } bit_offset = 7; ++p; diff --git a/libqpdf/BitWriter.cc b/libqpdf/BitWriter.cc index b9b3caec..96a9b4ce 100644 --- a/libqpdf/BitWriter.cc +++ b/libqpdf/BitWriter.cc @@ -1,5 +1,3 @@ - - #include <qpdf/BitWriter.hh> // See comments in bits.cc diff --git a/libqpdf/Buffer.cc b/libqpdf/Buffer.cc index dfed6010..2d1763bb 100644 --- a/libqpdf/Buffer.cc +++ b/libqpdf/Buffer.cc @@ -1,4 +1,3 @@ - #include <qpdf/Buffer.hh> #include <string.h> diff --git a/libqpdf/MD5.cc b/libqpdf/MD5.cc index b05afa8b..8f6f7ecd 100644 --- a/libqpdf/MD5.cc +++ b/libqpdf/MD5.cc @@ -28,6 +28,7 @@ ///////////////////////////////////////////////////////////////////////// #include <qpdf/MD5.hh> +#include <qpdf/QUtil.hh> #include <stdio.h> #include <memory.h> @@ -330,15 +331,12 @@ void MD5::encodeDataIncrementally(char const* data, int len) DLL_EXPORT void MD5::encodeFile(char const *filename, int up_to_size) - throw (QEXC::System) { - FILE *file; unsigned char buffer[1024]; - if ((file = fopen (filename, "rb")) == NULL) - { - throw QEXC::System(std::string("MD5: can't open ") + filename, errno); - } + FILE *file = QUtil::fopen_wrapper( + std::string("MD5: open ") + filename, + fopen(filename, "rb")); int len; int so_far = 0; @@ -365,7 +363,8 @@ void MD5::encodeFile(char const *filename, int up_to_size) // Assume, perhaps incorrectly, that errno was set by the // underlying call to read.... (void) fclose(file); - throw QEXC::System(std::string("MD5: read error on ") + filename, errno); + QUtil::throw_system_error( + std::string("MD5: read error on ") + filename); } (void) fclose(file); @@ -446,7 +445,7 @@ MD5::checkFileChecksum(char const* const checksum, std::string actual_checksum = getFileChecksum(filename, up_to_size); result = (checksum == actual_checksum); } - catch (QEXC::System) + catch (std::runtime_error) { // Ignore -- return false } diff --git a/libqpdf/PCRE.cc b/libqpdf/PCRE.cc index 3236e941..859c5c49 100644 --- a/libqpdf/PCRE.cc +++ b/libqpdf/PCRE.cc @@ -1,19 +1,13 @@ - #include <qpdf/PCRE.hh> #include <qpdf/QUtil.hh> +#include <stdexcept> #include <iostream> #include <string.h> DLL_EXPORT -PCRE::Exception::Exception(std::string const& message) -{ - this->setMessage("PCRE error: " + message); -} - -DLL_EXPORT PCRE::NoBackref::NoBackref() : - Exception("no match") + std::logic_error("PCRE error: no match") { } @@ -87,7 +81,6 @@ PCRE::Match::operator bool() DLL_EXPORT std::string PCRE::Match::getMatch(int n, int flags) - throw(QEXC::General, Exception) { // This method used to be implemented in terms of // pcre_get_substring, but that function gives you an empty string @@ -116,7 +109,7 @@ PCRE::Match::getMatch(int n, int flags) DLL_EXPORT void -PCRE::Match::getOffsetLength(int n, int& offset, int& length) throw(Exception) +PCRE::Match::getOffsetLength(int n, int& offset, int& length) { if ((this->nmatches < 0) || (n > this->nmatches - 1) || @@ -130,7 +123,7 @@ PCRE::Match::getOffsetLength(int n, int& offset, int& length) throw(Exception) DLL_EXPORT int -PCRE::Match::getOffset(int n) throw(Exception) +PCRE::Match::getOffset(int n) { int offset; int length; @@ -140,7 +133,7 @@ PCRE::Match::getOffset(int n) throw(Exception) DLL_EXPORT int -PCRE::Match::getLength(int n) throw(Exception) +PCRE::Match::getLength(int n) { int offset; int length; @@ -156,7 +149,7 @@ PCRE::Match::nMatches() const } DLL_EXPORT -PCRE::PCRE(char const* pattern, int options) throw (PCRE::Exception) +PCRE::PCRE(char const* pattern, int options) { char const *errptr; int erroffset; @@ -171,7 +164,7 @@ PCRE::PCRE(char const* pattern, int options) throw (PCRE::Exception) " failed at offset " + QUtil::int_to_string(erroffset) + ": " + errptr); - throw Exception(message); + throw std::runtime_error("PCRE error: " + message); } } @@ -184,7 +177,6 @@ PCRE::~PCRE() DLL_EXPORT PCRE::Match PCRE::match(char const* subject, int options, int startoffset, int size) - throw (QEXC::General, Exception) { if (size == -1) { @@ -210,12 +202,12 @@ PCRE::match(char const* subject, int options, int startoffset, int size) case PCRE_ERROR_BADOPTION: message = "bad option passed to PCRE::match()"; - throw Exception(message); + throw std::logic_error(message); break; case PCRE_ERROR_NOMEMORY: message = "insufficient memory"; - throw Exception(message); + throw std::runtime_error(message); break; case PCRE_ERROR_NULL: @@ -223,7 +215,7 @@ PCRE::match(char const* subject, int options, int startoffset, int size) case PCRE_ERROR_UNKNOWN_NODE: default: message = "pcre_exec returned " + QUtil::int_to_string(status); - throw QEXC::Internal(message); + throw std::logic_error(message); } } @@ -258,9 +250,9 @@ PCRE::test(int n) { PCRE pcre1("a**"); } - catch (Exception& e) + catch (std::exception& e) { - std::cout << e.unparse() << std::endl; + std::cout << e.what() << std::endl; } PCRE pcre2("^([^\\s:]*)\\s*:\\s*(.*?)\\s*$"); @@ -281,17 +273,17 @@ PCRE::test(int n) { std::cout << m2.getMatch(3) << std::endl; } - catch (Exception& e) + catch (std::exception& e) { - std::cout << e.unparse() << std::endl; + std::cout << e.what() << std::endl; } try { std::cout << m2.getOffset(3) << std::endl; } - catch (Exception& e) + catch (std::exception& e) { - std::cout << e.unparse() << std::endl; + std::cout << e.what() << std::endl; } } PCRE pcre3("^(a+)(b+)?$"); @@ -312,9 +304,9 @@ PCRE::test(int n) std::cout << "can't see this" << std::endl; } } - catch (Exception& e) + catch (std::exception& e) { - std::cout << e.unparse() << std::endl; + std::cout << e.what() << std::endl; } // backref: 1 2 3 4 5 @@ -370,8 +362,8 @@ PCRE::test(int n) } } } - catch (QEXC::General& e) + catch (std::exception& e) { - std::cout << "unexpected exception: " << e.unparse() << std::endl; + std::cout << "unexpected exception: " << e.what() << std::endl; } } diff --git a/libqpdf/Pipeline.cc b/libqpdf/Pipeline.cc index d9f70b67..9f5dc0a9 100644 --- a/libqpdf/Pipeline.cc +++ b/libqpdf/Pipeline.cc @@ -1,6 +1,5 @@ - - #include <qpdf/Pipeline.hh> +#include <stdexcept> DLL_EXPORT Pipeline::Pipeline(char const* identifier, Pipeline* next) : @@ -19,7 +18,7 @@ Pipeline::getNext(bool allow_null) { if ((next == 0) && (! allow_null)) { - throw Exception( + throw std::logic_error( this->identifier + ": Pipeline::getNext() called on pipeline with no next"); } diff --git a/libqpdf/Pl_ASCII85Decoder.cc b/libqpdf/Pl_ASCII85Decoder.cc index 999ef0ae..d018e2de 100644 --- a/libqpdf/Pl_ASCII85Decoder.cc +++ b/libqpdf/Pl_ASCII85Decoder.cc @@ -1,6 +1,6 @@ #include <qpdf/Pl_ASCII85Decoder.hh> -#include <qpdf/QEXC.hh> #include <qpdf/QTC.hh> +#include <stdexcept> #include <string.h> DLL_EXPORT @@ -40,7 +40,7 @@ Pl_ASCII85Decoder::write(unsigned char* buf, int len) } else { - throw QEXC::General( + throw std::runtime_error( "broken end-of-data sequence in base 85 data"); } } @@ -65,7 +65,7 @@ Pl_ASCII85Decoder::write(unsigned char* buf, int len) case 'z': if (pos != 0) { - throw QEXC::General( + throw std::runtime_error( "unexpected z during base 85 decode"); } else @@ -78,8 +78,8 @@ Pl_ASCII85Decoder::write(unsigned char* buf, int len) default: if ((buf[i] < 33) || (buf[i] > 117)) { - throw QEXC::General - ("character out of range during base 85 decode"); + throw std::runtime_error( + "character out of range during base 85 decode"); } else { diff --git a/libqpdf/Pl_ASCIIHexDecoder.cc b/libqpdf/Pl_ASCIIHexDecoder.cc index 728e3eb8..00439c17 100644 --- a/libqpdf/Pl_ASCIIHexDecoder.cc +++ b/libqpdf/Pl_ASCIIHexDecoder.cc @@ -1,6 +1,6 @@ #include <qpdf/Pl_ASCIIHexDecoder.hh> -#include <qpdf/QEXC.hh> #include <qpdf/QTC.hh> +#include <stdexcept> #include <string.h> #include <ctype.h> @@ -61,8 +61,9 @@ Pl_ASCIIHexDecoder::write(unsigned char* buf, int len) char t[2]; t[0] = ch; t[1] = 0; - throw QEXC::General( - std::string("character out of range during base Hex decode: ") + t); + throw std::runtime_error( + std::string("character out of range" + " during base Hex decode: ") + t); } break; } diff --git a/libqpdf/Pl_Buffer.cc b/libqpdf/Pl_Buffer.cc index 25aff218..cdbad568 100644 --- a/libqpdf/Pl_Buffer.cc +++ b/libqpdf/Pl_Buffer.cc @@ -1,6 +1,5 @@ - #include <qpdf/Pl_Buffer.hh> -#include <qpdf/QEXC.hh> +#include <stdexcept> #include <assert.h> #include <string.h> @@ -50,7 +49,7 @@ Pl_Buffer::getBuffer() { if (! this->ready) { - throw QEXC::Internal("Pl_Buffer::getBuffer() called when not ready"); + throw std::logic_error("Pl_Buffer::getBuffer() called when not ready"); } Buffer* b = new Buffer(this->total_size); diff --git a/libqpdf/Pl_Count.cc b/libqpdf/Pl_Count.cc index 81ef7033..c9eb8597 100644 --- a/libqpdf/Pl_Count.cc +++ b/libqpdf/Pl_Count.cc @@ -1,4 +1,3 @@ - #include <qpdf/Pl_Count.hh> DLL_EXPORT diff --git a/libqpdf/Pl_Discard.cc b/libqpdf/Pl_Discard.cc index 22c1a14e..7c7f457a 100644 --- a/libqpdf/Pl_Discard.cc +++ b/libqpdf/Pl_Discard.cc @@ -1,4 +1,3 @@ - #include <qpdf/Pl_Discard.hh> // Exercised in md5 test suite diff --git a/libqpdf/Pl_Flate.cc b/libqpdf/Pl_Flate.cc index ff3331fc..ad902c65 100644 --- a/libqpdf/Pl_Flate.cc +++ b/libqpdf/Pl_Flate.cc @@ -1,4 +1,3 @@ - #include <qpdf/Pl_Flate.hh> #include <qpdf/QUtil.hh> @@ -38,7 +37,7 @@ Pl_Flate::write(unsigned char* data, int len) { if (this->outbuf == 0) { - throw Exception( + throw std::logic_error( this->identifier + ": Pl_Flate: write() called after finish() called"); } @@ -197,6 +196,6 @@ Pl_Flate::checkError(char const* prefix, int error_code) } } - throw Exception(msg); + throw std::runtime_error(msg); } } diff --git a/libqpdf/Pl_LZWDecoder.cc b/libqpdf/Pl_LZWDecoder.cc index 050998d6..68f1ae3e 100644 --- a/libqpdf/Pl_LZWDecoder.cc +++ b/libqpdf/Pl_LZWDecoder.cc @@ -1,7 +1,7 @@ #include <qpdf/Pl_LZWDecoder.hh> -#include <qpdf/QEXC.hh> #include <qpdf/QTC.hh> +#include <stdexcept> #include <string.h> #include <assert.h> @@ -185,7 +185,7 @@ Pl_LZWDecoder::handleCode(int code) unsigned int idx = code - 258; if (idx > table_size) { - throw QEXC::General("LZWDecoder: bad code received"); + throw std::runtime_error("LZWDecoder: bad code received"); } else if (idx == table_size) { @@ -204,7 +204,7 @@ Pl_LZWDecoder::handleCode(int code) unsigned int new_idx = 258 + table_size; if (new_idx == 4096) { - throw QEXC::General("LZWDecoder: table full"); + throw std::runtime_error("LZWDecoder: table full"); } addToTable(next); unsigned int change_idx = new_idx + code_change_delta; diff --git a/libqpdf/Pl_MD5.cc b/libqpdf/Pl_MD5.cc index f368b93b..1fe91bf5 100644 --- a/libqpdf/Pl_MD5.cc +++ b/libqpdf/Pl_MD5.cc @@ -1,7 +1,5 @@ - #include <qpdf/Pl_MD5.hh> - -#include <qpdf/QEXC.hh> +#include <stdexcept> DLL_EXPORT Pl_MD5::Pl_MD5(char const* identifier, Pipeline* next) : @@ -42,7 +40,8 @@ Pl_MD5::getHexDigest() { if (this->in_progress) { - throw QEXC::General("digest requested for in-progress MD5 Pipeline"); + throw std::logic_error( + "digest requested for in-progress MD5 Pipeline"); } return this->md5.unparse(); } diff --git a/libqpdf/Pl_PNGFilter.cc b/libqpdf/Pl_PNGFilter.cc index 792b4a02..9e493793 100644 --- a/libqpdf/Pl_PNGFilter.cc +++ b/libqpdf/Pl_PNGFilter.cc @@ -1,5 +1,5 @@ - #include <qpdf/Pl_PNGFilter.hh> +#include <stdexcept> #include <string.h> DLL_EXPORT @@ -85,7 +85,7 @@ Pl_PNGFilter::decodeRow() break; case 1: // sub - throw Exception("sub filter not implemented"); + throw std::logic_error("sub filter not implemented"); break; case 2: // up @@ -96,11 +96,11 @@ Pl_PNGFilter::decodeRow() break; case 3: // average - throw Exception("average filter not implemented"); + throw std::logic_error("average filter not implemented"); break; case 4: // Paeth - throw Exception("Paeth filter not implemented"); + throw std::logic_error("Paeth filter not implemented"); break; default: diff --git a/libqpdf/Pl_QPDFTokenizer.cc b/libqpdf/Pl_QPDFTokenizer.cc index 96328408..28ea4faa 100644 --- a/libqpdf/Pl_QPDFTokenizer.cc +++ b/libqpdf/Pl_QPDFTokenizer.cc @@ -1,7 +1,7 @@ - #include <qpdf/Pl_QPDFTokenizer.hh> #include <qpdf/QPDF_String.hh> #include <qpdf/QPDF_Name.hh> +#include <stdexcept> #include <string.h> Pl_QPDFTokenizer::Pl_QPDFTokenizer(char const* identifier, Pipeline* next) : @@ -134,8 +134,9 @@ Pl_QPDFTokenizer::checkUnread() processChar(this->char_to_unread); if (this->unread_char) { - throw QEXC::Internal("unread_char still true after processing " - "unread character"); + throw std::logic_error( + "INTERNAL ERROR: unread_char still true after processing " + "unread character"); } } } diff --git a/libqpdf/Pl_RC4.cc b/libqpdf/Pl_RC4.cc index e176511f..1a5dc031 100644 --- a/libqpdf/Pl_RC4.cc +++ b/libqpdf/Pl_RC4.cc @@ -1,6 +1,4 @@ - #include <qpdf/Pl_RC4.hh> - #include <qpdf/QUtil.hh> DLL_EXPORT @@ -30,7 +28,7 @@ Pl_RC4::write(unsigned char* data, int len) { if (this->outbuf == 0) { - throw Exception( + throw std::logic_error( this->identifier + ": Pl_RC4: write() called after finish() called"); } diff --git a/libqpdf/Pl_StdioFile.cc b/libqpdf/Pl_StdioFile.cc index 37ae5333..9504c61b 100644 --- a/libqpdf/Pl_StdioFile.cc +++ b/libqpdf/Pl_StdioFile.cc @@ -1,6 +1,6 @@ - #include <qpdf/Pl_StdioFile.hh> - +#include <qpdf/QUtil.hh> +#include <stdexcept> #include <errno.h> DLL_EXPORT @@ -25,8 +25,8 @@ Pl_StdioFile::write(unsigned char* buf, int len) so_far = fwrite(buf, 1, len, this->file); if (so_far == 0) { - throw QEXC::System(this->identifier + ": Pl_StdioFile::write", - errno); + QUtil::throw_system_error( + this->identifier + ": Pl_StdioFile::write"); } else { @@ -46,7 +46,8 @@ Pl_StdioFile::finish() } else { - throw QEXC::Internal(this->identifier + - ": Pl_StdioFile::finish: stream already closed"); + throw std::logic_error( + this->identifier + + ": Pl_StdioFile::finish: stream already closed"); } } diff --git a/libqpdf/QEXC.cc b/libqpdf/QEXC.cc deleted file mode 100644 index d8154f33..00000000 --- a/libqpdf/QEXC.cc +++ /dev/null @@ -1,77 +0,0 @@ - -#include <qpdf/QEXC.hh> -#include <string.h> -#include <errno.h> - -DLL_EXPORT -QEXC::Base::Base() -{ - // nothing needed -} - -DLL_EXPORT -QEXC::Base::Base(std::string const& message) : - message(message) -{ - // nothing needed -} - -DLL_EXPORT -std::string const& -QEXC::Base::unparse() const -{ - return this->message; -} - -DLL_EXPORT -void -QEXC::Base::setMessage(std::string const& message) -{ - this->message = message; -} - -DLL_EXPORT -const char* -QEXC::Base::what() const throw() -{ - // Since unparse() returns a const string reference, its - // implementors must arrange to have it return a reference to a - // string that is not going to disappear. It is therefore safe - // for us to return it's c_str() pointer. - return this->unparse().c_str(); -} - -DLL_EXPORT -QEXC::General::General() -{ - // nothing needed -} - -DLL_EXPORT -QEXC::General::General(std::string const& message) : - Base(message) -{ - // nothing needed -} - -DLL_EXPORT -QEXC::System::System(std::string const& prefix, int sys_errno) -{ - // Note: using sys_errno in case errno is a macro. - this->sys_errno = sys_errno; - this->setMessage(prefix + ": " + strerror(sys_errno)); -} - -DLL_EXPORT -int -QEXC::System::getErrno() const -{ - return this->sys_errno; -} - -DLL_EXPORT -QEXC::Internal::Internal(std::string const& message) : - Base("INTERNAL ERROR: " + message) -{ - // nothing needed -} diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index ba71e629..d49ad5f1 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDF.hh> #include <vector> @@ -197,7 +196,8 @@ QPDF::BufferInputSource::seek(off_t offset, int whence) break; default: - throw QEXC::Internal("invalid argument to BufferInputSource::seek"); + throw std::logic_error( + "INTERNAL ERROR: invalid argument to BufferInputSource::seek"); break; } } @@ -392,7 +392,7 @@ QPDF::parse() void QPDF::warn(QPDFExc const& e) { - this->warnings.push_back(e.unparse()); + this->warnings.push_back(e.what()); if (! this->suppress_warnings) { std::cerr << "WARNING: " << this->warnings.back() << std::endl; @@ -956,8 +956,8 @@ QPDF::showXRefTable() break; default: - throw QEXC::Internal("unknown cross-reference table type while" - " showing xref_table"); + throw std::logic_error("unknown cross-reference table type while" + " showing xref_table"); break; } std::cout << std::endl; @@ -988,7 +988,8 @@ QPDF::readObjectInternal(InputSource* input, // Although dictionaries and arrays arbitrarily nest, these // variables indicate what is at the top of the stack right // now, so they can, by definition, never both be true. - throw QEXC::Internal("readObjectInternal: in_dict && in_array"); + throw std::logic_error( + "INTERNAL ERROR: readObjectInternal: in_dict && in_array"); } QPDFObjectHandle object; @@ -1121,9 +1122,10 @@ QPDF::readObjectInternal(InputSource* input, } else if (! object.isInitialized()) { - throw QEXC::Internal(std::string("uninitialized object (token = ") + - QUtil::int_to_string(token.getType()) + - ", " + token.getValue() + ")"); + throw std::logic_error( + "INTERNAL ERROR: uninitialized object (token = " + + QUtil::int_to_string(token.getType()) + + ", " + token.getValue() + ")"); } else { @@ -1846,13 +1848,13 @@ QPDF::pipeStreamData(int objid, int generation, pipeline->write((unsigned char*)buf, len); } } - catch (QEXC::General& e) + catch (std::runtime_error& e) { QTC::TC("qpdf", "QPDF decoding error warning"); warn(QPDFExc(this->file.getName(), this->file.getLastOffset(), "error decoding stream data for object " + QUtil::int_to_string(objid) + " " + - QUtil::int_to_string(generation) + ": " + e.unparse())); + QUtil::int_to_string(generation) + ": " + e.what())); } pipeline->finish(); } diff --git a/libqpdf/QPDFExc.cc b/libqpdf/QPDFExc.cc index bac52e03..ddd175ed 100644 --- a/libqpdf/QPDFExc.cc +++ b/libqpdf/QPDFExc.cc @@ -1,19 +1,17 @@ - #include <qpdf/QPDFExc.hh> - #include <qpdf/QUtil.hh> DLL_EXPORT QPDFExc::QPDFExc(std::string const& message) : - QEXC::General(message) + std::runtime_error(message) { } DLL_EXPORT QPDFExc::QPDFExc(std::string const& filename, int offset, std::string const& message) : - QEXC::General(filename + ": offset " + QUtil::int_to_string(offset) + - ": " + message) + std::runtime_error(filename + ": offset " + QUtil::int_to_string(offset) + + ": " + message) { } diff --git a/libqpdf/QPDFObject.cc b/libqpdf/QPDFObject.cc index 6c4963e2..8df2b480 100644 --- a/libqpdf/QPDFObject.cc +++ b/libqpdf/QPDFObject.cc @@ -1,2 +1 @@ - #include <qpdf/QPDFObject.hh> diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index f1c9db23..c5de7503 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDFObjectHandle.hh> #include <qpdf/QPDF.hh> @@ -13,9 +12,9 @@ #include <qpdf/QPDF_Stream.hh> #include <qpdf/QTC.hh> -#include <qpdf/QEXC.hh> #include <qpdf/QUtil.hh> +#include <stdexcept> #include <stdlib.h> DLL_EXPORT @@ -114,7 +113,7 @@ QPDFObjectHandle::getNumericValue() } else { - throw QEXC::Internal("getNumericValue called for non-numeric object"); + throw std::logic_error("getNumericValue called for non-numeric object"); } return result; } @@ -416,9 +415,10 @@ QPDFObjectHandle::getPageContents() } else { - throw QEXC::General("unknown item type while inspecting " - "element of /Contents array in page " - "dictionary"); + throw std::runtime_error( + "unknown item type while inspecting " + "element of /Contents array in page " + "dictionary"); } } } @@ -428,8 +428,8 @@ QPDFObjectHandle::getPageContents() } else { - throw QEXC::General("unknown object type inspecting /Contents " - "key in page dictionary"); + throw std::runtime_error("unknown object type inspecting /Contents " + "key in page dictionary"); } return result; @@ -542,7 +542,8 @@ QPDFObjectHandle::makeDirectInternal(std::set<int>& visited) if (isStream()) { QTC::TC("qpdf", "QPDFObjectHandle ERR clone stream"); - throw QEXC::General("attempt to make a stream into a direct object"); + throw std::runtime_error( + "attempt to make a stream into a direct object"); } int cur_objid = this->objid; @@ -551,8 +552,9 @@ QPDFObjectHandle::makeDirectInternal(std::set<int>& visited) if (visited.count(cur_objid)) { QTC::TC("qpdf", "QPDFObjectHandle makeDirect loop"); - throw QEXC::General("loop detected while converting object from " - "indirect to direct"); + throw std::runtime_error( + "loop detected while converting object from " + "indirect to direct"); } visited.insert(cur_objid); } @@ -620,8 +622,8 @@ QPDFObjectHandle::makeDirectInternal(std::set<int>& visited) } else { - throw QEXC::Internal("QPDFObjectHandle::makeIndirect: " - "unknown object type"); + throw std::logic_error("QPDFObjectHandle::makeIndirect: " + "unknown object type"); } this->obj = new_obj; @@ -644,8 +646,8 @@ QPDFObjectHandle::assertInitialized() const { if (! this->initialized) { - throw QEXC::Internal("operation attempted on uninitialized " - "QPDFObjectHandle"); + throw std::logic_error("operation attempted on uninitialized " + "QPDFObjectHandle"); } } @@ -654,8 +656,8 @@ QPDFObjectHandle::assertType(char const* type_name, bool istype) { if (! istype) { - throw QEXC::Internal(std::string("operation for ") + type_name + - " object attempted on object of wrong type"); + throw std::logic_error(std::string("operation for ") + type_name + + " object attempted on object of wrong type"); } } @@ -665,7 +667,7 @@ QPDFObjectHandle::assertPageObject() if (! (this->isDictionary() && this->hasKey("/Type") && (this->getKey("/Type").getName() == "/Page"))) { - throw QEXC::Internal("page operation called on non-Page object"); + throw std::logic_error("page operation called on non-Page object"); } } diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc index 4b6e7848..4d9b375a 100644 --- a/libqpdf/QPDFTokenizer.cc +++ b/libqpdf/QPDFTokenizer.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDFTokenizer.hh> // DO NOT USE ctype -- it is locale dependent for some things, and @@ -6,9 +5,9 @@ // be used. #include <qpdf/PCRE.hh> -#include <qpdf/QEXC.hh> #include <qpdf/QTC.hh> +#include <stdexcept> #include <string.h> // See note above about ctype. @@ -55,8 +54,9 @@ QPDFTokenizer::presentCharacter(char ch) if (state == st_token_ready) { - throw QEXC::Internal("QPDF tokenizer presented character " - "while token is waiting"); + throw std::logic_error( + "INTERNAL ERROR: QPDF tokenizer presented character " + "while token is waiting"); } char orig_ch = ch; @@ -237,8 +237,9 @@ QPDFTokenizer::presentCharacter(char ch) // last_char_was_bs is set/cleared below as appropriate if (bs_num_count) { - throw QEXC::Internal("QPDFTokenizer: bs_num_count != 0 " - "when ch == '\\'"); + throw std::logic_error( + "INTERNAL ERROR: QPDFTokenizer: bs_num_count != 0 " + "when ch == '\\'"); } } else if (ch == '(') @@ -333,7 +334,8 @@ QPDFTokenizer::presentCharacter(char ch) } else { - throw QEXC::Internal("invalid state while reading token"); + throw std::logic_error( + "INTERNAL ERROR: invalid state while reading token"); } if ((state == st_token_ready) && (type == tt_word)) diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index b4b4b6d2..88dc9e8f 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDFWriter.hh> #include <assert.h> @@ -479,8 +478,8 @@ QPDFWriter::enqueueObject(QPDFObjectHandle object) } else if (object.isScalar()) { - throw QEXC::Internal( - "QPDFWriter::enqueueObject: indirect scalar: " + + throw std::logic_error( + "INTERNAL ERROR: QPDFWriter::enqueueObject: indirect scalar: " + std::string(this->filename) + " " + QUtil::int_to_string(object.getObjectID()) + " " + QUtil::int_to_string(object.getGeneration())); @@ -559,8 +558,8 @@ QPDFWriter::unparseChild(QPDFObjectHandle child, int level, int flags) { if (child.isScalar()) { - throw QEXC::Internal( - "QPDFWriter::unparseChild: indirect scalar: " + + throw std::logic_error( + "INTERNAL ERROR: QPDFWriter::unparseChild: indirect scalar: " + QUtil::int_to_string(child.getObjectID()) + " " + QUtil::int_to_string(child.getGeneration())); } @@ -1599,7 +1598,7 @@ QPDFWriter::writeXRefStream(int xref_id, int max_id, int max_offset, break; default: - throw QEXC::Internal("invalid type writing xref stream"); + throw std::logic_error("invalid type writing xref stream"); break; } } diff --git a/libqpdf/QPDFXRefEntry.cc b/libqpdf/QPDFXRefEntry.cc index 68c58689..70c02579 100644 --- a/libqpdf/QPDFXRefEntry.cc +++ b/libqpdf/QPDFXRefEntry.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDFXRefEntry.hh> #include <qpdf/QPDFExc.hh> #include <qpdf/QUtil.hh> diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc index d1edbfdd..b7227f0d 100644 --- a/libqpdf/QPDF_Array.cc +++ b/libqpdf/QPDF_Array.cc @@ -1,7 +1,5 @@ - #include <qpdf/QPDF_Array.hh> - -#include <qpdf/QEXC.hh> +#include <stdexcept> QPDF_Array::QPDF_Array(std::vector<QPDFObjectHandle> const& items) : items(items) @@ -37,7 +35,8 @@ QPDF_Array::getItem(int n) const { if ((n < 0) || (n >= (int)this->items.size())) { - throw QEXC::Internal("bounds array accessing QPDF_Array element"); + throw std::logic_error( + "INTERNAL ERROR: bounds array accessing QPDF_Array element"); } return this->items[n]; } diff --git a/libqpdf/QPDF_Bool.cc b/libqpdf/QPDF_Bool.cc index 2b50c4c2..4bcbfc32 100644 --- a/libqpdf/QPDF_Bool.cc +++ b/libqpdf/QPDF_Bool.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDF_Bool.hh> QPDF_Bool::QPDF_Bool(bool val) : diff --git a/libqpdf/QPDF_Dictionary.cc b/libqpdf/QPDF_Dictionary.cc index 654df688..36c4590d 100644 --- a/libqpdf/QPDF_Dictionary.cc +++ b/libqpdf/QPDF_Dictionary.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDF_Dictionary.hh> #include <qpdf/QPDF_Null.hh> diff --git a/libqpdf/QPDF_Integer.cc b/libqpdf/QPDF_Integer.cc index 988519d0..da3b7dc9 100644 --- a/libqpdf/QPDF_Integer.cc +++ b/libqpdf/QPDF_Integer.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDF_Integer.hh> #include <qpdf/QUtil.hh> diff --git a/libqpdf/QPDF_Name.cc b/libqpdf/QPDF_Name.cc index c640fe83..ce2184f8 100644 --- a/libqpdf/QPDF_Name.cc +++ b/libqpdf/QPDF_Name.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDF_Name.hh> #include <string.h> diff --git a/libqpdf/QPDF_Null.cc b/libqpdf/QPDF_Null.cc index 57a78b7e..811ddd2e 100644 --- a/libqpdf/QPDF_Null.cc +++ b/libqpdf/QPDF_Null.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDF_Null.hh> QPDF_Null::~QPDF_Null() diff --git a/libqpdf/QPDF_Real.cc b/libqpdf/QPDF_Real.cc index 87a19cb2..9236e92e 100644 --- a/libqpdf/QPDF_Real.cc +++ b/libqpdf/QPDF_Real.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDF_Real.hh> QPDF_Real::QPDF_Real(std::string const& val) : diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index 5d12da32..a9e2ec51 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -1,7 +1,5 @@ - #include <qpdf/QPDF_Stream.hh> -#include <qpdf/QEXC.hh> #include <qpdf/QUtil.hh> #include <qpdf/Pipeline.hh> #include <qpdf/Pl_Flate.hh> @@ -17,6 +15,8 @@ #include <qpdf/QPDFExc.hh> #include <qpdf/Pl_QPDFTokenizer.hh> +#include <stdexcept> + QPDF_Stream::QPDF_Stream(QPDF* qpdf, int objid, int generation, QPDFObjectHandle stream_dict, off_t offset, int length) : @@ -29,8 +29,9 @@ QPDF_Stream::QPDF_Stream(QPDF* qpdf, int objid, int generation, { if (! stream_dict.isDictionary()) { - throw QEXC::Internal("stream object instantiated with non-dictionary " - "object for dictionary"); + throw std::logic_error( + "stream object instantiated with non-dictionary " + "object for dictionary"); } } @@ -298,8 +299,9 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool filter, } else { - throw QEXC::Internal("QPDFStream: unknown filter " - "encountered after check"); + throw std::logic_error( + "INTERNAL ERROR: QPDFStream: unknown filter " + "encountered after check"); } } } diff --git a/libqpdf/QPDF_String.cc b/libqpdf/QPDF_String.cc index 739006b4..69c2ecb7 100644 --- a/libqpdf/QPDF_String.cc +++ b/libqpdf/QPDF_String.cc @@ -1,4 +1,3 @@ - #include <qpdf/QPDF_String.hh> #include <qpdf/QUtil.hh> diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc index 02517aed..00766b60 100644 --- a/libqpdf/QPDF_encryption.cc +++ b/libqpdf/QPDF_encryption.cc @@ -386,7 +386,8 @@ QPDF::getKeyForObject(int objid, int generation) { if (! this->encrypted) { - throw QEXC::Internal("request for encryption key in non-encrypted PDF"); + throw std::logic_error( + "request for encryption key in non-encrypted PDF"); } if (! ((objid == this->cached_key_objid) && diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc index 281748b5..a6b1c2d0 100644 --- a/libqpdf/QPDF_linearization.cc +++ b/libqpdf/QPDF_linearization.cc @@ -1177,8 +1177,9 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) { // Note that we can't call optimize here because we don't know // whether it should be called with or without allow changes. - throw QEXC::Internal("QPDF::calculateLinearizationData " - "called before optimize()"); + throw std::logic_error( + "INTERNAL ERROR: QPDF::calculateLinearizationData " + "called before optimize()"); } // Separate objects into the categories sufficient for us to @@ -1336,8 +1337,9 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) break; case ObjUser::ou_bad: - throw QEXC::Internal("QPDF::calculateLinearizationData: " - "invalid user type"); + throw std::logic_error( + "INTERNAL ERROR: QPDF::calculateLinearizationData: " + "invalid user type"); break; } } @@ -1444,8 +1446,9 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) ObjGen first_page_og(pages[0].getObjectID(), pages[0].getGeneration()); if (! lc_first_page_private.count(first_page_og)) { - throw QEXC::Internal("QPDF::calculateLinearizationData: first page " - "object not in lc_first_page_private"); + throw std::logic_error( + "INTERNAL ERROR: QPDF::calculateLinearizationData: first page " + "object not in lc_first_page_private"); } lc_first_page_private.erase(first_page_og); this->c_linp.first_page_object = pages[0].getObjectID(); @@ -1492,7 +1495,8 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) ObjGen page_og(pages[i].getObjectID(), pages[i].getGeneration()); if (! lc_other_page_private.count(page_og)) { - throw QEXC::Internal( + throw std::logic_error( + "INTERNAL ERROR: " "QPDF::calculateLinearizationData: page object for page " + QUtil::int_to_string(i) + " not in lc_other_page_private"); } @@ -1522,8 +1526,9 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) // That should have covered all part7 objects. if (! lc_other_page_private.empty()) { - throw QEXC::Internal( - "QPDF::calculateLinearizationData: lc_other_page_private is " + throw std::logic_error( + "INTERNAL ERROR:" + " QPDF::calculateLinearizationData: lc_other_page_private is " "not empty after generation of part7"); } @@ -1601,7 +1606,8 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) } if (! lc_thumbnail_private.empty()) { - throw QEXC::Internal( + throw std::logic_error( + "INTERNAL ERROR: " "QPDF::calculateLinearizationData: lc_thumbnail_private " "not empty after placing thumbnails"); } @@ -1633,11 +1639,12 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) unsigned int num_wanted = this->object_to_obj_users.size(); if (num_placed != num_wanted) { - throw QEXC::Internal("QPDF::calculateLinearizationData: wrong " - "number of objects placed (num_placed = " + - QUtil::int_to_string(num_placed) + - "; number of objects: " + - QUtil::int_to_string(num_wanted)); + throw std::logic_error( + "INTERNAL ERROR: QPDF::calculateLinearizationData: wrong " + "number of objects placed (num_placed = " + + QUtil::int_to_string(num_placed) + + "; number of objects: " + + QUtil::int_to_string(num_wanted)); } // Calculate shared object hint table information including diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc index edd9bba9..7a45d43e 100644 --- a/libqpdf/QPDF_optimization.cc +++ b/libqpdf/QPDF_optimization.cc @@ -78,8 +78,9 @@ QPDF::flattenScalarReferences() { if (node.isScalar()) { - throw QEXC::Internal( - "flattenScalarReferences landed at indirect scalar"); + throw std::logic_error( + "INTERNAL ERROR:" + " flattenScalarReferences landed at indirect scalar"); } ObjGen og(node.getObjectID(), node.getGeneration()); if (visited.count(og) > 0) @@ -124,7 +125,8 @@ QPDF::flattenScalarReferences() { // QPDF_Dictionary.getKeys() never returns null // keys. - throw QEXC::Internal("dictionary with null key found"); + throw std::logic_error( + "INTERNAL ERROR: dictionary with null key found"); } else if (oh.isScalar()) { diff --git a/libqpdf/QTC.cc b/libqpdf/QTC.cc index eea7c514..5ce91aad 100644 --- a/libqpdf/QTC.cc +++ b/libqpdf/QTC.cc @@ -1,4 +1,3 @@ - #include <qpdf/QTC.hh> #include <set> 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 diff --git a/libqpdf/RC4.cc b/libqpdf/RC4.cc index 74b538b5..c51ebacd 100644 --- a/libqpdf/RC4.cc +++ b/libqpdf/RC4.cc @@ -1,4 +1,3 @@ - #include <qpdf/RC4.hh> #include <string.h> diff --git a/libqpdf/bits.icc b/libqpdf/bits.icc index 465bf5b9..e6abdf0e 100644 --- a/libqpdf/bits.icc +++ b/libqpdf/bits.icc @@ -3,8 +3,8 @@ #define __BITS_CC__ #include <algorithm> +#include <stdexcept> #include <qpdf/QTC.hh> -#include <qpdf/QEXC.hh> #include <qpdf/Pipeline.hh> // These functions may be run at places where the function call @@ -28,11 +28,11 @@ read_bits(unsigned char const*& p, unsigned int& bit_offset, if (bits_wanted > bits_available) { - throw QEXC::General("overflow reading bit stream"); + throw std::length_error("overflow reading bit stream"); } if (bits_wanted > 32) { - throw QEXC::Internal("read_bits: too many bits requested"); + throw std::out_of_range("read_bits: too many bits requested"); } unsigned long result = 0; @@ -99,7 +99,7 @@ write_bits(unsigned char& ch, unsigned int& bit_offset, { if (bits > 32) { - throw QEXC::Internal("write_bits: too many bits requested"); + throw std::out_of_range("write_bits: too many bits requested"); } // bit_offset + 1 is the number of bits left in ch diff --git a/libqpdf/build.mk b/libqpdf/build.mk index 3ee11dfa..6d807a6a 100644 --- a/libqpdf/build.mk +++ b/libqpdf/build.mk @@ -22,7 +22,6 @@ SRCS_libqpdf = \ libqpdf/Pl_QPDFTokenizer.cc \ libqpdf/Pl_RC4.cc \ libqpdf/Pl_StdioFile.cc \ - libqpdf/QEXC.cc \ libqpdf/QPDF.cc \ libqpdf/QPDFExc.cc \ libqpdf/QPDFObject.cc \ @@ -69,5 +68,5 @@ $(OBJS_libqpdf): libqpdf/$(OUTPUT_DIR)/%.lo: libqpdf/%.cc # * Otherwise, increment REVISION libqpdf/$(OUTPUT_DIR)/libqpdf.la: $(OBJS_libqpdf) - $(call makelib,$(OBJS_libqpdf),$@,2,1,1) + $(call makelib,$(OBJS_libqpdf),$@,3,0,0) diff --git a/libqpdf/qpdf/MD5.hh b/libqpdf/qpdf/MD5.hh index ae2e2113..c1babb29 100644 --- a/libqpdf/qpdf/MD5.hh +++ b/libqpdf/qpdf/MD5.hh @@ -1,10 +1,8 @@ - #ifndef __MD5_HH__ #define __MD5_HH__ #include <string> #include <qpdf/DLL.hh> -#include <qpdf/QEXC.hh> #include <qpdf/qpdf-config.h> #ifdef HAVE_INTTYPES_H # include <inttypes.h> @@ -26,8 +24,7 @@ class MD5 // encodes file and finalizes DLL_EXPORT - void encodeFile(char const* filename, int up_to_size = -1) - throw(QEXC::System); + void encodeFile(char const* filename, int up_to_size = -1); // appends string to current md5 object DLL_EXPORT diff --git a/libqpdf/qpdf/PCRE.hh b/libqpdf/qpdf/PCRE.hh index ba6f6670..919431a3 100644 --- a/libqpdf/qpdf/PCRE.hh +++ b/libqpdf/qpdf/PCRE.hh @@ -10,9 +10,9 @@ #endif #include <pcre.h> #include <string> +#include <stdexcept> #include <qpdf/DLL.hh> -#include <qpdf/QEXC.hh> // Note: this class does not encapsulate all features of the PCRE // package -- only those that I actually need right now are here. @@ -20,18 +20,9 @@ class PCRE { public: - class Exception: public QEXC::General - { - public: - DLL_EXPORT - Exception(std::string const& message); - DLL_EXPORT - virtual ~Exception() throw() {} - }; - // This is thrown when an attempt is made to access a non-existent // back reference. - class NoBackref: public Exception + class NoBackref: public std::logic_error { public: DLL_EXPORT @@ -65,14 +56,13 @@ class PCRE // see getMatch flags below DLL_EXPORT - std::string getMatch(int n, int flags = 0) - throw(QEXC::General, Exception); + std::string getMatch(int n, int flags = 0); DLL_EXPORT - void getOffsetLength(int n, int& offset, int& length) throw(Exception); + void getOffsetLength(int n, int& offset, int& length); DLL_EXPORT - int getOffset(int n) throw(Exception); + int getOffset(int n); DLL_EXPORT - int getLength(int n) throw(Exception); + int getLength(int n); // nMatches returns the number of available matches including // match 0 which is the whole string. In other words, if you @@ -105,14 +95,13 @@ class PCRE // The value passed in as options is passed to pcre_exec. See man // pcreapi for details. DLL_EXPORT - PCRE(char const* pattern, int options = 0) throw(Exception); + PCRE(char const* pattern, int options = 0); DLL_EXPORT ~PCRE(); DLL_EXPORT Match match(char const* subject, int options = 0, int startoffset = 0, - int size = -1) - throw(QEXC::General, Exception); + int size = -1); DLL_EXPORT static void test(int n = 0); diff --git a/libqpdf/qpdf/Pl_ASCII85Decoder.hh b/libqpdf/qpdf/Pl_ASCII85Decoder.hh index 6efd8199..a2c38da3 100644 --- a/libqpdf/qpdf/Pl_ASCII85Decoder.hh +++ b/libqpdf/qpdf/Pl_ASCII85Decoder.hh @@ -1,4 +1,3 @@ - #ifndef __PL_ASCII85DECODER_HH__ #define __PL_ASCII85DECODER_HH__ diff --git a/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh b/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh index 068294d7..8a7b1899 100644 --- a/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh +++ b/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh @@ -1,4 +1,3 @@ - #ifndef __PL_ASCIIHEXDECODER_HH__ #define __PL_ASCIIHEXDECODER_HH__ diff --git a/libqpdf/qpdf/Pl_LZWDecoder.hh b/libqpdf/qpdf/Pl_LZWDecoder.hh index 4d348406..3226cd6a 100644 --- a/libqpdf/qpdf/Pl_LZWDecoder.hh +++ b/libqpdf/qpdf/Pl_LZWDecoder.hh @@ -1,4 +1,3 @@ - #ifndef __PL_LZWDECODER_HH__ #define __PL_LZWDECODER_HH__ diff --git a/libqpdf/qpdf/Pl_MD5.hh b/libqpdf/qpdf/Pl_MD5.hh index 9da018d1..13973f29 100644 --- a/libqpdf/qpdf/Pl_MD5.hh +++ b/libqpdf/qpdf/Pl_MD5.hh @@ -1,4 +1,3 @@ - #ifndef __PL_MD5_HH__ #define __PL_MD5_HH__ diff --git a/libqpdf/qpdf/Pl_PNGFilter.hh b/libqpdf/qpdf/Pl_PNGFilter.hh index 1d9afabd..eb2ed028 100644 --- a/libqpdf/qpdf/Pl_PNGFilter.hh +++ b/libqpdf/qpdf/Pl_PNGFilter.hh @@ -19,21 +19,6 @@ class Pl_PNGFilter: public Pipeline { public: - class Exception: public Pipeline::Exception - { - public: - DLL_EXPORT - Exception(std::string const& message) : - Pipeline::Exception(message) - { - } - - DLL_EXPORT - virtual ~Exception() throw () - { - } - }; - // Encoding is not presently supported enum action_e { a_encode, a_decode }; diff --git a/libqpdf/qpdf/Pl_QPDFTokenizer.hh b/libqpdf/qpdf/Pl_QPDFTokenizer.hh index 448dbb18..d300d7cd 100644 --- a/libqpdf/qpdf/Pl_QPDFTokenizer.hh +++ b/libqpdf/qpdf/Pl_QPDFTokenizer.hh @@ -1,4 +1,3 @@ - #ifndef __PL_QPDFTOKENIZER_HH__ #define __PL_QPDFTOKENIZER_HH__ diff --git a/libqpdf/qpdf/Pl_RC4.hh b/libqpdf/qpdf/Pl_RC4.hh index 01b651a5..907b4af8 100644 --- a/libqpdf/qpdf/Pl_RC4.hh +++ b/libqpdf/qpdf/Pl_RC4.hh @@ -1,4 +1,3 @@ - #ifndef __PL_RC4_HH__ #define __PL_RC4_HH__ @@ -9,21 +8,6 @@ class Pl_RC4: public Pipeline { public: - class Exception: public Pipeline::Exception - { - public: - DLL_EXPORT - Exception(std::string const& message) : - Pipeline::Exception(message) - { - } - - DLL_EXPORT - virtual ~Exception() throw() - { - } - }; - static int const def_bufsize = 65536; // key_len of -1 means treat key_data as a null-terminated string diff --git a/libqpdf/qpdf/QPDF_Array.hh b/libqpdf/qpdf/QPDF_Array.hh index 371be50e..fce36a4c 100644 --- a/libqpdf/qpdf/QPDF_Array.hh +++ b/libqpdf/qpdf/QPDF_Array.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_ARRAY_HH__ #define __QPDF_ARRAY_HH__ diff --git a/libqpdf/qpdf/QPDF_Bool.hh b/libqpdf/qpdf/QPDF_Bool.hh index 06aca822..90dc590e 100644 --- a/libqpdf/qpdf/QPDF_Bool.hh +++ b/libqpdf/qpdf/QPDF_Bool.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_BOOL_HH__ #define __QPDF_BOOL_HH__ diff --git a/libqpdf/qpdf/QPDF_Dictionary.hh b/libqpdf/qpdf/QPDF_Dictionary.hh index b960050a..a6b1e77b 100644 --- a/libqpdf/qpdf/QPDF_Dictionary.hh +++ b/libqpdf/qpdf/QPDF_Dictionary.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_DICTIONARY_HH__ #define __QPDF_DICTIONARY_HH__ diff --git a/libqpdf/qpdf/QPDF_Integer.hh b/libqpdf/qpdf/QPDF_Integer.hh index fb6360b2..cc11cd65 100644 --- a/libqpdf/qpdf/QPDF_Integer.hh +++ b/libqpdf/qpdf/QPDF_Integer.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_INTEGER_HH__ #define __QPDF_INTEGER_HH__ diff --git a/libqpdf/qpdf/QPDF_Name.hh b/libqpdf/qpdf/QPDF_Name.hh index a32f6f4f..361556a0 100644 --- a/libqpdf/qpdf/QPDF_Name.hh +++ b/libqpdf/qpdf/QPDF_Name.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_NAME_HH__ #define __QPDF_NAME_HH__ diff --git a/libqpdf/qpdf/QPDF_Null.hh b/libqpdf/qpdf/QPDF_Null.hh index 60c1ae35..086a3228 100644 --- a/libqpdf/qpdf/QPDF_Null.hh +++ b/libqpdf/qpdf/QPDF_Null.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_NULL_HH__ #define __QPDF_NULL_HH__ diff --git a/libqpdf/qpdf/QPDF_Real.hh b/libqpdf/qpdf/QPDF_Real.hh index b950c569..76777477 100644 --- a/libqpdf/qpdf/QPDF_Real.hh +++ b/libqpdf/qpdf/QPDF_Real.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_REAL_HH__ #define __QPDF_REAL_HH__ diff --git a/libqpdf/qpdf/QPDF_Stream.hh b/libqpdf/qpdf/QPDF_Stream.hh index 71381fd3..c969255d 100644 --- a/libqpdf/qpdf/QPDF_Stream.hh +++ b/libqpdf/qpdf/QPDF_Stream.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_STREAM_HH__ #define __QPDF_STREAM_HH__ diff --git a/libqpdf/qpdf/QPDF_String.hh b/libqpdf/qpdf/QPDF_String.hh index f3063c50..82860e9d 100644 --- a/libqpdf/qpdf/QPDF_String.hh +++ b/libqpdf/qpdf/QPDF_String.hh @@ -1,4 +1,3 @@ - #ifndef __QPDF_STRING_HH__ #define __QPDF_STRING_HH__ diff --git a/libqpdf/qpdf/RC4.hh b/libqpdf/qpdf/RC4.hh index 657bf35b..c26f3d0f 100644 --- a/libqpdf/qpdf/RC4.hh +++ b/libqpdf/qpdf/RC4.hh @@ -1,4 +1,3 @@ - #ifndef __RC4_HH__ #define __RC4_HH__ |