Merge pull request #963 from m-holger/tidy

Code tidy
This commit is contained in:
Jay Berkenbilt 2023-05-20 11:29:09 -04:00 committed by GitHub
commit fd17c8e3fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
148 changed files with 400 additions and 483 deletions

View File

@ -5,8 +5,8 @@
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
// This program demonstrates extraction of bookmarks using the qpdf
// outlines API. Note that all the information shown by this program

View File

@ -5,14 +5,12 @@
//
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/QPDF.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFPageDocumentHelper.hh>
#include <qpdf/QPDFPageObjectHelper.hh>
#include <qpdf/QUtil.hh>
static char const* whoami = nullptr;
@ -32,9 +30,9 @@ class StringCounter: public QPDFObjectHandle::TokenFilter
count(0)
{
}
virtual ~StringCounter() = default;
virtual void handleToken(QPDFTokenizer::Token const&);
virtual void handleEOF();
~StringCounter() override = default;
void handleToken(QPDFTokenizer::Token const&) override;
void handleEOF() override;
int getCount() const;
private:

View File

@ -12,13 +12,11 @@
#include <qpdf/QPDF.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFPageDocumentHelper.hh>
#include <qpdf/QPDFPageObjectHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <memory>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
static char const* whoami = nullptr;
@ -28,8 +26,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider
{
public:
ImageProvider(std::string const& color_space, std::string const& filter);
virtual ~ImageProvider() = default;
virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline);
~ImageProvider() override = default;
void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
size_t getWidth() const;
size_t getHeight() const;
@ -168,7 +166,7 @@ add_page(
// mode. Since we are not specifying, QPDFWriter will compress
// with /FlateDecode if we don't provide any other form of
// compression.
ImageProvider* p = new ImageProvider(color_space, filter);
auto* p = new ImageProvider(color_space, filter);
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
size_t width = p->getWidth();
size_t height = p->getHeight();
@ -288,7 +286,7 @@ check(
if (!this_errors) {
// Check image data
auto actual_data = image.getStreamData(qpdf_dl_all);
ImageProvider* p = new ImageProvider(desired_color_space, "null");
auto* p = new ImageProvider(desired_color_space, "null");
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
Pl_Buffer b_p("get image data");
provider->provideStreamData(QPDFObjGen(), &b_p);

View File

@ -48,9 +48,9 @@ class Pl_XOR: public Pipeline
public:
Pl_XOR(char const* identifier, Pipeline* next, unsigned char key);
virtual ~Pl_XOR() = default;
virtual void write(unsigned char const* data, size_t len) override;
virtual void finish() override;
~Pl_XOR() override = default;
void write(unsigned char const* data, size_t len) override;
void finish() override;
private:
unsigned char key;
@ -91,10 +91,10 @@ class SF_XORDecode: public QPDFStreamFilter
// filter, which just means QPDF assumes that it should not
// "uncompress" the stream by default.
public:
virtual ~SF_XORDecode() = default;
virtual bool setDecodeParms(QPDFObjectHandle decode_parms) override;
virtual Pipeline* getDecodePipeline(Pipeline* next) override;
virtual bool isSpecializedCompression() override;
~SF_XORDecode() override = default;
bool setDecodeParms(QPDFObjectHandle decode_parms) override;
Pipeline* getDecodePipeline(Pipeline* next) override;
bool isSpecializedCompression() override;
private:
unsigned char key;
@ -199,8 +199,8 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider
public:
StreamReplacer(QPDF* pdf);
virtual ~StreamReplacer() = default;
virtual void
~StreamReplacer() override = default;
void
provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
void registerStream(
@ -409,7 +409,7 @@ process(
// Create a single StreamReplacer instance. The interface requires
// a std::shared_ptr in various places, so allocate a StreamReplacer
// and stash it in a std::shared_ptr.
StreamReplacer* replacer = new StreamReplacer(&qpdf);
auto* replacer = new StreamReplacer(&qpdf);
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer);
for (auto& o: qpdf.getAllObjects()) {

View File

@ -5,8 +5,8 @@
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
static char const* whoami = nullptr;

View File

@ -8,13 +8,11 @@
#include <algorithm>
#include <deque>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <qpdf/QPDF.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFPageDocumentHelper.hh>
#include <qpdf/QPDFPageObjectHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
@ -35,8 +33,8 @@ usage()
class StringReverser: public QPDFObjectHandle::TokenFilter
{
public:
virtual ~StringReverser() = default;
virtual void handleToken(QPDFTokenizer::Token const&);
~StringReverser() override = default;
void handleToken(QPDFTokenizer::Token const&) override;
};
void
@ -68,9 +66,9 @@ StringReverser::handleToken(QPDFTokenizer::Token const& token)
class ColorToGray: public QPDFObjectHandle::TokenFilter
{
public:
virtual ~ColorToGray() = default;
virtual void handleToken(QPDFTokenizer::Token const&);
virtual void handleEOF();
~ColorToGray() override = default;
void handleToken(QPDFTokenizer::Token const&) override;
void handleEOF() override;
private:
bool isNumeric(QPDFTokenizer::token_type_e);

View File

@ -6,8 +6,8 @@
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
static char const* whoami = nullptr;
@ -33,8 +33,8 @@ usage()
class ImageInverter: public QPDFObjectHandle::StreamDataProvider
{
public:
virtual ~ImageInverter() = default;
virtual void
~ImageInverter() override = default;
void
provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
void registerImage(
@ -124,7 +124,7 @@ main(int argc, char* argv[])
QPDF qpdf;
qpdf.processFile(infilename, password);
ImageInverter* inv = new ImageInverter;
auto* inv = new ImageInverter;
auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(inv);
// For each page...

View File

@ -6,9 +6,9 @@
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
static char const* version = "1.1";
static char const* whoami = nullptr;

View File

@ -3,7 +3,6 @@
#include <qpdf/QPDFNumberTreeObjectHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <cstring>
#include <iostream>
static char const* whoami = nullptr;

View File

@ -1,6 +1,6 @@
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
#include <qpdf/QPDF.hh>
#include <qpdf/QUtil.hh>

View File

@ -4,8 +4,7 @@
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
// This program demonstrates use of form XObjects to overlay a page
// from one file onto all pages of another file. The qpdf program's

View File

@ -1,6 +1,5 @@
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <qpdf/QIntC.hh>
#include <qpdf/QPDF.hh>
@ -23,10 +22,10 @@ usage()
class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks
{
public:
virtual ~ParserCallbacks() = default;
virtual void contentSize(size_t);
virtual void handleObject(QPDFObjectHandle, size_t offset, size_t length);
virtual void handleEOF();
~ParserCallbacks() override = default;
void contentSize(size_t) override;
void handleObject(QPDFObjectHandle, size_t offset, size_t length) override;
void handleEOF() override;
};
void

View File

@ -4,9 +4,7 @@
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
static char const* whoami = nullptr;

View File

@ -12,7 +12,7 @@
#include <cstring>
#include <iostream>
#include <stdlib.h>
#include <cstdlib>
#include <string>
static bool static_id = false;

View File

@ -1,8 +1,6 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QPDFJob.hh>
#include <qpdf/QUtil.hh>
#include <cstring>
#include <iostream>
// This program is a simple demonstration of different ways to use the

View File

@ -1,4 +1,3 @@
#include <qpdf/Constants.h>
#include <qpdf/qpdfjob-c.h>
#include <qpdf/qpdflogger-c.h>

View File

@ -4,7 +4,6 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
// This example demonstrates how we can use the QPDFJob createQPDF and writeQPDF
@ -12,7 +11,7 @@
// The example is a full copy of the qpdf program modified to allways remove all
// annotations from the final output.
static char const* whoami = 0;
static char const* whoami = nullptr;
static void
usageExit(std::string const& msg)

View File

@ -14,13 +14,13 @@
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
{
public:
virtual ~DiscardContents() = default;
virtual void
handleObject(QPDFObjectHandle)
~DiscardContents() override = default;
void
handleObject(QPDFObjectHandle) override
{
}
virtual void
handleEOF()
void
handleEOF() override
{
}
};

View File

@ -26,7 +26,7 @@
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
#include <memory>
#include <stddef.h>
#include <cstddef>
class Buffer
{

View File

@ -27,7 +27,7 @@
#include <qpdf/Types.h>
#include <memory>
#include <stdio.h>
#include <cstdio>
#include <string>
// Remember to use QPDF_DLL_CLASS on anything derived from InputSource

View File

@ -369,8 +369,8 @@ class JSON
JSON_value(vt_dictionary)
{
}
virtual ~JSON_dictionary() = default;
virtual void write(Pipeline*, size_t depth) const;
~JSON_dictionary() override = default;
void write(Pipeline*, size_t depth) const override;
std::map<std::string, JSON> members;
std::set<std::string> parsed_keys;
};
@ -380,15 +380,15 @@ class JSON
JSON_value(vt_array)
{
}
virtual ~JSON_array() = default;
virtual void write(Pipeline*, size_t depth) const;
~JSON_array() override = default;
void write(Pipeline*, size_t depth) const override;
std::vector<JSON> elements;
};
struct JSON_string: public JSON_value
{
JSON_string(std::string const& utf8);
virtual ~JSON_string() = default;
virtual void write(Pipeline*, size_t depth) const;
~JSON_string() override = default;
void write(Pipeline*, size_t depth) const override;
std::string utf8;
std::string encoded;
};
@ -397,15 +397,15 @@ class JSON
JSON_number(long long val);
JSON_number(double val);
JSON_number(std::string const& val);
virtual ~JSON_number() = default;
virtual void write(Pipeline*, size_t depth) const;
~JSON_number() override = default;
void write(Pipeline*, size_t depth) const override;
std::string encoded;
};
struct JSON_bool: public JSON_value
{
JSON_bool(bool val);
virtual ~JSON_bool() = default;
virtual void write(Pipeline*, size_t depth) const;
~JSON_bool() override = default;
void write(Pipeline*, size_t depth) const override;
bool value;
};
struct JSON_null: public JSON_value
@ -414,14 +414,14 @@ class JSON
JSON_value(vt_null)
{
}
virtual ~JSON_null() = default;
virtual void write(Pipeline*, size_t depth) const;
~JSON_null() override = default;
void write(Pipeline*, size_t depth) const override;
};
struct JSON_blob: public JSON_value
{
JSON_blob(std::function<void(Pipeline*)> fn);
virtual ~JSON_blob() = default;
virtual void write(Pipeline*, size_t depth) const;
~JSON_blob() override = default;
void write(Pipeline*, size_t depth) const override;
std::function<void(Pipeline*)> fn;
};

View File

@ -43,13 +43,13 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
{
public:
QPDF_DLL
Pl_Buffer(char const* identifier, Pipeline* next = 0);
Pl_Buffer(char const* identifier, Pipeline* next = nullptr);
QPDF_DLL
virtual ~Pl_Buffer();
~Pl_Buffer() override;
QPDF_DLL
virtual void write(unsigned char const*, size_t);
void write(unsigned char const*, size_t) override;
QPDF_DLL
virtual void finish();
void finish() override;
// Each call to getBuffer() resets this object -- see notes above.
// The caller is responsible for deleting the returned Buffer

View File

@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
JDIMENSION image_height,
int components,
J_COLOR_SPACE color_space,
CompressConfig* config_callback = 0);
CompressConfig* config_callback = nullptr);
QPDF_DLL
virtual ~Pl_DCT();
@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
JDIMENSION image_height = 0,
int components = 1,
J_COLOR_SPACE color_space = JCS_GRAYSCALE,
CompressConfig* config_callback = 0);
CompressConfig* config_callback = nullptr);
Members(Members const&) = delete;
action_e action;

View File

@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
Pl_QPDFTokenizer(
char const* identifier,
QPDFObjectHandle::TokenFilter* filter,
Pipeline* next = 0);
Pipeline* next = nullptr);
QPDF_DLL
virtual ~Pl_QPDFTokenizer();
QPDF_DLL

View File

@ -26,7 +26,7 @@
#include <qpdf/Pipeline.hh>
#include <stdio.h>
#include <cstdio>
//
// This pipeline is reusable.

View File

@ -30,7 +30,7 @@
#include <list>
#include <map>
#include <memory>
#include <stdio.h>
#include <cstdio>
#include <string>
#include <string_view>
#include <vector>
@ -83,7 +83,7 @@ class QPDF
// interpreted as a raw encryption key. See comments on
// setPasswordIsHexKey for more information.
QPDF_DLL
void processFile(char const* filename, char const* password = 0);
void processFile(char const* filename, char const* password = nullptr);
// Parse a PDF from a stdio FILE*. The FILE must be open in
// binary mode and must be seekable. It may be open read only.
@ -96,7 +96,7 @@ class QPDF
char const* description,
FILE* file,
bool close_file,
char const* password = 0);
char const* password = nullptr);
// Parse a PDF file loaded into a memory buffer. This works
// exactly like processFile except that the PDF file is in memory
@ -107,14 +107,14 @@ class QPDF
char const* description,
char const* buf,
size_t length,
char const* password = 0);
char const* password = nullptr);
// Parse a PDF file loaded from a custom InputSource. If you have
// your own method of retrieving a PDF file, you can subclass
// InputSource and use this method.
QPDF_DLL
void
processInputSource(std::shared_ptr<InputSource>, char const* password = 0);
processInputSource(std::shared_ptr<InputSource>, char const* password = nullptr);
// Create a PDF from an input source that contains JSON as written
// by writeJSON (or qpdf --json-output, version 2 or higher). The

