From ae3642ce42e23bc454ee81e6383100b696670b37 Mon Sep 17 00:00:00 2001 From: m-holger Date: Thu, 1 Jun 2023 14:47:36 +0100 Subject: [PATCH] Code tidy - Clang-Tidy rule modernize-use-equals-default --- examples/pdf-count-strings.cc | 4 +--- include/qpdf/QPDF.hh | 32 --------------------------- include/qpdf/QPDFJob.hh | 4 ---- libqpdf/ClosedFileInputSource.cc | 2 +- libqpdf/Pl_Buffer.cc | 2 +- libqpdf/Pl_Concatenate.cc | 2 +- libqpdf/Pl_Count.cc | 2 +- libqpdf/Pl_DCT.cc | 2 +- libqpdf/Pl_Discard.cc | 2 +- libqpdf/Pl_Flate.cc | 2 +- libqpdf/Pl_Function.cc | 2 +- libqpdf/Pl_OStream.cc | 2 +- libqpdf/Pl_QPDFTokenizer.cc | 2 +- libqpdf/Pl_RunLength.cc | 2 +- libqpdf/Pl_StdioFile.cc | 2 +- libqpdf/Pl_String.cc | 2 +- libqpdf/QPDFDocumentHelper.cc | 2 +- libqpdf/QPDFFormFieldObjectHelper.cc | 10 ++------- libqpdf/QPDFNameTreeObjectHelper.cc | 2 +- libqpdf/QPDFNumberTreeObjectHelper.cc | 2 +- libqpdf/QPDFObjectHandle.cc | 2 +- libqpdf/QPDFObjectHelper.cc | 2 +- libqpdf/QPDFWriter.cc | 5 +++-- libqpdf/QPDFXRefEntry.cc | 2 +- libqpdf/qpdf/QPDFArgParser.hh | 3 --- libtests/dct_compress.cc | 4 +--- 26 files changed, 26 insertions(+), 74 deletions(-) diff --git a/examples/pdf-count-strings.cc b/examples/pdf-count-strings.cc index 2e2ef8bf..2b5b5573 100644 --- a/examples/pdf-count-strings.cc +++ b/examples/pdf-count-strings.cc @@ -26,9 +26,7 @@ usage() class StringCounter: public QPDFObjectHandle::TokenFilter { public: - StringCounter() - { - } + StringCounter() = default; ~StringCounter() override = default; void handleToken(QPDFTokenizer::Token const&) override; void handleEOF() override; diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index d5266066..ee0a7b79 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -1150,10 +1150,6 @@ class QPDF // PDF 1.4: Table F.4 struct HPageOffsetEntry { - HPageOffsetEntry() - { - } - int delta_nobjects{0}; // 1 qpdf_offset_t delta_page_length{0}; // 2 // vectors' sizes = nshared_objects @@ -1167,10 +1163,6 @@ class QPDF // PDF 1.4: Table F.3 struct HPageOffset { - HPageOffset() - { - } - int min_nobjects{0}; // 1 qpdf_offset_t first_page_offset{0}; // 2 int nbits_delta_nobjects{0}; // 3 @@ -1191,10 +1183,6 @@ class QPDF // PDF 1.4: Table F.6 struct HSharedObjectEntry { - HSharedObjectEntry() - { - } - // Item 3 is a 128-bit signature (unsupported by Acrobat) int delta_group_length{0}; // 1 int signature_present{0}; // 2 -- always 0 @@ -1204,10 +1192,6 @@ class QPDF // PDF 1.4: Table F.5 struct HSharedObject { - HSharedObject() - { - } - int first_shared_obj{0}; // 1 qpdf_offset_t first_shared_offset{0}; // 2 int nshared_first_page{0}; // 3 @@ -1222,10 +1206,6 @@ class QPDF // PDF 1.4: Table F.9 struct HGeneric { - HGeneric() - { - } - int first_object{0}; // 1 qpdf_offset_t first_object_offset{0}; // 2 int nobjects{0}; // 3 @@ -1237,10 +1217,6 @@ class QPDF // Initialized from Linearization Parameter dictionary struct LinParameters { - LinParameters() - { - } - qpdf_offset_t file_size{0}; // /L int first_page_object{0}; // /O qpdf_offset_t first_page_end{0}; // /E @@ -1264,10 +1240,6 @@ class QPDF struct CHPageOffsetEntry { - CHPageOffsetEntry() - { - } - int nobjects{0}; int nshared_objects{0}; // vectors' sizes = nshared_objects @@ -1293,10 +1265,6 @@ class QPDF // PDF 1.4: Table F.5 struct CHSharedObject { - CHSharedObject() - { - } - int first_shared_obj{0}; int nshared_first_page{0}; int nshared_total{0}; diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index e00ce7d2..b9c8ba50 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -145,10 +145,6 @@ class QPDFJob struct AddAttachment { - AddAttachment() - { - } - std::string path; std::string key; std::string filename; diff --git a/libqpdf/ClosedFileInputSource.cc b/libqpdf/ClosedFileInputSource.cc index 5e607a76..2a6cb897 100644 --- a/libqpdf/ClosedFileInputSource.cc +++ b/libqpdf/ClosedFileInputSource.cc @@ -9,7 +9,7 @@ ClosedFileInputSource::ClosedFileInputSource(char const* filename) : { } -ClosedFileInputSource::~ClosedFileInputSource() +ClosedFileInputSource::~ClosedFileInputSource() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_Buffer.cc b/libqpdf/Pl_Buffer.cc index c3184104..b10cf544 100644 --- a/libqpdf/Pl_Buffer.cc +++ b/libqpdf/Pl_Buffer.cc @@ -11,7 +11,7 @@ Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) : { } -Pl_Buffer::~Pl_Buffer() +Pl_Buffer::~Pl_Buffer() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_Concatenate.cc b/libqpdf/Pl_Concatenate.cc index 8f974c05..82ec0bd4 100644 --- a/libqpdf/Pl_Concatenate.cc +++ b/libqpdf/Pl_Concatenate.cc @@ -5,7 +5,7 @@ Pl_Concatenate::Pl_Concatenate(char const* identifier, Pipeline* next) : { } -Pl_Concatenate::~Pl_Concatenate() +Pl_Concatenate::~Pl_Concatenate() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_Count.cc b/libqpdf/Pl_Count.cc index 07bb2654..4a0d6cef 100644 --- a/libqpdf/Pl_Count.cc +++ b/libqpdf/Pl_Count.cc @@ -14,7 +14,7 @@ Pl_Count::Pl_Count(char const* identifier, Pipeline* next) : { } -Pl_Count::~Pl_Count() +Pl_Count::~Pl_Count() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_DCT.cc b/libqpdf/Pl_DCT.cc index f82fc2aa..042d3977 100644 --- a/libqpdf/Pl_DCT.cc +++ b/libqpdf/Pl_DCT.cc @@ -75,7 +75,7 @@ Pl_DCT::Pl_DCT( { } -Pl_DCT::~Pl_DCT() +Pl_DCT::~Pl_DCT() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_Discard.cc b/libqpdf/Pl_Discard.cc index d9ddaef3..643d3e4f 100644 --- a/libqpdf/Pl_Discard.cc +++ b/libqpdf/Pl_Discard.cc @@ -7,7 +7,7 @@ Pl_Discard::Pl_Discard() : { } -Pl_Discard::~Pl_Discard() +Pl_Discard::~Pl_Discard() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_Flate.cc b/libqpdf/Pl_Flate.cc index f43c0b7f..d332e635 100644 --- a/libqpdf/Pl_Flate.cc +++ b/libqpdf/Pl_Flate.cc @@ -58,7 +58,7 @@ Pl_Flate::Pl_Flate( { } -Pl_Flate::~Pl_Flate() +Pl_Flate::~Pl_Flate() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_Function.cc b/libqpdf/Pl_Function.cc index c75df2a4..00d7f5b0 100644 --- a/libqpdf/Pl_Function.cc +++ b/libqpdf/Pl_Function.cc @@ -39,7 +39,7 @@ Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_c_char_t }; } -Pl_Function::~Pl_Function() +Pl_Function::~Pl_Function() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_OStream.cc b/libqpdf/Pl_OStream.cc index 73fbad21..9b1995a4 100644 --- a/libqpdf/Pl_OStream.cc +++ b/libqpdf/Pl_OStream.cc @@ -13,7 +13,7 @@ Pl_OStream::Pl_OStream(char const* identifier, std::ostream& os) : { } -Pl_OStream::~Pl_OStream() +Pl_OStream::~Pl_OStream() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_QPDFTokenizer.cc b/libqpdf/Pl_QPDFTokenizer.cc index 576c2bfb..7bb86d5f 100644 --- a/libqpdf/Pl_QPDFTokenizer.cc +++ b/libqpdf/Pl_QPDFTokenizer.cc @@ -21,7 +21,7 @@ Pl_QPDFTokenizer::Pl_QPDFTokenizer( m->tokenizer.includeIgnorable(); } -Pl_QPDFTokenizer::~Pl_QPDFTokenizer() +Pl_QPDFTokenizer::~Pl_QPDFTokenizer() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_RunLength.cc b/libqpdf/Pl_RunLength.cc index d1a5e318..0d3bba2c 100644 --- a/libqpdf/Pl_RunLength.cc +++ b/libqpdf/Pl_RunLength.cc @@ -16,7 +16,7 @@ Pl_RunLength::Pl_RunLength(char const* identifier, Pipeline* next, action_e acti { } -Pl_RunLength::~Pl_RunLength() +Pl_RunLength::~Pl_RunLength() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_StdioFile.cc b/libqpdf/Pl_StdioFile.cc index a95d4898..24e11244 100644 --- a/libqpdf/Pl_StdioFile.cc +++ b/libqpdf/Pl_StdioFile.cc @@ -17,7 +17,7 @@ Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) : { } -Pl_StdioFile::~Pl_StdioFile() +Pl_StdioFile::~Pl_StdioFile() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/Pl_String.cc b/libqpdf/Pl_String.cc index 40c4b56f..9009268a 100644 --- a/libqpdf/Pl_String.cc +++ b/libqpdf/Pl_String.cc @@ -13,7 +13,7 @@ Pl_String::Pl_String(char const* identifier, Pipeline* next, std::string& s) : { } -Pl_String::~Pl_String() +Pl_String::~Pl_String() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/QPDFDocumentHelper.cc b/libqpdf/QPDFDocumentHelper.cc index cdafc5fb..9bda5b52 100644 --- a/libqpdf/QPDFDocumentHelper.cc +++ b/libqpdf/QPDFDocumentHelper.cc @@ -1,6 +1,6 @@ #include -QPDFDocumentHelper::~QPDFDocumentHelper() +QPDFDocumentHelper::~QPDFDocumentHelper() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/QPDFFormFieldObjectHelper.cc b/libqpdf/QPDFFormFieldObjectHelper.cc index ff21c522..4f7ca0e1 100644 --- a/libqpdf/QPDFFormFieldObjectHelper.cc +++ b/libqpdf/QPDFFormFieldObjectHelper.cc @@ -647,10 +647,8 @@ namespace class TfFinder: public QPDFObjectHandle::TokenFilter { public: - TfFinder(); - ~TfFinder() override - { - } + TfFinder() = default; + ~TfFinder() override = default; void handleToken(QPDFTokenizer::Token const&) override; double getTf(); std::string getFontName(); @@ -667,10 +665,6 @@ namespace }; } // namespace -TfFinder::TfFinder() -{ -} - void TfFinder::handleToken(QPDFTokenizer::Token const& token) { diff --git a/libqpdf/QPDFNameTreeObjectHelper.cc b/libqpdf/QPDFNameTreeObjectHelper.cc index b90c000d..9a2a6284 100644 --- a/libqpdf/QPDFNameTreeObjectHelper.cc +++ b/libqpdf/QPDFNameTreeObjectHelper.cc @@ -34,7 +34,7 @@ namespace static NameTreeDetails name_tree_details; -QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() +QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer. For this specific // class, see github issue #745. diff --git a/libqpdf/QPDFNumberTreeObjectHelper.cc b/libqpdf/QPDFNumberTreeObjectHelper.cc index 64182306..478a1884 100644 --- a/libqpdf/QPDFNumberTreeObjectHelper.cc +++ b/libqpdf/QPDFNumberTreeObjectHelper.cc @@ -35,7 +35,7 @@ namespace static NumberTreeDetails number_tree_details; -QPDFNumberTreeObjectHelper::~QPDFNumberTreeObjectHelper() +QPDFNumberTreeObjectHelper::~QPDFNumberTreeObjectHelper() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer. For this specific // class, see github issue #745. diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index c63a2e41..9ec87f79 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -49,7 +49,7 @@ QPDFObjectHandle::StreamDataProvider::StreamDataProvider(bool supports_retry) : { } -QPDFObjectHandle::StreamDataProvider::~StreamDataProvider() +QPDFObjectHandle::StreamDataProvider::~StreamDataProvider() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/QPDFObjectHelper.cc b/libqpdf/QPDFObjectHelper.cc index eb7de06e..cbd54f3d 100644 --- a/libqpdf/QPDFObjectHelper.cc +++ b/libqpdf/QPDFObjectHelper.cc @@ -1,6 +1,6 @@ #include -QPDFObjectHelper::~QPDFObjectHelper() +QPDFObjectHelper::~QPDFObjectHelper() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 50594a09..f9ab17d0 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -26,7 +26,7 @@ #include #include -QPDFWriter::ProgressReporter::~ProgressReporter() +QPDFWriter::ProgressReporter::~ProgressReporter() // NOLINT (modernize-use-equals-default) { // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer } @@ -36,7 +36,8 @@ QPDFWriter::FunctionProgressReporter::FunctionProgressReporter(std::function #include -QPDFXRefEntry::QPDFXRefEntry() +QPDFXRefEntry::QPDFXRefEntry() // NOLINT (modernize-use-equals-default) { } diff --git a/libqpdf/qpdf/QPDFArgParser.hh b/libqpdf/qpdf/QPDFArgParser.hh index 97fd99c5..ed161d53 100644 --- a/libqpdf/qpdf/QPDFArgParser.hh +++ b/libqpdf/qpdf/QPDFArgParser.hh @@ -145,9 +145,6 @@ class QPDFArgParser private: struct OptionEntry { - OptionEntry() - { - } bool parameter_needed{false}; std::string parameter_name; std::set choices; diff --git a/libtests/dct_compress.cc b/libtests/dct_compress.cc index ab6e3b53..8f7e0913 100644 --- a/libtests/dct_compress.cc +++ b/libtests/dct_compress.cc @@ -17,9 +17,7 @@ usage() class Callback: public Pl_DCT::CompressConfig { public: - Callback() - { - } + Callback() = default; ~Callback() override = default; void apply(jpeg_compress_struct*) override; bool called{false};