View File

@ -80,7 +80,7 @@ class QPDF_DLL_CLASS QPDFCryptoImpl
virtual void RC4_process(
unsigned char const* in_data,
size_t len,
unsigned char* out_data = 0) = 0;
unsigned char* out_data = nullptr) = 0;
QPDF_DLL
virtual void RC4_finalize() = 0;

View File

@ -497,7 +497,7 @@ class QPDFJob
// Helper functions
static void usage(std::string const& msg);
static JSON json_schema(int json_version, std::set<std::string>* keys = 0);
static JSON json_schema(int json_version, std::set<std::string>* keys = nullptr);
static void parse_object_id(
std::string const& objspec, bool& trailer, int& obj, int& gen);
void parseRotationParameter(std::string const&);

View File

@ -526,7 +526,7 @@ class QPDFObjectHandle
QPDF_DLL
void parsePageContents(ParserCallbacks* callbacks);
QPDF_DLL
void filterPageContents(TokenFilter* filter, Pipeline* next = 0);
void filterPageContents(TokenFilter* filter, Pipeline* next = nullptr);
// See comments for QPDFPageObjectHelper::pipeContents.
QPDF_DLL
void pipePageContents(Pipeline* p);
@ -538,7 +538,7 @@ class QPDFObjectHandle
// contents. This can be used to apply a TokenFilter to a form
// XObject, whose data is in the same format as a content stream.
QPDF_DLL
void filterAsContents(TokenFilter* filter, Pipeline* next = 0);
void filterAsContents(TokenFilter* filter, Pipeline* next = nullptr);
// Called on a stream to parse the stream as page contents. This
// can be used to parse a form XObject.
QPDF_DLL

View File

@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
{
// This must be cleared explicitly to avoid circular references
// that prevent cleanup of pointer holders.
this->m->parent = 0;
this->m->parent = nullptr;
}
// All constructors are private. You can only create one of these

View File

@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
// examples/pdf-count-strings.cc for an example.
QPDF_DLL
void
filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0);
filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
// Old name -- calls filterContents()
QPDF_DLL
void filterPageContents(
QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0);
QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
// Pipe a page's contents through the given pipeline. This method
// works whether the contents are a single stream or an array of

View File

@ -28,7 +28,7 @@
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
#include <memory>
#include <stdio.h>
#include <cstdio>
#include <string>
class QPDFTokenizer

View File

@ -34,7 +34,7 @@
#include <map>
#include <memory>
#include <set>
#include <stdio.h>
#include <cstdio>
#include <string>
#include <string_view>
#include <vector>
@ -102,7 +102,7 @@ class QPDFWriter
QPDF_DLL
virtual ~FunctionProgressReporter();
QPDF_DLL
virtual void reportProgress(int) override;
void reportProgress(int) override;
private:
std::function<void(int)> handler;
@ -539,7 +539,7 @@ class QPDFWriter
friend class QPDFWriter;
public:
PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = 0) :
PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = nullptr) :
qw(qw),
bp(bp)
{

View File

@ -30,9 +30,9 @@
#include <list>
#include <memory>
#include <stdexcept>
#include <stdio.h>
#include <cstdio>
#include <string>
#include <time.h>
#include <ctime>
#include <vector>
class RandomDataProvider;
@ -245,7 +245,7 @@ namespace QUtil
// Returns true iff the variable is defined. If `value' is
// non-null, initializes it with the value of the variable.
QPDF_DLL
bool get_env(std::string const& var, std::string* value = 0);
bool get_env(std::string const& var, std::string* value = nullptr);
QPDF_DLL
time_t get_current_time();

View File

@ -23,7 +23,7 @@
#define RANDOMDATAPROVIDER_HH
#include <qpdf/DLL.h>
#include <string.h> // for size_t
#include <cstring> // for size_t
class QPDF_DLL_CLASS RandomDataProvider
{

View File

@ -2,10 +2,8 @@
#include <qpdf/QIntC.hh>
#include <algorithm>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <string.h>
#include <cstring>
BufferInputSource::BufferInputSource(
std::string const& description, Buffer* buf, bool own_memory) :

View File

@ -3,7 +3,7 @@
#include <qpdf/QPDFExc.hh>
#include <qpdf/QUtil.hh>
#include <algorithm>
#include <string.h>
#include <cstring>
FileInputSource::FileInputSource() :
close_file(false),

View File

@ -3,7 +3,7 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QTC.hh>
#include <stdexcept>
#include <string.h>
#include <cstring>
void
InputSource::setLastOffset(qpdf_offset_t offset)

View File

@ -2,7 +2,7 @@
#include <qpdf/QUtil.hh>
#include <qpdf/qpdf-config.h>
#include <stdlib.h>
#include <cstdlib>
InsecureRandomDataProvider::InsecureRandomDataProvider() :
seeded_random(false)
@ -24,7 +24,7 @@ InsecureRandomDataProvider::random()
// Seed the random number generator with something simple, but
// just to be interesting, don't use the unmodified current
// time. It would be better if this were a more secure seed.
unsigned int seed =
auto seed =
static_cast<unsigned int>(QUtil::get_current_time() ^ 0xcccc);
#ifdef HAVE_RANDOM
::srandom(seed);

View File

@ -294,7 +294,7 @@ JSON::addDictionaryMember(std::string const& key, JSON const& val)
bool
JSON::checkDictionaryKeySeen(std::string const& key)
{
JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get());
auto* obj = dynamic_cast<JSON_dictionary*>(this->m->value.get());
if (nullptr == obj) {
throw std::logic_error(
"JSON::checkDictionaryKey called on non-dictionary");
@ -315,7 +315,7 @@ JSON::makeArray()
JSON
JSON::addArrayElement(JSON const& val)
{
JSON_array* arr = dynamic_cast<JSON_array*>(this->m->value.get());
auto* arr = dynamic_cast<JSON_array*>(this->m->value.get());
if (nullptr == arr) {
throw std::runtime_error("JSON::addArrayElement called on non-array");
}
@ -470,13 +470,13 @@ JSON::checkSchemaInternal(
std::list<std::string>& errors,
std::string prefix)
{
JSON_array* this_arr = dynamic_cast<JSON_array*>(this_v);
JSON_dictionary* this_dict = dynamic_cast<JSON_dictionary*>(this_v);
auto* this_arr = dynamic_cast<JSON_array*>(this_v);
auto* this_dict = dynamic_cast<JSON_dictionary*>(this_v);
JSON_array* sch_arr = dynamic_cast<JSON_array*>(sch_v);
JSON_dictionary* sch_dict = dynamic_cast<JSON_dictionary*>(sch_v);
auto* sch_arr = dynamic_cast<JSON_array*>(sch_v);
auto* sch_dict = dynamic_cast<JSON_dictionary*>(sch_v);
JSON_string* sch_str = dynamic_cast<JSON_string*>(sch_v);
auto* sch_str = dynamic_cast<JSON_string*>(sch_v);
std::string err_prefix;
if (prefix.empty()) {

View File

@ -4,11 +4,7 @@
#include <qpdf/QPDFCryptoProvider.hh>
#include <qpdf/QUtil.hh>
#include <errno.h>
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstring>
MD5::MD5()
{

View File

@ -1,7 +1,5 @@
#include <qpdf/Pipeline.hh>
#include <qpdf/QUtil.hh>
#include <cstring>
#include <stdexcept>

View File

@ -5,7 +5,6 @@
#include <qpdf/QUtil.hh>
#include <cstring>
#include <stdexcept>
#include <stdlib.h>
#include <string>
bool Pl_AES_PDF::use_static_iv = false;

View File

@ -2,7 +2,7 @@
#include <qpdf/QTC.hh>
#include <stdexcept>
#include <string.h>
#include <cstring>
Pl_ASCII85Decoder::Pl_ASCII85Decoder(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),

View File

@ -1,9 +1,8 @@
#include <qpdf/Pl_ASCIIHexDecoder.hh>
#include <qpdf/QTC.hh>
#include <ctype.h>
#include <cctype>
#include <stdexcept>
#include <string.h>
Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
@ -77,7 +76,7 @@ Pl_ASCIIHexDecoder::flush()
b[i] = this->inbuf[i] - '0';
}
}
unsigned char ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
QTC::TC(
"libtests",

View File

@ -2,7 +2,6 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QUtil.hh>
#include <algorithm>
#include <cstring>
#include <stdexcept>

View File

@ -2,8 +2,8 @@
#include <algorithm>
#include <stdexcept>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
@ -45,7 +45,7 @@ Pl_Buffer::getBuffer()
}
auto size = this->m->data.length();
Buffer* b = new Buffer(size);
auto* b = new Buffer(size);
if (size > 0) {
unsigned char* p = b->getBuffer();
memcpy(p, this->m->data.data(), size);

View File

@ -2,12 +2,9 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <cstring>
#include <setjmp.h>
#include <csetjmp>
#include <stdexcept>
#include <stdlib.h>
#include <string>
#if BITS_IN_JSAMPLE != 8
@ -27,7 +24,7 @@ namespace
static void
error_handler(j_common_ptr cinfo)
{
qpdf_jpeg_error_mgr* jerr =
auto* jerr =
reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
char buf[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo, buf);
@ -170,7 +167,7 @@ static boolean
empty_pipeline_output_buffer(j_compress_ptr cinfo)
{
QTC::TC("libtests", "Pl_DCT empty_pipeline_output_buffer");
dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
dest->next->write(dest->buffer, dest->size);
dest->pub.next_output_byte = dest->buffer;
dest->pub.free_in_buffer = dest->size;
@ -181,7 +178,7 @@ static void
term_pipeline_destination(j_compress_ptr cinfo)
{
QTC::TC("libtests", "Pl_DCT term_pipeline_destination");
dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
dest->next->write(dest->buffer, dest->size - dest->pub.free_in_buffer);
}
@ -195,7 +192,7 @@ jpeg_pipeline_dest(
reinterpret_cast<j_common_ptr>(cinfo),
JPOOL_PERMANENT,
sizeof(dct_pipeline_dest)));
dct_pipeline_dest* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
auto* dest = reinterpret_cast<dct_pipeline_dest*>(cinfo->dest);
dest->pub.init_destination = init_pipeline_destination;
dest->pub.empty_output_buffer = empty_pipeline_output_buffer;
dest->pub.term_destination = term_pipeline_destination;
@ -264,7 +261,7 @@ jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer)
void
Pl_DCT::compress(void* cinfo_p, Buffer* b)
{
struct jpeg_compress_struct* cinfo =
auto* cinfo =
reinterpret_cast<jpeg_compress_struct*>(cinfo_p);
#if ( \
@ -319,7 +316,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b)
void
Pl_DCT::decompress(void* cinfo_p, Buffer* b)
{
struct jpeg_decompress_struct* cinfo =
auto* cinfo =
reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
#if ( \

View File

@ -1,7 +1,7 @@
#include <qpdf/Pl_Flate.hh>
#include <limits.h>
#include <string.h>
#include <climits>
#include <cstring>
#include <zlib.h>
#include <qpdf/QIntC.hh>

View File

@ -1,7 +1,5 @@
#include <qpdf/Pl_Function.hh>
#include <qpdf/QUtil.hh>
#include <errno.h>
#include <stdexcept>
Pl_Function::Members::Members(writer_t fn) :

View File

@ -4,7 +4,7 @@
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <stdexcept>
#include <string.h>
#include <cstring>
Pl_LZWDecoder::Pl_LZWDecoder(
char const* identifier, Pipeline* next, bool early_code_change) :
@ -189,7 +189,7 @@ Pl_LZWDecoder::handleCode(unsigned int code)
}
if (code < 256) {
unsigned char ch = static_cast<unsigned char>(code);
auto ch = static_cast<unsigned char>(code);
getNext()->write(&ch, 1);
} else {
unsigned int idx = code - 258;

View File

@ -1,7 +1,5 @@
#include <qpdf/Pl_OStream.hh>
#include <qpdf/QUtil.hh>
#include <errno.h>
#include <stdexcept>
Pl_OStream::Members::Members(std::ostream& os) :

View File

@ -3,9 +3,9 @@
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <limits.h>
#include <climits>
#include <stdexcept>
#include <string.h>
#include <cstring>
static int
abs_diff(int a, int b)

View File

@ -2,9 +2,7 @@
#include <qpdf/BufferInputSource.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <stdexcept>
#include <string.h>
Pl_QPDFTokenizer::Members::Members() :
filter(nullptr),

View File

@ -127,11 +127,11 @@ Pl_RunLength::flush_encode()
throw std::logic_error(
"Pl_RunLength: invalid length in flush_encode for run");
}
unsigned char ch = static_cast<unsigned char>(257 - this->m->length);
auto ch = static_cast<unsigned char>(257 - this->m->length);
this->getNext()->write(&ch, 1);
this->getNext()->write(&this->m->buf[0], 1);
} else if (this->m->length > 0) {
unsigned char ch = static_cast<unsigned char>(this->m->length - 1);
auto ch = static_cast<unsigned char>(this->m->length - 1);
this->getNext()->write(&ch, 1);
this->getNext()->write(this->m->buf, this->m->length);
}

View File

@ -2,7 +2,6 @@
#include <qpdf/QPDFCryptoProvider.hh>
#include <qpdf/QUtil.hh>
#include <cstdio>
#include <stdexcept>
Pl_SHA2::Pl_SHA2(int bits, Pipeline* next) :

View File

@ -3,7 +3,7 @@
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/QUtil.hh>
#include <errno.h>
#include <cerrno>
#include <stdexcept>
Pl_StdioFile::Members::Members(FILE* f) :

View File

@ -1,7 +1,5 @@
#include <qpdf/Pl_String.hh>
#include <qpdf/QUtil.hh>
#include <errno.h>
#include <stdexcept>
Pl_String::Members::Members(std::string& s) :

View File

@ -5,9 +5,9 @@
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <limits.h>
#include <climits>
#include <stdexcept>
#include <string.h>
#include <cstring>
#include <vector>
Pl_TIFFPredictor::Pl_TIFFPredictor(

View File

@ -9,8 +9,8 @@
#include <memory.h>
#include <regex>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <qpdf/BufferInputSource.hh>
@ -60,42 +60,42 @@ namespace
class InvalidInputSource: public InputSource
{
public:
virtual ~InvalidInputSource() = default;
virtual qpdf_offset_t
~InvalidInputSource() override = default;
qpdf_offset_t
findAndSkipNextEOL() override
{
throwException();
return 0;
}
virtual std::string const&
std::string const&
getName() const override
{
static std::string name("closed input source");
return name;
}
virtual qpdf_offset_t
qpdf_offset_t
tell() override
{
throwException();
return 0;
}
virtual void
void
seek(qpdf_offset_t offset, int whence) override
{
throwException();
}
virtual void
void
rewind() override
{
throwException();
}
virtual size_t
size_t
read(char* buffer, size_t length) override
{
throwException();
return 0;
}
virtual void
void
unreadCh(char ch) override
{
throwException();
@ -264,7 +264,7 @@ QPDF::create()
void
QPDF::processFile(char const* filename, char const* password)
{
FileInputSource* fi = new FileInputSource(filename);
auto* fi = new FileInputSource(filename);
processInputSource(std::shared_ptr<InputSource>(fi), password);
}
@ -272,7 +272,7 @@ void
QPDF::processFile(
char const* description, FILE* filep, bool close_file, char const* password)
{
FileInputSource* fi = new FileInputSource(description, filep, close_file);
auto* fi = new FileInputSource(description, filep, close_file);
processInputSource(std::shared_ptr<InputSource>(fi), password);
}
@ -2537,7 +2537,7 @@ QPDF::getCompressibleObjGens()
if (obj.isStream()) {
QPDFObjectHandle dict = obj.getDict();
std::set<std::string> keys = dict.getKeys();
for (std::set<std::string>::reverse_iterator iter = keys.rbegin();
for (auto iter = keys.rbegin();
iter != keys.rend();
++iter) {
std::string const& key = *iter;
@ -2553,7 +2553,7 @@ QPDF::getCompressibleObjGens()
}
} else if (obj.isDictionary()) {
std::set<std::string> keys = obj.getKeys();
for (std::set<std::string>::reverse_iterator iter = keys.rbegin();
for (auto iter = keys.rbegin();
iter != keys.rend();
++iter) {
queue.push_front(obj.getKey(*iter));

View File

@ -2,7 +2,6 @@
#include <qpdf/QPDF.hh>
#include <qpdf/QPDFMatrix.hh>
#include <qpdf/QPDFNameTreeObjectHelper.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>

View File

@ -1,7 +1,5 @@
#include <qpdf/QPDFExc.hh>
#include <qpdf/QUtil.hh>
QPDFExc::QPDFExc(
qpdf_error_code_e error_code,
std::string const& filename,

View File

@ -6,7 +6,7 @@
#include <qpdf/QPDFAnnotationObjectHelper.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <stdlib.h>
#include <cstdlib>
QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper(QPDFObjectHandle oh) :
QPDFObjectHelper(oh),
@ -515,9 +515,9 @@ namespace
std::vector<std::string> const& opt,
double tf,
QPDFObjectHandle::Rectangle const& bbox);
virtual ~ValueSetter() = default;
virtual void handleToken(QPDFTokenizer::Token const&);
virtual void handleEOF();
~ValueSetter() override = default;
void handleToken(QPDFTokenizer::Token const&) override;
void handleEOF() override;
void writeAppearance();
private:
@ -611,7 +611,7 @@ ValueSetter::writeAppearance()
// Write one or more lines, centered vertically, possibly with
// one row highlighted.
size_t max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh);
auto max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh);
bool highlight = false;
size_t highlight_idx = 0;
@ -706,10 +706,10 @@ namespace
{
public:
TfFinder();
virtual ~TfFinder()
~TfFinder() override
{
}
virtual void handleToken(QPDFTokenizer::Token const&);
void handleToken(QPDFTokenizer::Token const&) override;
double getTf();
std::string getFontName();
std::string getDA();

View File

@ -3,7 +3,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctype.h>
#include <cctype>
#include <fcntl.h>
#include <iostream>
#include <memory>
@ -48,8 +48,8 @@ namespace
size_t oi_min_height,
size_t oi_min_area,
QPDFObjectHandle& image);
virtual ~ImageOptimizer() = default;
virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline);
~ImageOptimizer() override = default;
void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
std::shared_ptr<Pipeline>
makePipeline(std::string const& description, Pipeline* next);
bool evaluate(std::string const& description);
@ -65,13 +65,13 @@ namespace
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
{
public:
virtual ~DiscardContents() = default;
virtual void
handleObject(QPDFObjectHandle)
~DiscardContents() override = default;
void
handleObject(QPDFObjectHandle) override
{
}
virtual void
handleEOF()
void
handleEOF() override
{
}
};
@ -98,8 +98,8 @@ namespace
filename(filename)
{
}
virtual ~ProgressReporter() = default;
virtual void reportProgress(int);
~ProgressReporter() override = default;
void reportProgress(int) override;
private:
Pipeline& p;

View File

@ -3,12 +3,12 @@
// See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer.
#include <cstdio>
#include <ctype.h>
#include <cctype>
#include <iostream>
#include <memory>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
#include <qpdf/QIntC.hh>
#include <qpdf/QPDFArgParser.hh>

View File

@ -17,14 +17,14 @@ namespace
{
}
virtual void
void
write(unsigned char const* data, size_t len) override
{
this->used = true;
getNext()->write(data, len);
}
virtual void
void
finish() override
{
getNext()->finish();

View File

@ -7,18 +7,18 @@ namespace
class NameTreeDetails: public NNTreeDetails
{
public:
virtual std::string const&
std::string const&
itemsKey() const override
{
static std::string k("/Names");
return k;
}
virtual bool
bool
keyValid(QPDFObjectHandle oh) const override
{
return oh.isString();
}
virtual int
int
compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override
{
if (!(keyValid(a) && keyValid(b))) {

View File

@ -8,18 +8,18 @@ namespace
class NumberTreeDetails: public NNTreeDetails
{
public:
virtual std::string const&
std::string const&
itemsKey() const override
{
static std::string k("/Nums");
return k;
}
virtual bool
bool
keyValid(QPDFObjectHandle oh) const override
{
return oh.isInteger();
}
virtual int
int
compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override
{
if (!(keyValid(a) && keyValid(b))) {

View File

@ -30,10 +30,10 @@
#include <algorithm>
#include <cstring>
#include <ctype.h>
#include <limits.h>
#include <cctype>
#include <climits>
#include <stdexcept>
#include <stdlib.h>
#include <cstdlib>
using namespace std::literals;
@ -111,8 +111,8 @@ namespace
old_contents(old_contents)
{
}
virtual ~CoalesceProvider() = default;
virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline);
~CoalesceProvider() override = default;
void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
private:
QPDFObjectHandle containing_page;
@ -200,9 +200,9 @@ namespace
{
public:
LastChar(Pipeline* next);
virtual ~LastChar() = default;
virtual void write(unsigned char const* data, size_t len);
virtual void finish();
~LastChar() override = default;
void write(unsigned char const* data, size_t len) override;
void finish() override;
unsigned char getLastChar();
private:
@ -1446,13 +1446,13 @@ namespace
{
}
virtual void
void
provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override
{
p1(pipeline);
}
virtual bool
bool
provideStreamData(
QPDFObjGen const&,
Pipeline* pipeline,

View File

@ -16,7 +16,6 @@
#include <qpdf/QPDF_Reserved.hh>
#include <qpdf/QPDF_Stream.hh>
#include <qpdf/QPDF_String.hh>
#include <qpdf/QPDF_Unresolved.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>

View File

@ -1,7 +1,6 @@
#include <qpdf/QPDFSystemError.hh>
#include <qpdf/QUtil.hh>
#include <string.h>
#include <cstring>
QPDFSystemError::QPDFSystemError(
std::string const& description, int system_errno) :

View File

@ -11,8 +11,8 @@
#include <qpdf/QUtil.hh>
#include <stdexcept>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
static inline bool
is_delimiter(char ch)
@ -35,8 +35,8 @@ namespace
str(str)
{
}
virtual ~QPDFWordTokenFinder() = default;
virtual bool check();
~QPDFWordTokenFinder() override = default;
bool check() override;
private:
std::shared_ptr<InputSource> is;

View File

@ -24,7 +24,7 @@
#include <algorithm>
#include <stdexcept>
#include <stdlib.h>
#include <cstdlib>
QPDFWriter::ProgressReporter::~ProgressReporter()
{
@ -997,7 +997,7 @@ void
QPDFWriter::activatePipelineStack(PipelinePopper& pp)
{
std::string stack_id("stack " + std::to_string(this->m->next_stack_id));
Pl_Count* c =
auto* c =
new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back());
++this->m->next_stack_id;
this->m->pipeline_stack.push_back(c);
@ -1030,7 +1030,7 @@ QPDFWriter::PipelinePopper::~PipelinePopper()
qw->m->md5_pipeline = nullptr;
}
qw->m->pipeline_stack.pop_back();
Pl_Buffer* buf = dynamic_cast<Pl_Buffer*>(p);
auto* buf = dynamic_cast<Pl_Buffer*>(p);
if (bp && buf) {
*bp = buf->getBufferSharedPointer();
}

View File

@ -2,7 +2,6 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QPDFExc.hh>
#include <qpdf/QUtil.hh>
QPDFXRefEntry::QPDFXRefEntry()
{

View File

@ -83,7 +83,7 @@ QPDF_Array::copy(bool shallow)
return do_create(new QPDF_Array(*this));
} else {
if (sparse) {
QPDF_Array* result = new QPDF_Array();
auto* result = new QPDF_Array();
result->sp_size = sp_size;
for (auto const& element: sp_elements) {
auto const& obj = element.second;

View File

@ -1,8 +1,6 @@
#include <qpdf/QPDF_Name.hh>
#include <qpdf/QUtil.hh>
#include <stdio.h>
#include <string.h>
QPDF_Name::QPDF_Name(std::string const& name) :
QPDFValue(::ot_name, "name"),

View File

@ -27,10 +27,10 @@ namespace
{
public:
SF_Crypt() = default;
virtual ~SF_Crypt() = default;
~SF_Crypt() override = default;
virtual bool
setDecodeParms(QPDFObjectHandle decode_parms)
bool
setDecodeParms(QPDFObjectHandle decode_parms) override
{
if (decode_parms.isNull()) {
return true;
@ -49,8 +49,8 @@ namespace
return filterable;
}
virtual Pipeline*
getDecodePipeline(Pipeline*)
Pipeline*
getDecodePipeline(Pipeline*) override
{
// Not used -- handled by pipeStreamData
return nullptr;
@ -557,7 +557,7 @@ QPDF_Stream::pipeStreamData(
if (decode_pipeline) {
pipeline = decode_pipeline;
}
Pl_Flate* flate = dynamic_cast<Pl_Flate*>(pipeline);
auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
if (flate != nullptr) {
flate->setWarnCallback(
[this](char const* msg, int code) { warn(msg); });

View File

@ -5,7 +5,6 @@
// DO NOT USE ctype -- it is locale dependent for some things, and
// it's not worth the risk of including it in case it may accidentally
// be used.
#include <string.h>
static bool
is_iso_latin1_printable(char ch)

View File

@ -17,7 +17,7 @@
#include <qpdf/RC4.hh>
#include <algorithm>
#include <string.h>
#include <cstring>
static unsigned char const padding_string[] = {
0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e,

View File

@ -242,13 +242,13 @@ class QPDF::JSONReactor: public JSON::Reactor
}
}
virtual ~JSONReactor() = default;
virtual void dictionaryStart() override;
virtual void arrayStart() override;
virtual void containerEnd(JSON const& value) override;
virtual void topLevelScalar() override;
virtual bool
void dictionaryStart() override;
void arrayStart() override;
void containerEnd(JSON const& value) override;
void topLevelScalar() override;
bool
dictionaryItem(std::string const& key, JSON const& value) override;
virtual bool arrayItem(JSON const& value) override;
bool arrayItem(JSON const& value) override;
bool anyErrors() const;

View File

@ -13,9 +13,8 @@
#include <qpdf/QUtil.hh>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <cmath>
#include <cstring>
template <class T, class int_type>
static void

View File

@ -115,7 +115,7 @@ QPDF::optimize(
}
ObjUser root_ou = ObjUser(ObjUser::ou_root);
QPDFObjGen root_og = QPDFObjGen(root.getObjGen());
auto root_og = QPDFObjGen(root.getObjGen());
this->m->obj_user_to_objects[root_ou].insert(root_og);
this->m->object_to_obj_users[root_og].insert(root_ou);

View File

@ -3,7 +3,7 @@
#include <qpdf/QUtil.hh>
#include <map>
#include <set>
#include <stdio.h>
#include <cstdio>
static bool
tc_active(char const* const scope)

View File

@ -9,9 +9,8 @@
#include <qpdf/QPDFSystemError.hh>
#include <qpdf/QTC.hh>
#include <cmath>
#include <ctype.h>
#include <errno.h>
#include <cctype>
#include <cerrno>
#include <fcntl.h>
#include <fstream>
#include <iomanip>
@ -22,9 +21,9 @@
#include <set>
#include <sstream>
#include <stdexcept>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#ifndef QPDF_NO_WCHAR_T
# include <cwchar>
#endif
@ -837,8 +836,8 @@ char*
QUtil::getWhoami(char* argv0)
{
char* whoami = nullptr;
if (((whoami = strrchr(argv0, '/')) == NULL) &&
((whoami = strrchr(argv0, '\\')) == NULL)) {
if (((whoami = strrchr(argv0, '/')) == nullptr) &&
((whoami = strrchr(argv0, '\\')) == nullptr)) {
whoami = argv0;
} else {
++whoami;

View File

@ -2,7 +2,6 @@
#include <qpdf/QPDFCryptoProvider.hh>
#include <string.h>
RC4::RC4(unsigned char const* key_data, int key_len) :
crypto(QPDFCryptoProvider::getImpl())

View File

@ -15,7 +15,6 @@
#include <qpdf/qpdf-c_impl.hh>
#include <qpdf/qpdflogger-c_impl.hh>
#include <cstring>
#include <functional>
#include <list>
#include <stdexcept>
@ -107,7 +106,7 @@ qpdf_data
qpdf_init()
{
QTC::TC("qpdf", "qpdf-c called qpdf_init");
qpdf_data qpdf = new _qpdf_data();
auto qpdf = new _qpdf_data();
qpdf->qpdf = QPDF::create();
return qpdf;
}

View File

@ -3,7 +3,7 @@
#ifndef BITSTREAM_HH
#define BITSTREAM_HH
#include <stddef.h>
#include <cstddef>
class BitStream
{

View File

@ -3,7 +3,7 @@
#ifndef BITWRITER_HH
#define BITWRITER_HH
#include <stddef.h>
#include <cstddef>
class Pipeline;

View File

@ -7,8 +7,8 @@ class ContentNormalizer: public QPDFObjectHandle::TokenFilter
{
public:
ContentNormalizer();
virtual ~ContentNormalizer() = default;
virtual void handleToken(QPDFTokenizer::Token const&);
~ContentNormalizer() override = default;
void handleToken(QPDFTokenizer::Token const&) override;
bool anyBadTokens() const;
bool lastTokenWasBad() const;

View File

@ -7,8 +7,8 @@ class CryptoRandomDataProvider: public RandomDataProvider
{
public:
CryptoRandomDataProvider() = default;
virtual ~CryptoRandomDataProvider() = default;
virtual void provideRandomData(unsigned char* data, size_t len);
~CryptoRandomDataProvider() override = default;
void provideRandomData(unsigned char* data, size_t len) override;
static RandomDataProvider* getInstance();
};

View File

@ -7,8 +7,8 @@ class InsecureRandomDataProvider: public RandomDataProvider
{
public:
InsecureRandomDataProvider();
virtual ~InsecureRandomDataProvider() = default;
virtual void provideRandomData(unsigned char* data, size_t len);
~InsecureRandomDataProvider() override = default;
void provideRandomData(unsigned char* data, size_t len) override;
static RandomDataProvider* getInstance();
private:

View File

@ -11,15 +11,15 @@ class OffsetInputSource: public InputSource
public:
OffsetInputSource(
std::shared_ptr<InputSource>, qpdf_offset_t global_offset);
virtual ~OffsetInputSource() = default;
~OffsetInputSource() override = default;
virtual qpdf_offset_t findAndSkipNextEOL();
virtual std::string const& getName() const;
virtual qpdf_offset_t tell();
virtual void seek(qpdf_offset_t offset, int whence);
virtual void rewind();
virtual size_t read(char* buffer, size_t length);
virtual void unreadCh(char ch);
qpdf_offset_t findAndSkipNextEOL() override;
std::string const& getName() const override;
qpdf_offset_t tell() override;
void seek(qpdf_offset_t offset, int whence) override;
void rewind() override;
size_t read(char* buffer, size_t length) override;
void unreadCh(char ch) override;
private:
std::shared_ptr<InputSource> proxied;

View File

@ -18,10 +18,10 @@ class Pl_AES_PDF: public Pipeline
bool encrypt,
unsigned char const* key,
size_t key_bytes);
virtual ~Pl_AES_PDF() = default;
~Pl_AES_PDF() override = default;
virtual void write(unsigned char const* data, size_t len);
virtual void finish();
void write(unsigned char const* data, size_t len) override;
void finish() override;
// Use zero initialization vector; needed for AESV3
void useZeroIV();

View File

@ -7,9 +7,9 @@ class Pl_ASCII85Decoder: public Pipeline
{
public:
Pl_ASCII85Decoder(char const* identifier, Pipeline* next);
virtual ~Pl_ASCII85Decoder() = default;
virtual void write(unsigned char const* buf, size_t len);
virtual void finish();
~Pl_ASCII85Decoder() override = default;
void write(unsigned char const* buf, size_t len) override;
void finish() override;
private:
void flush();

View File

@ -7,9 +7,9 @@ class Pl_ASCIIHexDecoder: public Pipeline
{
public:
Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next);
virtual ~Pl_ASCIIHexDecoder() = default;
virtual void write(unsigned char const* buf, size_t len);
virtual void finish();
~Pl_ASCIIHexDecoder() override = default;
void write(unsigned char const* buf, size_t len) override;
void finish() override;
private:
void flush();

View File

@ -8,9 +8,9 @@ class Pl_Base64: public Pipeline
public:
enum action_e { a_encode, a_decode };
Pl_Base64(char const* identifier, Pipeline* next, action_e);
virtual ~Pl_Base64() = default;
virtual void write(unsigned char const* buf, size_t len) override;
virtual void finish() override;
~Pl_Base64() override = default;
void write(unsigned char const* buf, size_t len) override;
void finish() override;
private:
void decode(unsigned char const* buf, size_t len);

View File

@ -22,10 +22,10 @@ class Pl_PNGFilter: public Pipeline
unsigned int columns,
unsigned int samples_per_pixel = 1,
unsigned int bits_per_sample = 8);
virtual ~Pl_PNGFilter() = default;
~Pl_PNGFilter() override = default;
virtual void write(unsigned char const* data, size_t len);
virtual void finish();
void write(unsigned char const* data, size_t len) override;
void finish() override;
private:
void decodeSub();

View File

@ -17,10 +17,10 @@ class Pl_RC4: public Pipeline
unsigned char const* key_data,
int key_len = -1,
size_t out_bufsize = def_bufsize);
virtual ~Pl_RC4() = default;
~Pl_RC4() override = default;
virtual void write(unsigned char const* data, size_t len);
virtual void finish();
void write(unsigned char const* data, size_t len) override;
void finish() override;
private:
std::shared_ptr<unsigned char> outbuf;

View File

@ -20,10 +20,10 @@
class Pl_SHA2: public Pipeline
{
public:
Pl_SHA2(int bits = 0, Pipeline* next = 0);
virtual ~Pl_SHA2() = default;
virtual void write(unsigned char const*, size_t);
virtual void finish();
Pl_SHA2(int bits = 0, Pipeline* next = nullptr);
~Pl_SHA2() override = default;
void write(unsigned char const*, size_t) override;
void finish() override;
void resetBits(int bits);
std::string getHexDigest();
std::string getRawDigest();

View File

@ -18,10 +18,10 @@ class Pl_TIFFPredictor: public Pipeline
unsigned int columns,
unsigned int samples_per_pixel = 1,
unsigned int bits_per_sample = 8);
virtual ~Pl_TIFFPredictor() = default;
~Pl_TIFFPredictor() override = default;
virtual void write(unsigned char const* data, size_t len);
virtual void finish();
void write(unsigned char const* data, size_t len) override;
void finish() override;
private:
void processRow();

Some files were not shown because too many files have changed in this diff Show More