mirror of
https://github.com/qpdf/qpdf.git
synced 2024-06-01 01:40:51 +00:00
Merge pull request #982 from m-holger/cltidy
Apply various Clang-Tidy rules
This commit is contained in:
commit
0b538ec877
|
@ -26,17 +26,14 @@ usage()
|
|||
class StringCounter: public QPDFObjectHandle::TokenFilter
|
||||
{
|
||||
public:
|
||||
StringCounter() :
|
||||
count(0)
|
||||
{
|
||||
}
|
||||
StringCounter() = default;
|
||||
~StringCounter() override = default;
|
||||
void handleToken(QPDFTokenizer::Token const&) override;
|
||||
void handleEOF() override;
|
||||
int getCount() const;
|
||||
|
||||
private:
|
||||
int count;
|
||||
int count{0};
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
@ -31,47 +31,43 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider
|
|||
size_t getHeight() const;
|
||||
|
||||
private:
|
||||
size_t width;
|
||||
size_t stripe_height;
|
||||
size_t width{400};
|
||||
size_t stripe_height{80};
|
||||
std::string color_space;
|
||||
std::string filter;
|
||||
size_t n_stripes;
|
||||
size_t n_stripes{6};
|
||||
std::vector<std::string> stripes;
|
||||
J_COLOR_SPACE j_color_space;
|
||||
J_COLOR_SPACE j_color_space{JCS_UNKNOWN};
|
||||
};
|
||||
|
||||
ImageProvider::ImageProvider(std::string const& color_space, std::string const& filter) :
|
||||
width(400),
|
||||
stripe_height(80),
|
||||
color_space(color_space),
|
||||
filter(filter),
|
||||
n_stripes(6),
|
||||
j_color_space(JCS_UNKNOWN)
|
||||
filter(filter)
|
||||
{
|
||||
if (color_space == "/DeviceCMYK") {
|
||||
j_color_space = JCS_CMYK;
|
||||
stripes.push_back(std::string("\xff\x00\x00\x00", 4));
|
||||
stripes.push_back(std::string("\x00\xff\x00\x00", 4));
|
||||
stripes.push_back(std::string("\x00\x00\xff\x00", 4));
|
||||
stripes.push_back(std::string("\xff\x00\xff\x00", 4));
|
||||
stripes.push_back(std::string("\xff\xff\x00\x00", 4));
|
||||
stripes.push_back(std::string("\x00\x00\x00\xff", 4));
|
||||
stripes.emplace_back("\xff\x00\x00\x00", 4);
|
||||
stripes.emplace_back("\x00\xff\x00\x00", 4);
|
||||
stripes.emplace_back("\x00\x00\xff\x00", 4);
|
||||
stripes.emplace_back("\xff\x00\xff\x00", 4);
|
||||
stripes.emplace_back("\xff\xff\x00\x00", 4);
|
||||
stripes.emplace_back("\x00\x00\x00\xff", 4);
|
||||
} else if (color_space == "/DeviceRGB") {
|
||||
j_color_space = JCS_RGB;
|
||||
stripes.push_back(std::string("\xff\x00\x00", 3));
|
||||
stripes.push_back(std::string("\x00\xff\x00", 3));
|
||||
stripes.push_back(std::string("\x00\x00\xff", 3));
|
||||
stripes.push_back(std::string("\xff\x00\xff", 3));
|
||||
stripes.push_back(std::string("\xff\xff\x00", 3));
|
||||
stripes.push_back(std::string("\x00\x00\x00", 3));
|
||||
stripes.emplace_back("\xff\x00\x00", 3);
|
||||
stripes.emplace_back("\x00\xff\x00", 3);
|
||||
stripes.emplace_back("\x00\x00\xff", 3);
|
||||
stripes.emplace_back("\xff\x00\xff", 3);
|
||||
stripes.emplace_back("\xff\xff\x00", 3);
|
||||
stripes.emplace_back("\x00\x00\x00", 3);
|
||||
} else if (color_space == "/DeviceGray") {
|
||||
j_color_space = JCS_GRAYSCALE;
|
||||
stripes.push_back(std::string("\xee", 1));
|
||||
stripes.push_back(std::string("\xcc", 1));
|
||||
stripes.push_back(std::string("\x99", 1));
|
||||
stripes.push_back(std::string("\x66", 1));
|
||||
stripes.push_back(std::string("\x33", 1));
|
||||
stripes.push_back(std::string("\x00", 1));
|
||||
stripes.emplace_back("\xee", 1);
|
||||
stripes.emplace_back("\xcc", 1);
|
||||
stripes.emplace_back("\x99", 1);
|
||||
stripes.emplace_back("\x66", 1);
|
||||
stripes.emplace_back("\x33", 1);
|
||||
stripes.emplace_back("\x00", 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,13 +331,13 @@ create_pdf(char const* filename)
|
|||
">>"_qpdf);
|
||||
|
||||
std::vector<std::string> color_spaces;
|
||||
color_spaces.push_back("/DeviceCMYK");
|
||||
color_spaces.push_back("/DeviceRGB");
|
||||
color_spaces.push_back("/DeviceGray");
|
||||
color_spaces.emplace_back("/DeviceCMYK");
|
||||
color_spaces.emplace_back("/DeviceRGB");
|
||||
color_spaces.emplace_back("/DeviceGray");
|
||||
std::vector<std::string> filters;
|
||||
filters.push_back("null");
|
||||
filters.push_back("/DCTDecode");
|
||||
filters.push_back("/RunLengthDecode");
|
||||
filters.emplace_back("null");
|
||||
filters.emplace_back("/DCTDecode");
|
||||
filters.emplace_back("/RunLengthDecode");
|
||||
QPDFPageDocumentHelper dh(pdf);
|
||||
for (auto const& color_space: color_spaces) {
|
||||
for (auto const& filter: filters) {
|
||||
|
|
|
@ -32,21 +32,21 @@ class QPDF_DLL_CLASS BufferInputSource: public InputSource
|
|||
QPDF_DLL
|
||||
BufferInputSource(std::string const& description, std::string const& contents);
|
||||
QPDF_DLL
|
||||
virtual ~BufferInputSource();
|
||||
~BufferInputSource() override;
|
||||
QPDF_DLL
|
||||
virtual qpdf_offset_t findAndSkipNextEOL();
|
||||
qpdf_offset_t findAndSkipNextEOL() override;
|
||||
QPDF_DLL
|
||||
virtual std::string const& getName() const;
|
||||
std::string const& getName() const override;
|
||||
QPDF_DLL
|
||||
virtual qpdf_offset_t tell();
|
||||
qpdf_offset_t tell() override;
|
||||
QPDF_DLL
|
||||
virtual void seek(qpdf_offset_t offset, int whence);
|
||||
void seek(qpdf_offset_t offset, int whence) override;
|
||||
QPDF_DLL
|
||||
virtual void rewind();
|
||||
void rewind() override;
|
||||
QPDF_DLL
|
||||
virtual size_t read(char* buffer, size_t length);
|
||||
size_t read(char* buffer, size_t length) override;
|
||||
QPDF_DLL
|
||||
virtual void unreadCh(char ch);
|
||||
void unreadCh(char ch) override;
|
||||
|
||||
private:
|
||||
bool own_memory;
|
||||
|
|
|
@ -37,21 +37,21 @@ class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource
|
|||
QPDF_DLL
|
||||
ClosedFileInputSource(char const* filename);
|
||||
QPDF_DLL
|
||||
virtual ~ClosedFileInputSource();
|
||||
~ClosedFileInputSource() override;
|
||||
QPDF_DLL
|
||||
virtual qpdf_offset_t findAndSkipNextEOL();
|
||||
qpdf_offset_t findAndSkipNextEOL() override;
|
||||
QPDF_DLL
|
||||
virtual std::string const& getName() const;
|
||||
std::string const& getName() const override;
|
||||
QPDF_DLL
|
||||
virtual qpdf_offset_t tell();
|
||||
qpdf_offset_t tell() override;
|
||||
QPDF_DLL
|
||||
virtual void seek(qpdf_offset_t offset, int whence);
|
||||
void seek(qpdf_offset_t offset, int whence) override;
|
||||
QPDF_DLL
|
||||
virtual void rewind();
|
||||
void rewind() override;
|
||||
QPDF_DLL
|
||||
virtual size_t read(char* buffer, size_t length);
|
||||
size_t read(char* buffer, size_t length) override;
|
||||
QPDF_DLL
|
||||
virtual void unreadCh(char ch);
|
||||
void unreadCh(char ch) override;
|
||||
|
||||
// The file stays open between calls to stayOpen(true) and stayOpen(false). You can use this to
|
||||
// surround multiple operations on a single ClosedFileInputSource to reduce the overhead of a
|
||||
|
|
|
@ -35,21 +35,21 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource
|
|||
QPDF_DLL
|
||||
void setFile(char const* description, FILE* filep, bool close_file);
|
||||
QPDF_DLL
|
||||
virtual ~FileInputSource();
|
||||
~FileInputSource() override;
|
||||
QPDF_DLL
|
||||
virtual qpdf_offset_t findAndSkipNextEOL();
|
||||
qpdf_offset_t findAndSkipNextEOL() override;
|
||||
QPDF_DLL
|
||||
virtual std::string const& getName() const;
|
||||
std::string const& getName() const override;
|
||||
QPDF_DLL
|
||||
virtual qpdf_offset_t tell();
|
||||
qpdf_offset_t tell() override;
|
||||
QPDF_DLL
|
||||
virtual void seek(qpdf_offset_t offset, int whence);
|
||||
void seek(qpdf_offset_t offset, int whence) override;
|
||||
QPDF_DLL
|
||||
virtual void rewind();
|
||||
void rewind() override;
|
||||
QPDF_DLL
|
||||
virtual size_t read(char* buffer, size_t length);
|
||||
size_t read(char* buffer, size_t length) override;
|
||||
QPDF_DLL
|
||||
virtual void unreadCh(char ch);
|
||||
void unreadCh(char ch) override;
|
||||
|
||||
private:
|
||||
FileInputSource(FileInputSource const&) = delete;
|
||||
|
|
|
@ -33,8 +33,7 @@ class QPDF_DLL_CLASS InputSource
|
|||
{
|
||||
public:
|
||||
QPDF_DLL
|
||||
InputSource() :
|
||||
last_offset(0)
|
||||
InputSource()
|
||||
{
|
||||
}
|
||||
QPDF_DLL
|
||||
|
@ -86,7 +85,7 @@ class QPDF_DLL_CLASS InputSource
|
|||
inline void loadBuffer();
|
||||
|
||||
protected:
|
||||
qpdf_offset_t last_offset;
|
||||
qpdf_offset_t last_offset{0};
|
||||
|
||||
private:
|
||||
class QPDF_DLL_PRIVATE Members
|
||||
|
|
|
@ -32,13 +32,13 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline
|
|||
QPDF_DLL
|
||||
Pl_Concatenate(char const* identifier, Pipeline* next);
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Concatenate();
|
||||
~Pl_Concatenate() override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* data, size_t len);
|
||||
void write(unsigned char const* data, size_t len) override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
// At the very end, call manualFinish to actually finish the rest of the pipeline.
|
||||
QPDF_DLL
|
||||
|
|
|
@ -30,11 +30,11 @@ class QPDF_DLL_CLASS Pl_Count: public Pipeline
|
|||
QPDF_DLL
|
||||
Pl_Count(char const* identifier, Pipeline* next);
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Count();
|
||||
~Pl_Count() 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;
|
||||
// Returns the number of bytes written
|
||||
QPDF_DLL
|
||||
qpdf_offset_t getCount() const;
|
||||
|
|
|
@ -56,12 +56,12 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
|
|||
CompressConfig* config_callback = nullptr);
|
||||
|
||||
QPDF_DLL
|
||||
virtual ~Pl_DCT();
|
||||
~Pl_DCT() override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* data, size_t len);
|
||||
void write(unsigned char const* data, size_t len) override;
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
QPDF_DLL_PRIVATE
|
||||
|
|
|
@ -31,11 +31,11 @@ class QPDF_DLL_CLASS Pl_Discard: public Pipeline
|
|||
QPDF_DLL
|
||||
Pl_Discard();
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Discard();
|
||||
~Pl_Discard() 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;
|
||||
|
||||
private:
|
||||
class QPDF_DLL_PRIVATE Members
|
||||
|
|
|
@ -40,12 +40,12 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline
|
|||
action_e action,
|
||||
unsigned int out_bufsize = def_bufsize);
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Flate();
|
||||
~Pl_Flate() override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* data, size_t len);
|
||||
void write(unsigned char const* data, size_t len) override;
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
// Globally set compression level from 1 (fastest, least
|
||||
// compression) to 9 (slowest, most compression). Use -1 to set
|
||||
|
|
|
@ -54,12 +54,12 @@ class QPDF_DLL_CLASS Pl_Function: public Pipeline
|
|||
Pl_Function(char const* identifier, Pipeline* next, writer_c_char_t fn, void* udata);
|
||||
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Function();
|
||||
~Pl_Function() override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* buf, size_t len);
|
||||
void write(unsigned char const* buf, size_t len) override;
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
class QPDF_DLL_PRIVATE Members
|
||||
|
|
|
@ -36,12 +36,12 @@ class QPDF_DLL_CLASS Pl_OStream: public Pipeline
|
|||
QPDF_DLL
|
||||
Pl_OStream(char const* identifier, std::ostream& os);
|
||||
QPDF_DLL
|
||||
virtual ~Pl_OStream();
|
||||
~Pl_OStream() override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* buf, size_t len);
|
||||
void write(unsigned char const* buf, size_t len) override;
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
class QPDF_DLL_PRIVATE Members
|
||||
|
|
|
@ -45,11 +45,11 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
|
|||
Pl_QPDFTokenizer(
|
||||
char const* identifier, QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
|
||||
QPDF_DLL
|
||||
virtual ~Pl_QPDFTokenizer();
|
||||
~Pl_QPDFTokenizer() override;
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* buf, size_t len);
|
||||
void write(unsigned char const* buf, size_t len) override;
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
class QPDF_DLL_PRIVATE Members
|
||||
|
|
|
@ -29,12 +29,12 @@ class QPDF_DLL_CLASS Pl_RunLength: public Pipeline
|
|||
QPDF_DLL
|
||||
Pl_RunLength(char const* identifier, Pipeline* next, action_e action);
|
||||
QPDF_DLL
|
||||
virtual ~Pl_RunLength();
|
||||
~Pl_RunLength() override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* data, size_t len);
|
||||
void write(unsigned char const* data, size_t len) override;
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
QPDF_DLL_PRIVATE
|
||||
|
|
|
@ -36,12 +36,12 @@ class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline
|
|||
QPDF_DLL
|
||||
Pl_StdioFile(char const* identifier, FILE* f);
|
||||
QPDF_DLL
|
||||
virtual ~Pl_StdioFile();
|
||||
~Pl_StdioFile() override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* buf, size_t len);
|
||||
void write(unsigned char const* buf, size_t len) override;
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
class QPDF_DLL_PRIVATE Members
|
||||
|
|
|
@ -41,12 +41,12 @@ class QPDF_DLL_CLASS Pl_String: public Pipeline
|
|||
QPDF_DLL
|
||||
Pl_String(char const* identifier, Pipeline* next, std::string& s);
|
||||
QPDF_DLL
|
||||
virtual ~Pl_String();
|
||||
~Pl_String() override;
|
||||
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char const* buf, size_t len);
|
||||
void write(unsigned char const* buf, size_t len) override;
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
class QPDF_DLL_PRIVATE Members
|
||||
|
|
|
@ -942,8 +942,8 @@ class QPDF
|
|||
{
|
||||
public:
|
||||
CopiedStreamDataProvider(QPDF& destination_qpdf);
|
||||
virtual ~CopiedStreamDataProvider() = default;
|
||||
virtual bool provideStreamData(
|
||||
~CopiedStreamDataProvider() override = default;
|
||||
bool provideStreamData(
|
||||
QPDFObjGen const& og,
|
||||
Pipeline* pipeline,
|
||||
bool suppress_warnings,
|
||||
|
@ -963,8 +963,8 @@ class QPDF
|
|||
|
||||
public:
|
||||
StringDecrypter(QPDF* qpdf, QPDFObjGen const& og);
|
||||
virtual ~StringDecrypter() = default;
|
||||
virtual void decryptString(std::string& val);
|
||||
~StringDecrypter() override = default;
|
||||
void decryptString(std::string& val) override;
|
||||
|
||||
private:
|
||||
QPDF* qpdf;
|
||||
|
@ -1150,58 +1150,32 @@ class QPDF
|
|||
// PDF 1.4: Table F.4
|
||||
struct HPageOffsetEntry
|
||||
{
|
||||
HPageOffsetEntry() :
|
||||
delta_nobjects(0),
|
||||
delta_page_length(0),
|
||||
nshared_objects(0),
|
||||
delta_content_offset(0),
|
||||
delta_content_length(0)
|
||||
{
|
||||
}
|
||||
|
||||
int delta_nobjects; // 1
|
||||
qpdf_offset_t delta_page_length; // 2
|
||||
int nshared_objects; // 3
|
||||
int delta_nobjects{0}; // 1
|
||||
qpdf_offset_t delta_page_length{0}; // 2
|
||||
// vectors' sizes = nshared_objects
|
||||
std::vector<int> shared_identifiers; // 4
|
||||
std::vector<int> shared_numerators; // 5
|
||||
qpdf_offset_t delta_content_offset; // 6
|
||||
qpdf_offset_t delta_content_length; // 7
|
||||
int nshared_objects{0}; // 3
|
||||
std::vector<int> shared_identifiers; // 4
|
||||
std::vector<int> shared_numerators; // 5
|
||||
qpdf_offset_t delta_content_offset{0}; // 6
|
||||
qpdf_offset_t delta_content_length{0}; // 7
|
||||
};
|
||||
|
||||
// PDF 1.4: Table F.3
|
||||
struct HPageOffset
|
||||
{
|
||||
HPageOffset() :
|
||||
min_nobjects(0),
|
||||
first_page_offset(0),
|
||||
nbits_delta_nobjects(0),
|
||||
min_page_length(0),
|
||||
nbits_delta_page_length(0),
|
||||
min_content_offset(0),
|
||||
nbits_delta_content_offset(0),
|
||||
min_content_length(0),
|
||||
nbits_delta_content_length(0),
|
||||
nbits_nshared_objects(0),
|
||||
nbits_shared_identifier(0),
|
||||
nbits_shared_numerator(0),
|
||||
shared_denominator(0)
|
||||
{
|
||||
}
|
||||
|
||||
int min_nobjects; // 1
|
||||
qpdf_offset_t first_page_offset; // 2
|
||||
int nbits_delta_nobjects; // 3
|
||||
int min_page_length; // 4
|
||||
int nbits_delta_page_length; // 5
|
||||
int min_content_offset; // 6
|
||||
int nbits_delta_content_offset; // 7
|
||||
int min_content_length; // 8
|
||||
int nbits_delta_content_length; // 9
|
||||
int nbits_nshared_objects; // 10
|
||||
int nbits_shared_identifier; // 11
|
||||
int nbits_shared_numerator; // 12
|
||||
int shared_denominator; // 13
|
||||
int min_nobjects{0}; // 1
|
||||
qpdf_offset_t first_page_offset{0}; // 2
|
||||
int nbits_delta_nobjects{0}; // 3
|
||||
int min_page_length{0}; // 4
|
||||
int nbits_delta_page_length{0}; // 5
|
||||
int min_content_offset{0}; // 6
|
||||
int nbits_delta_content_offset{0}; // 7
|
||||
int min_content_length{0}; // 8
|
||||
int nbits_delta_content_length{0}; // 9
|
||||
int nbits_nshared_objects{0}; // 10
|
||||
int nbits_shared_identifier{0}; // 11
|
||||
int nbits_shared_numerator{0}; // 12
|
||||
int shared_denominator{0}; // 13
|
||||
// vector size is npages
|
||||
std::vector<HPageOffsetEntry> entries;
|
||||
};
|
||||
|
@ -1209,40 +1183,22 @@ class QPDF
|
|||
// PDF 1.4: Table F.6
|
||||
struct HSharedObjectEntry
|
||||
{
|
||||
HSharedObjectEntry() :
|
||||
delta_group_length(0),
|
||||
signature_present(0),
|
||||
nobjects_minus_one(0)
|
||||
{
|
||||
}
|
||||
|
||||
// Item 3 is a 128-bit signature (unsupported by Acrobat)
|
||||
int delta_group_length; // 1
|
||||
int signature_present; // 2 -- always 0
|
||||
int nobjects_minus_one; // 4 -- always 0
|
||||
int delta_group_length{0}; // 1
|
||||
int signature_present{0}; // 2 -- always 0
|
||||
int nobjects_minus_one{0}; // 4 -- always 0
|
||||
};
|
||||
|
||||
// PDF 1.4: Table F.5
|
||||
struct HSharedObject
|
||||
{
|
||||
HSharedObject() :
|
||||
first_shared_obj(0),
|
||||
first_shared_offset(0),
|
||||
nshared_first_page(0),
|
||||
nshared_total(0),
|
||||
nbits_nobjects(0),
|
||||
min_group_length(0),
|
||||
nbits_delta_group_length(0)
|
||||
{
|
||||
}
|
||||
|
||||
int first_shared_obj; // 1
|
||||
qpdf_offset_t first_shared_offset; // 2
|
||||
int nshared_first_page; // 3
|
||||
int nshared_total; // 4
|
||||
int nbits_nobjects; // 5
|
||||
int min_group_length; // 6
|
||||
int nbits_delta_group_length; // 7
|
||||
int first_shared_obj{0}; // 1
|
||||
qpdf_offset_t first_shared_offset{0}; // 2
|
||||
int nshared_first_page{0}; // 3
|
||||
int nshared_total{0}; // 4
|
||||
int nbits_nobjects{0}; // 5
|
||||
int min_group_length{0}; // 6
|
||||
int nbits_delta_group_length{0}; // 7
|
||||
// vector size is nshared_total
|
||||
std::vector<HSharedObjectEntry> entries;
|
||||
};
|
||||
|
@ -1250,18 +1206,10 @@ class QPDF
|
|||
// PDF 1.4: Table F.9
|
||||
struct HGeneric
|
||||
{
|
||||
HGeneric() :
|
||||
first_object(0),
|
||||
first_object_offset(0),
|
||||
nobjects(0),
|
||||
group_length(0)
|
||||
{
|
||||
}
|
||||
|
||||
int first_object; // 1
|
||||
qpdf_offset_t first_object_offset; // 2
|
||||
int nobjects; // 3
|
||||
int group_length; // 4
|
||||
int first_object{0}; // 1
|
||||
qpdf_offset_t first_object_offset{0}; // 2
|
||||
int nobjects{0}; // 3
|
||||
int group_length{0}; // 4
|
||||
};
|
||||
|
||||
// Other linearization data structures
|
||||
|
@ -1269,26 +1217,14 @@ class QPDF
|
|||
// Initialized from Linearization Parameter dictionary
|
||||
struct LinParameters
|
||||
{
|
||||
LinParameters() :
|
||||
file_size(0),
|
||||
first_page_object(0),
|
||||
first_page_end(0),
|
||||
npages(0),
|
||||
xref_zero_offset(0),
|
||||
first_page(0),
|
||||
H_offset(0),
|
||||
H_length(0)
|
||||
{
|
||||
}
|
||||
|
||||
qpdf_offset_t file_size; // /L
|
||||
int first_page_object; // /O
|
||||
qpdf_offset_t first_page_end; // /E
|
||||
int npages; // /N
|
||||
qpdf_offset_t xref_zero_offset; // /T
|
||||
int first_page; // /P
|
||||
qpdf_offset_t H_offset; // offset of primary hint stream
|
||||
qpdf_offset_t H_length; // length of primary hint stream
|
||||
qpdf_offset_t file_size{0}; // /L
|
||||
int first_page_object{0}; // /O
|
||||
qpdf_offset_t first_page_end{0}; // /E
|
||||
int npages{0}; // /N
|
||||
qpdf_offset_t xref_zero_offset{0}; // /T
|
||||
int first_page{0}; // /P
|
||||
qpdf_offset_t H_offset{0}; // offset of primary hint stream
|
||||
qpdf_offset_t H_length{0}; // length of primary hint stream
|
||||
};
|
||||
|
||||
// Computed hint table value data structures. These tables contain the computed values on which
|
||||
|
@ -1304,14 +1240,8 @@ class QPDF
|
|||
|
||||
struct CHPageOffsetEntry
|
||||
{
|
||||
CHPageOffsetEntry() :
|
||||
nobjects(0),
|
||||
nshared_objects(0)
|
||||
{
|
||||
}
|
||||
|
||||
int nobjects;
|
||||
int nshared_objects;
|
||||
int nobjects{0};
|
||||
int nshared_objects{0};
|
||||
// vectors' sizes = nshared_objects
|
||||
std::vector<int> shared_identifiers;
|
||||
};
|
||||
|
@ -1335,16 +1265,9 @@ class QPDF
|
|||
// PDF 1.4: Table F.5
|
||||
struct CHSharedObject
|
||||
{
|
||||
CHSharedObject() :
|
||||
first_shared_obj(0),
|
||||
nshared_first_page(0),
|
||||
nshared_total(0)
|
||||
{
|
||||
}
|
||||
|
||||
int first_shared_obj;
|
||||
int nshared_first_page;
|
||||
int nshared_total;
|
||||
int first_shared_obj{0};
|
||||
int nshared_first_page{0};
|
||||
int nshared_total{0};
|
||||
// vector size is nshared_total
|
||||
std::vector<CHSharedObjectEntry> entries;
|
||||
};
|
||||
|
@ -1385,9 +1308,9 @@ class QPDF
|
|||
checker(checker)
|
||||
{
|
||||
}
|
||||
virtual ~PatternFinder() = default;
|
||||
virtual bool
|
||||
check()
|
||||
~PatternFinder() override = default;
|
||||
bool
|
||||
check() override
|
||||
{
|
||||
return (this->qpdf.*checker)();
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper
|
|||
QPDF_DLL
|
||||
QPDFAcroFormDocumentHelper(QPDF&);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFAcroFormDocumentHelper() = default;
|
||||
~QPDFAcroFormDocumentHelper() override = default;
|
||||
|
||||
// This class lazily creates an internal cache of the mapping among form fields, annotations,
|
||||
// and pages. Methods within this class preserve the validity of this cache. However, if you
|
||||
|
|
|
@ -30,7 +30,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper
|
|||
QPDF_DLL
|
||||
QPDFAnnotationObjectHelper(QPDFObjectHandle);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFAnnotationObjectHelper() = default;
|
||||
~QPDFAnnotationObjectHelper() override = default;
|
||||
|
||||
// This class provides helper methods for annotations. More functionality will likely be added
|
||||
// in the future.
|
||||
|
|
|
@ -35,7 +35,7 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper
|
|||
QPDF_DLL
|
||||
QPDFEFStreamObjectHelper(QPDFObjectHandle);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFEFStreamObjectHelper() = default;
|
||||
~QPDFEFStreamObjectHelper() override = default;
|
||||
|
||||
// Date parameters are strings that conform to the PDF spec for date/time strings, which is
|
||||
// "D:yyyymmddhhmmss<z>" where <z> is either "Z" for UTC or "-hh'mm'" or "+hh'mm'" for timezone
|
||||
|
|
|
@ -39,7 +39,7 @@ class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper
|
|||
QPDF_DLL
|
||||
QPDFEmbeddedFileDocumentHelper(QPDF&);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFEmbeddedFileDocumentHelper() = default;
|
||||
~QPDFEmbeddedFileDocumentHelper() override = default;
|
||||
|
||||
QPDF_DLL
|
||||
bool hasEmbeddedFiles() const;
|
||||
|
|
|
@ -37,7 +37,7 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error
|
|||
qpdf_offset_t offset,
|
||||
std::string const& message);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFExc() noexcept = default;
|
||||
~QPDFExc() noexcept override = default;
|
||||
|
||||
// To get a complete error string, call what(), provided by std::exception. The accessors below
|
||||
// return the original values used to create the exception. Only the error code and message are
|
||||
|
|
|
@ -35,7 +35,7 @@ class QPDFFileSpecObjectHelper: public QPDFObjectHelper
|
|||
QPDF_DLL
|
||||
QPDFFileSpecObjectHelper(QPDFObjectHandle);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFFileSpecObjectHelper() = default;
|
||||
~QPDFFileSpecObjectHelper() override = default;
|
||||
|
||||
QPDF_DLL
|
||||
std::string getDescription();
|
||||
|
|
|
@ -37,7 +37,7 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper
|
|||
QPDF_DLL
|
||||
QPDFFormFieldObjectHelper(QPDFObjectHandle);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFFormFieldObjectHelper() = default;
|
||||
~QPDFFormFieldObjectHelper() override = default;
|
||||
|
||||
QPDF_DLL
|
||||
bool isNull();
|
||||
|
|
|
@ -145,11 +145,6 @@ class QPDFJob
|
|||
|
||||
struct AddAttachment
|
||||
{
|
||||
AddAttachment() :
|
||||
replace(false)
|
||||
{
|
||||
}
|
||||
|
||||
std::string path;
|
||||
std::string key;
|
||||
std::string filename;
|
||||
|
@ -157,7 +152,7 @@ class QPDFJob
|
|||
std::string moddate;
|
||||
std::string mimetype;
|
||||
std::string description;
|
||||
bool replace;
|
||||
bool replace{false};
|
||||
};
|
||||
|
||||
struct PageSpec
|
||||
|
|
|
@ -50,7 +50,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
|
|||
static QPDFNameTreeObjectHelper newEmpty(QPDF&, bool auto_repair = true);
|
||||
|
||||
QPDF_DLL
|
||||
virtual ~QPDFNameTreeObjectHelper();
|
||||
~QPDFNameTreeObjectHelper() override;
|
||||
|
||||
// Return whether the name tree has an explicit entry for this name.
|
||||
QPDF_DLL
|
||||
|
|
|
@ -44,7 +44,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
|
|||
QPDFNumberTreeObjectHelper(QPDFObjectHandle, QPDF&, bool auto_repair = true);
|
||||
|
||||
QPDF_DLL
|
||||
virtual ~QPDFNumberTreeObjectHelper();
|
||||
~QPDFNumberTreeObjectHelper() override;
|
||||
|
||||
// Create an empty number tree
|
||||
QPDF_DLL
|
||||
|
|
|
@ -34,9 +34,7 @@ class QPDFObjGen
|
|||
public:
|
||||
// ABI: change to default.
|
||||
QPDF_DLL
|
||||
QPDFObjGen() :
|
||||
obj(0),
|
||||
gen(0)
|
||||
QPDFObjGen()
|
||||
{
|
||||
}
|
||||
QPDF_DLL
|
||||
|
|
|
@ -41,7 +41,7 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper
|
|||
QPDF_DLL
|
||||
QPDFOutlineDocumentHelper(QPDF&);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFOutlineDocumentHelper() = default;
|
||||
~QPDFOutlineDocumentHelper() override = default;
|
||||
|
||||
QPDF_DLL
|
||||
bool hasOutlines();
|
||||
|
|
|
@ -34,7 +34,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
|
|||
{
|
||||
public:
|
||||
QPDF_DLL
|
||||
virtual ~QPDFOutlineObjectHelper()
|
||||
~QPDFOutlineObjectHelper() override
|
||||
{
|
||||
// This must be cleared explicitly to avoid circular references that prevent cleanup of
|
||||
// shared pointers.
|
||||
|
@ -81,7 +81,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
|
|||
static QPDFOutlineObjectHelper
|
||||
create(QPDFObjectHandle oh, QPDFOutlineDocumentHelper& dh, int depth)
|
||||
{
|
||||
return QPDFOutlineObjectHelper(oh, dh, depth);
|
||||
return {oh, dh, depth};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper
|
|||
QPDF_DLL
|
||||
QPDFPageDocumentHelper(QPDF&);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFPageDocumentHelper() = default;
|
||||
~QPDFPageDocumentHelper() override = default;
|
||||
|
||||
// Traverse page tree, and return all /Page objects wrapped in QPDFPageObjectHelper objects.
|
||||
// Unlike with QPDF::getAllPages, the vector of pages returned by this call is not affected by
|
||||
|
|
|
@ -44,7 +44,7 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper
|
|||
QPDF_DLL
|
||||
QPDFPageLabelDocumentHelper(QPDF&);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFPageLabelDocumentHelper() = default;
|
||||
~QPDFPageLabelDocumentHelper() override = default;
|
||||
|
||||
QPDF_DLL
|
||||
bool hasPageLabels();
|
||||
|
|
|
@ -39,7 +39,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
|
|||
QPDF_DLL
|
||||
QPDFPageObjectHelper(QPDFObjectHandle);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFPageObjectHelper() = default;
|
||||
~QPDFPageObjectHelper() override = default;
|
||||
|
||||
// PAGE ATTRIBUTES
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error
|
|||
QPDF_DLL
|
||||
QPDFSystemError(std::string const& description, int system_errno);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFSystemError() noexcept = default;
|
||||
~QPDFSystemError() noexcept override = default;
|
||||
|
||||
// To get a complete error string, call what(), provided by std::exception. The accessors below
|
||||
// return the original values used to create the exception.
|
||||
|
|
|
@ -30,7 +30,7 @@ class QPDF_DLL_CLASS QPDFUsage: public std::runtime_error
|
|||
QPDF_DLL
|
||||
QPDFUsage(std::string const& msg);
|
||||
QPDF_DLL
|
||||
virtual ~QPDFUsage() noexcept = default;
|
||||
~QPDFUsage() noexcept override = default;
|
||||
};
|
||||
|
||||
#endif // QPDFUSAGE_HH
|
||||
|
|
|
@ -92,7 +92,7 @@ class QPDFWriter
|
|||
QPDF_DLL
|
||||
FunctionProgressReporter(std::function<void(int)>);
|
||||
QPDF_DLL
|
||||
virtual ~FunctionProgressReporter();
|
||||
~FunctionProgressReporter() override;
|
||||
QPDF_DLL
|
||||
void reportProgress(int) override;
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ InputSource::readLine(size_t max_line_length)
|
|||
if (line_length < max_line_length) {
|
||||
buf[line_length] = '\0';
|
||||
}
|
||||
return std::string(buf);
|
||||
return {buf};
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -269,7 +269,7 @@ JSON::encode_string(std::string const& str)
|
|||
JSON
|
||||
JSON::makeDictionary()
|
||||
{
|
||||
return JSON(std::make_unique<JSON_dictionary>());
|
||||
return {std::make_unique<JSON_dictionary>()};
|
||||
}
|
||||
|
||||
JSON
|
||||
|
@ -299,7 +299,7 @@ JSON::checkDictionaryKeySeen(std::string const& key)
|
|||
JSON
|
||||
JSON::makeArray()
|
||||
{
|
||||
return JSON(std::make_unique<JSON_array>());
|
||||
return {std::make_unique<JSON_array>()};
|
||||
}
|
||||
|
||||
JSON
|
||||
|
@ -320,43 +320,43 @@ JSON::addArrayElement(JSON const& val)
|
|||
JSON
|
||||
JSON::makeString(std::string const& utf8)
|
||||
{
|
||||
return JSON(std::make_unique<JSON_string>(utf8));
|
||||
return {std::make_unique<JSON_string>(utf8)};
|
||||
}
|
||||
|
||||
JSON
|
||||
JSON::makeInt(long long int value)
|
||||
{
|
||||
return JSON(std::make_unique<JSON_number>(value));
|
||||
return {std::make_unique<JSON_number>(value)};
|
||||
}
|
||||
|
||||
JSON
|
||||
JSON::makeReal(double value)
|
||||
{
|
||||
return JSON(std::make_unique<JSON_number>(value));
|
||||
return {std::make_unique<JSON_number>(value)};
|
||||
}
|
||||
|
||||
JSON
|
||||
JSON::makeNumber(std::string const& encoded)
|
||||
{
|
||||
return JSON(std::make_unique<JSON_number>(encoded));
|
||||
return {std::make_unique<JSON_number>(encoded)};
|
||||
}
|
||||
|
||||
JSON
|
||||
JSON::makeBool(bool value)
|
||||
{
|
||||
return JSON(std::make_unique<JSON_bool>(value));
|
||||
return {std::make_unique<JSON_bool>(value)};
|
||||
}
|
||||
|
||||
JSON
|
||||
JSON::makeNull()
|
||||
{
|
||||
return JSON(std::make_unique<JSON_null>());
|
||||
return {std::make_unique<JSON_null>()};
|
||||
}
|
||||
|
||||
JSON
|
||||
JSON::makeBlob(std::function<void(Pipeline*)> fn)
|
||||
{
|
||||
return JSON(std::make_unique<JSON_blob>(fn));
|
||||
return {std::make_unique<JSON_blob>(fn)};
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -588,14 +588,7 @@ namespace
|
|||
JSONParser(InputSource& is, JSON::Reactor* reactor) :
|
||||
is(is),
|
||||
reactor(reactor),
|
||||
lex_state(ls_top),
|
||||
bytes(0),
|
||||
p(buf),
|
||||
u_count(0),
|
||||
offset(0),
|
||||
done(false),
|
||||
parser_state(ps_top),
|
||||
dict_key_offset(0)
|
||||
p(buf)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -665,20 +658,20 @@ namespace
|
|||
|
||||
InputSource& is;
|
||||
JSON::Reactor* reactor;
|
||||
lex_state_e lex_state;
|
||||
lex_state_e lex_state{ls_top};
|
||||
char buf[16384];
|
||||
size_t bytes;
|
||||
size_t bytes{0};
|
||||
char const* p;
|
||||
qpdf_offset_t u_count;
|
||||
qpdf_offset_t u_count{0};
|
||||
unsigned long u_value{0};
|
||||
qpdf_offset_t offset;
|
||||
bool done;
|
||||
qpdf_offset_t offset{0};
|
||||
bool done{false};
|
||||
std::string token;
|
||||
qpdf_offset_t token_start{0};
|
||||
parser_state_e parser_state;
|
||||
parser_state_e parser_state{ps_top};
|
||||
std::vector<StackFrame> stack;
|
||||
std::string dict_key;
|
||||
qpdf_offset_t dict_key_offset;
|
||||
qpdf_offset_t dict_key_offset{0};
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
@ -1282,7 +1275,7 @@ JSONParser::handleToken()
|
|||
|
||||
case ps_top:
|
||||
if (!(item.isDictionary() || item.isArray())) {
|
||||
stack.push_back({ps_done, item});
|
||||
stack.emplace_back(ps_done, item);
|
||||
parser_state = ps_done;
|
||||
return;
|
||||
}
|
||||
|
@ -1311,7 +1304,7 @@ JSONParser::handleToken()
|
|||
}
|
||||
|
||||
if (item.isDictionary() || item.isArray()) {
|
||||
stack.push_back({parser_state, item});
|
||||
stack.emplace_back(parser_state, item);
|
||||
// Calling container start method is postponed until after adding the containers to their
|
||||
// parent containers, if any. This makes it much easier to keep track of the current nesting
|
||||
// level.
|
||||
|
|
|
@ -319,7 +319,7 @@ NNTreeIterator::split(QPDFObjectHandle to_split, std::list<PathElement>::iterato
|
|||
auto next = this->path.begin();
|
||||
next->node = first_node;
|
||||
}
|
||||
this->path.push_front(PathElement(to_split, 0));
|
||||
this->path.emplace_front(to_split, 0);
|
||||
parent = this->path.begin();
|
||||
to_split = first_node;
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ NNTreeIterator::setItemNumber(QPDFObjectHandle const& node, int n)
|
|||
void
|
||||
NNTreeIterator::addPathElement(QPDFObjectHandle const& node, int kid_number)
|
||||
{
|
||||
this->path.push_back(PathElement(node, kid_number));
|
||||
this->path.emplace_back(node, kid_number);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -591,7 +591,7 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
|
|||
bool failed = false;
|
||||
|
||||
QPDFObjGen::set seen;
|
||||
for (auto i: this->path) {
|
||||
for (auto const& i: this->path) {
|
||||
seen.add(i.node);
|
||||
}
|
||||
while (!failed) {
|
||||
|
@ -689,7 +689,7 @@ NNTreeImpl::begin()
|
|||
NNTreeImpl::iterator
|
||||
NNTreeImpl::end()
|
||||
{
|
||||
return iterator(*this);
|
||||
return {*this};
|
||||
}
|
||||
|
||||
NNTreeImpl::iterator
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -840,7 +840,7 @@ QPDF::read_xrefTable(qpdf_offset_t xref_offset)
|
|||
}
|
||||
if (type == 'f') {
|
||||
// Save deleted items until after we've checked the XRefStm, if any.
|
||||
deleted_items.push_back(QPDFObjGen(toI(i), f2));
|
||||
deleted_items.emplace_back(toI(i), f2);
|
||||
} else {
|
||||
insertXrefEntry(toI(i), 1, f1, f2);
|
||||
}
|
||||
|
@ -2207,7 +2207,7 @@ QPDF::getVersionAsPDFVersion()
|
|||
minor = QUtil::string_to_int(match[2].str().c_str());
|
||||
}
|
||||
|
||||
return PDFVersion(major, minor, extension_level);
|
||||
return {major, minor, extension_level};
|
||||
}
|
||||
|
||||
std::string
|
||||
|
@ -2478,7 +2478,7 @@ QPDF::damagedPDF(
|
|||
qpdf_offset_t offset,
|
||||
std::string const& message)
|
||||
{
|
||||
return QPDFExc(qpdf_e_damaged_pdf, input->getName(), object, offset, message);
|
||||
return {qpdf_e_damaged_pdf, input->getName(), object, offset, message};
|
||||
}
|
||||
|
||||
// Return an exception of type qpdf_e_damaged_pdf. The object is taken from
|
||||
|
@ -2494,7 +2494,7 @@ QPDF::damagedPDF(
|
|||
QPDFExc
|
||||
QPDF::damagedPDF(std::string const& object, qpdf_offset_t offset, std::string const& message)
|
||||
{
|
||||
return QPDFExc(qpdf_e_damaged_pdf, m->file->getName(), object, offset, message);
|
||||
return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message};
|
||||
}
|
||||
|
||||
// Return an exception of type qpdf_e_damaged_pdf. The filename is taken from m->file and the
|
||||
|
|
|
@ -70,7 +70,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle>
|
|||
if (seen.add(obj)) {
|
||||
auto kids = obj.getKey("/Kids");
|
||||
if (kids.isArray()) {
|
||||
for (auto kid: kids.aitems()) {
|
||||
for (auto const& kid: kids.aitems()) {
|
||||
queue.push_back(kid);
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle>
|
|||
}
|
||||
}
|
||||
|
||||
for (auto i: fields) {
|
||||
for (auto const& i: fields) {
|
||||
addFormField(i);
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ QPDFAcroFormDocumentHelper::getFormFields()
|
|||
analyze();
|
||||
std::vector<QPDFFormFieldObjectHelper> result;
|
||||
for (auto const& iter: m->field_to_annotations) {
|
||||
result.push_back(this->qpdf.getObject(iter.first));
|
||||
result.emplace_back(this->qpdf.getObject(iter.first));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ QPDFAcroFormDocumentHelper::analyze()
|
|||
annot.warnIfPossible("this widget annotation is not"
|
||||
" reachable from /AcroForm in the document catalog");
|
||||
m->annotation_to_field[og] = QPDFFormFieldObjectHelper(annot);
|
||||
m->field_to_annotations[og].push_back(QPDFAnnotationObjectHelper(annot));
|
||||
m->field_to_annotations[og].emplace_back(annot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ QPDFAcroFormDocumentHelper::traverseField(
|
|||
|
||||
if (is_annotation) {
|
||||
QPDFObjectHandle our_field = (is_field ? field : parent);
|
||||
m->field_to_annotations[our_field.getObjGen()].push_back(QPDFAnnotationObjectHelper(field));
|
||||
m->field_to_annotations[our_field.getObjGen()].emplace_back(field);
|
||||
m->annotation_to_field[og] = QPDFFormFieldObjectHelper(our_field);
|
||||
}
|
||||
|
||||
|
@ -469,19 +469,18 @@ namespace
|
|||
ResourceReplacer(
|
||||
std::map<std::string, std::map<std::string, std::string>> const& dr_map,
|
||||
std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames);
|
||||
virtual ~ResourceReplacer() = default;
|
||||
virtual void handleToken(QPDFTokenizer::Token const&) override;
|
||||
~ResourceReplacer() override = default;
|
||||
void handleToken(QPDFTokenizer::Token const&) override;
|
||||
|
||||
private:
|
||||
size_t offset;
|
||||
size_t offset{0};
|
||||
std::map<std::string, std::map<size_t, std::string>> to_replace;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
ResourceReplacer::ResourceReplacer(
|
||||
std::map<std::string, std::map<std::string, std::string>> const& dr_map,
|
||||
std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames) :
|
||||
offset(0)
|
||||
std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames)
|
||||
{
|
||||
// We have:
|
||||
// * dr_map[resource_type][key] == new_key
|
||||
|
@ -1019,7 +1018,7 @@ QPDFAcroFormDocumentHelper::fixCopiedAnnotations(
|
|||
to_page.replaceKey("/Annots", QPDFObjectHandle::newArray(new_annots));
|
||||
addAndRenameFormFields(new_fields);
|
||||
if (added_fields) {
|
||||
for (auto f: new_fields) {
|
||||
for (auto const& f: new_fields) {
|
||||
added_fields->insert(f.getObjGen());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ QPDFCrypto_openssl::MD5_digest(MD5_Digest d)
|
|||
std::string
|
||||
QPDFCrypto_openssl::SHA2_digest()
|
||||
{
|
||||
return std::string(reinterpret_cast<char*>(md_out), sha2_bits / 8);
|
||||
return {reinterpret_cast<char*>(md_out), sha2_bits / 8};
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <qpdf/QPDFDocumentHelper.hh>
|
||||
|
||||
QPDFDocumentHelper::~QPDFDocumentHelper()
|
||||
QPDFDocumentHelper::~QPDFDocumentHelper() // NOLINT (modernize-use-equals-default)
|
||||
{
|
||||
// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
|
||||
}
|
||||
|
|
|
@ -481,8 +481,8 @@ namespace
|
|||
std::vector<std::string> opt;
|
||||
double tf;
|
||||
QPDFObjectHandle::Rectangle bbox;
|
||||
enum { st_top, st_bmc, st_emc, st_end } state;
|
||||
bool replaced;
|
||||
enum { st_top, st_bmc, st_emc, st_end } state{st_top};
|
||||
bool replaced{false};
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
@ -496,9 +496,7 @@ ValueSetter::ValueSetter(
|
|||
V(V),
|
||||
opt(opt),
|
||||
tf(tf),
|
||||
bbox(bbox),
|
||||
state(st_top),
|
||||
replaced(false)
|
||||
bbox(bbox)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -649,34 +647,24 @@ 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();
|
||||
std::string getDA();
|
||||
|
||||
private:
|
||||
double tf;
|
||||
int tf_idx;
|
||||
double tf{11.0};
|
||||
int tf_idx{-1};
|
||||
std::string font_name;
|
||||
double last_num;
|
||||
int last_num_idx;
|
||||
double last_num{0.0};
|
||||
int last_num_idx{-1};
|
||||
std::string last_name;
|
||||
std::vector<std::string> DA;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
TfFinder::TfFinder() :
|
||||
tf(11.0),
|
||||
tf_idx(-1),
|
||||
last_num(0.0),
|
||||
last_num_idx(-1)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
TfFinder::handleToken(QPDFTokenizer::Token const& token)
|
||||
{
|
||||
|
|
|
@ -428,7 +428,7 @@ QPDFJob::parseNumrange(char const* range, int max)
|
|||
} catch (std::runtime_error& e) {
|
||||
usage(e.what());
|
||||
}
|
||||
return std::vector<int>();
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<QPDF>
|
||||
|
@ -894,7 +894,7 @@ QPDFJob::doListAttachments(QPDF& pdf)
|
|||
v << " " << i2.first << " -> " << i2.second << "\n";
|
||||
}
|
||||
v << " all data streams:\n";
|
||||
for (auto i2: efoh->getEmbeddedFileStreams().ditems()) {
|
||||
for (auto const& i2: efoh->getEmbeddedFileStreams().ditems()) {
|
||||
auto efs = QPDFEFStreamObjectHelper(i2.second);
|
||||
v << " " << i2.first << " -> "
|
||||
<< efs.getObjectHandle().getObjGen().unparse(',') << "\n";
|
||||
|
@ -1329,7 +1329,7 @@ QPDFJob::doJSONAttachments(Pipeline* p, bool& first, QPDF& pdf)
|
|||
j_names.addDictionaryMember(i2.first, JSON::makeString(i2.second));
|
||||
}
|
||||
auto j_streams = j_details.addDictionaryMember("streams", JSON::makeDictionary());
|
||||
for (auto i2: fsoh->getEmbeddedFileStreams().ditems()) {
|
||||
for (auto const& i2: fsoh->getEmbeddedFileStreams().ditems()) {
|
||||
auto efs = QPDFEFStreamObjectHelper(i2.second);
|
||||
auto j_stream = j_streams.addDictionaryMember(i2.first, JSON::makeDictionary());
|
||||
j_stream.addDictionaryMember(
|
||||
|
@ -2376,9 +2376,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea
|
|||
|
||||
// Read original pages from the PDF, and parse the page range associated with this
|
||||
// occurrence of the file.
|
||||
parsed_specs.push_back(
|
||||
// line-break
|
||||
QPDFPageData(page_spec.filename, page_spec_qpdfs[page_spec.filename], page_spec.range));
|
||||
parsed_specs.emplace_back(
|
||||
page_spec.filename, page_spec_qpdfs[page_spec.filename], page_spec.range);
|
||||
}
|
||||
|
||||
std::map<unsigned long long, bool> remove_unreferenced;
|
||||
|
@ -2427,9 +2426,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea
|
|||
for (size_t j = 0; j < m->collate; ++j) {
|
||||
if (cur_page + j < page_data.selected_pages.size()) {
|
||||
got_pages = true;
|
||||
new_parsed_specs.push_back(
|
||||
// line-break
|
||||
QPDFPageData(page_data, page_data.selected_pages.at(cur_page + j)));
|
||||
new_parsed_specs.emplace_back(
|
||||
page_data, page_data.selected_pages.at(cur_page + j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,18 +40,15 @@ namespace
|
|||
std::shared_ptr<QPDFJob::UOConfig> c_uo;
|
||||
std::shared_ptr<QPDFJob::EncConfig> c_enc;
|
||||
std::vector<std::string> accumulated_args;
|
||||
std::shared_ptr<char> pages_password;
|
||||
bool gave_input;
|
||||
bool gave_output;
|
||||
std::shared_ptr<char> pages_password{nullptr};
|
||||
bool gave_input{false};
|
||||
bool gave_output{false};
|
||||
};
|
||||
} // namespace
|
||||
|
||||
ArgParser::ArgParser(QPDFArgParser& ap, std::shared_ptr<QPDFJob::Config> c_main) :
|
||||
ap(ap),
|
||||
c_main(c_main),
|
||||
pages_password(nullptr),
|
||||
gave_input(false),
|
||||
gave_output(false)
|
||||
c_main(c_main)
|
||||
{
|
||||
initOptionTables();
|
||||
}
|
||||
|
|
|
@ -942,7 +942,7 @@ QPDFJob::PagesConfig*
|
|||
QPDFJob::PagesConfig::pageSpec(
|
||||
std::string const& filename, std::string const& range, char const* password)
|
||||
{
|
||||
this->config->o.m->page_specs.push_back(QPDFJob::PageSpec(filename, password, range));
|
||||
this->config->o.m->page_specs.emplace_back(filename, password, range);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace
|
|||
|
||||
std::list<std::shared_ptr<JSONHandler>> json_handlers;
|
||||
bool partial;
|
||||
JSONHandler* jh; // points to last of json_handlers
|
||||
JSONHandler* jh{nullptr}; // points to last of json_handlers
|
||||
std::shared_ptr<QPDFJob::Config> c_main;
|
||||
std::shared_ptr<QPDFJob::CopyAttConfig> c_copy_att;
|
||||
std::shared_ptr<QPDFJob::AttConfig> c_att;
|
||||
|
@ -71,7 +71,6 @@ namespace
|
|||
|
||||
Handlers::Handlers(bool partial, std::shared_ptr<QPDFJob::Config> c_main) :
|
||||
partial(partial),
|
||||
jh(nullptr),
|
||||
c_main(c_main)
|
||||
{
|
||||
initHandlers();
|
||||
|
|
|
@ -12,8 +12,7 @@ namespace
|
|||
{
|
||||
public:
|
||||
Pl_Track(char const* identifier, Pipeline* next) :
|
||||
Pipeline(identifier, next),
|
||||
used(false)
|
||||
Pipeline(identifier, next)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -37,7 +36,7 @@ namespace
|
|||
}
|
||||
|
||||
private:
|
||||
bool used;
|
||||
bool used{false};
|
||||
};
|
||||
}; // namespace
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ QPDFMatrix::unparse() const
|
|||
QPDFObjectHandle::Matrix
|
||||
QPDFMatrix::getAsMatrix() const
|
||||
{
|
||||
return QPDFObjectHandle::Matrix(a, b, c, d, e, f);
|
||||
return {a, b, c, d, e, f};
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -124,11 +124,11 @@ QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const
|
|||
transform(r.llx, r.ury, tx.at(1), ty.at(1));
|
||||
transform(r.urx, r.lly, tx.at(2), ty.at(2));
|
||||
transform(r.urx, r.ury, tx.at(3), ty.at(3));
|
||||
return QPDFObjectHandle::Rectangle(
|
||||
return {
|
||||
*std::min_element(tx.begin(), tx.end()),
|
||||
*std::min_element(ty.begin(), ty.end()),
|
||||
*std::max_element(tx.begin(), tx.end()),
|
||||
*std::max_element(ty.begin(), ty.end()));
|
||||
*std::max_element(ty.begin(), ty.end())};
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -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.
|
||||
|
@ -54,8 +54,7 @@ QPDFNameTreeObjectHelper::QPDFNameTreeObjectHelper(QPDFObjectHandle oh, QPDF& q,
|
|||
QPDFNameTreeObjectHelper
|
||||
QPDFNameTreeObjectHelper::newEmpty(QPDF& qpdf, bool auto_repair)
|
||||
{
|
||||
return QPDFNameTreeObjectHelper(
|
||||
qpdf.makeIndirectObject("<< /Names [] >>"_qpdf), qpdf, auto_repair);
|
||||
return {qpdf.makeIndirectObject("<< /Names [] >>"_qpdf), qpdf, auto_repair};
|
||||
}
|
||||
|
||||
QPDFNameTreeObjectHelper::iterator::iterator(std::shared_ptr<NNTreeIterator> const& i) :
|
||||
|
@ -135,33 +134,33 @@ QPDFNameTreeObjectHelper::iterator::remove()
|
|||
QPDFNameTreeObjectHelper::iterator
|
||||
QPDFNameTreeObjectHelper::begin() const
|
||||
{
|
||||
return iterator(std::make_shared<NNTreeIterator>(m->impl->begin()));
|
||||
return {std::make_shared<NNTreeIterator>(m->impl->begin())};
|
||||
}
|
||||
|
||||
QPDFNameTreeObjectHelper::iterator
|
||||
QPDFNameTreeObjectHelper::end() const
|
||||
{
|
||||
return iterator(std::make_shared<NNTreeIterator>(m->impl->end()));
|
||||
return {std::make_shared<NNTreeIterator>(m->impl->end())};
|
||||
}
|
||||
|
||||
QPDFNameTreeObjectHelper::iterator
|
||||
QPDFNameTreeObjectHelper::last() const
|
||||
{
|
||||
return iterator(std::make_shared<NNTreeIterator>(m->impl->last()));
|
||||
return {std::make_shared<NNTreeIterator>(m->impl->last())};
|
||||
}
|
||||
|
||||
QPDFNameTreeObjectHelper::iterator
|
||||
QPDFNameTreeObjectHelper::find(std::string const& key, bool return_prev_if_not_found)
|
||||
{
|
||||
auto i = m->impl->find(QPDFObjectHandle::newUnicodeString(key), return_prev_if_not_found);
|
||||
return iterator(std::make_shared<NNTreeIterator>(i));
|
||||
return {std::make_shared<NNTreeIterator>(i)};
|
||||
}
|
||||
|
||||
QPDFNameTreeObjectHelper::iterator
|
||||
QPDFNameTreeObjectHelper::insert(std::string const& key, QPDFObjectHandle value)
|
||||
{
|
||||
auto i = m->impl->insert(QPDFObjectHandle::newUnicodeString(key), value);
|
||||
return iterator(std::make_shared<NNTreeIterator>(i));
|
||||
return {std::make_shared<NNTreeIterator>(i)};
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -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.
|
||||
|
@ -56,8 +56,7 @@ QPDFNumberTreeObjectHelper::QPDFNumberTreeObjectHelper(
|
|||
QPDFNumberTreeObjectHelper
|
||||
QPDFNumberTreeObjectHelper::newEmpty(QPDF& qpdf, bool auto_repair)
|
||||
{
|
||||
return QPDFNumberTreeObjectHelper(
|
||||
qpdf.makeIndirectObject("<< /Nums [] >>"_qpdf), qpdf, auto_repair);
|
||||
return {qpdf.makeIndirectObject("<< /Nums [] >>"_qpdf), qpdf, auto_repair};
|
||||
}
|
||||
|
||||
QPDFNumberTreeObjectHelper::iterator::iterator(std::shared_ptr<NNTreeIterator> const& i) :
|
||||
|
@ -137,33 +136,33 @@ QPDFNumberTreeObjectHelper::iterator::remove()
|
|||
QPDFNumberTreeObjectHelper::iterator
|
||||
QPDFNumberTreeObjectHelper::begin() const
|
||||
{
|
||||
return iterator(std::make_shared<NNTreeIterator>(m->impl->begin()));
|
||||
return {std::make_shared<NNTreeIterator>(m->impl->begin())};
|
||||
}
|
||||
|
||||
QPDFNumberTreeObjectHelper::iterator
|
||||
QPDFNumberTreeObjectHelper::end() const
|
||||
{
|
||||
return iterator(std::make_shared<NNTreeIterator>(m->impl->end()));
|
||||
return {std::make_shared<NNTreeIterator>(m->impl->end())};
|
||||
}
|
||||
|
||||
QPDFNumberTreeObjectHelper::iterator
|
||||
QPDFNumberTreeObjectHelper::last() const
|
||||
{
|
||||
return iterator(std::make_shared<NNTreeIterator>(m->impl->last()));
|
||||
return {std::make_shared<NNTreeIterator>(m->impl->last())};
|
||||
}
|
||||
|
||||
QPDFNumberTreeObjectHelper::iterator
|
||||
QPDFNumberTreeObjectHelper::find(numtree_number key, bool return_prev_if_not_found)
|
||||
{
|
||||
auto i = m->impl->find(QPDFObjectHandle::newInteger(key), return_prev_if_not_found);
|
||||
return iterator(std::make_shared<NNTreeIterator>(i));
|
||||
return {std::make_shared<NNTreeIterator>(i)};
|
||||
}
|
||||
|
||||
QPDFNumberTreeObjectHelper::iterator
|
||||
QPDFNumberTreeObjectHelper::insert(numtree_number key, QPDFObjectHandle value)
|
||||
{
|
||||
auto i = m->impl->insert(QPDFObjectHandle::newInteger(key), value);
|
||||
return iterator(std::make_shared<NNTreeIterator>(i));
|
||||
return {std::make_shared<NNTreeIterator>(i)};
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -189,13 +189,12 @@ namespace
|
|||
unsigned char getLastChar();
|
||||
|
||||
private:
|
||||
unsigned char last_char;
|
||||
unsigned char last_char{0};
|
||||
};
|
||||
} // namespace
|
||||
|
||||
LastChar::LastChar(Pipeline* next) :
|
||||
Pipeline("lastchar", next),
|
||||
last_char(0)
|
||||
Pipeline("lastchar", next)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -752,7 +751,7 @@ QPDFObjectHandle::getValueAsInlineImage(std::string& value)
|
|||
QPDFObjectHandle::QPDFArrayItems
|
||||
QPDFObjectHandle::aitems()
|
||||
{
|
||||
return QPDFArrayItems(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -826,11 +825,11 @@ QPDFObjectHandle::getArrayAsRectangle()
|
|||
return {};
|
||||
}
|
||||
}
|
||||
return Rectangle(
|
||||
return {
|
||||
std::min(items[0], items[2]),
|
||||
std::min(items[1], items[3]),
|
||||
std::max(items[0], items[2]),
|
||||
std::max(items[1], items[3]));
|
||||
std::max(items[1], items[3])};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -848,7 +847,7 @@ QPDFObjectHandle::getArrayAsMatrix()
|
|||
return {};
|
||||
}
|
||||
}
|
||||
return Matrix(items[0], items[1], items[2], items[3], items[4], items[5]);
|
||||
return {items[0], items[1], items[2], items[3], items[4], items[5]};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -959,7 +958,7 @@ QPDFObjectHandle::eraseItemAndGetOld(int at)
|
|||
QPDFObjectHandle::QPDFDictItems
|
||||
QPDFObjectHandle::ditems()
|
||||
{
|
||||
return QPDFDictItems(*this);
|
||||
return {*this};
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1049,7 +1048,7 @@ QPDFObjectHandle::makeResourcesIndirect(QPDF& owning_qpdf)
|
|||
if (!sub.isDictionary()) {
|
||||
continue;
|
||||
}
|
||||
for (auto i2: sub.ditems()) {
|
||||
for (auto const& i2: sub.ditems()) {
|
||||
std::string const& key = i2.first;
|
||||
QPDFObjectHandle val = i2.second;
|
||||
if (!val.isIndirect()) {
|
||||
|
@ -1070,7 +1069,7 @@ QPDFObjectHandle::mergeResources(
|
|||
|
||||
auto make_og_to_name = [](QPDFObjectHandle& dict,
|
||||
std::map<QPDFObjGen, std::string>& og_to_name) {
|
||||
for (auto i: dict.ditems()) {
|
||||
for (auto const& i: dict.ditems()) {
|
||||
if (i.second.isIndirect()) {
|
||||
og_to_name[i.second.getObjGen()] = i.first;
|
||||
}
|
||||
|
@ -1079,7 +1078,7 @@ QPDFObjectHandle::mergeResources(
|
|||
|
||||
// This algorithm is described in comments in QPDFObjectHandle.hh
|
||||
// above the declaration of mergeResources.
|
||||
for (auto o_top: other.ditems()) {
|
||||
for (auto const& o_top: other.ditems()) {
|
||||
std::string const& rtype = o_top.first;
|
||||
QPDFObjectHandle other_val = o_top.second;
|
||||
if (hasKey(rtype)) {
|
||||
|
@ -1096,7 +1095,7 @@ QPDFObjectHandle::mergeResources(
|
|||
std::set<std::string> rnames;
|
||||
int min_suffix = 1;
|
||||
bool initialized_maps = false;
|
||||
for (auto ov_iter: other_val.ditems()) {
|
||||
for (auto const& ov_iter: other_val.ditems()) {
|
||||
std::string const& key = ov_iter.first;
|
||||
QPDFObjectHandle rval = ov_iter.second;
|
||||
if (!this_val.hasKey(key)) {
|
||||
|
@ -1862,61 +1861,61 @@ QPDFObjectHandle::getParsedOffset()
|
|||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newBool(bool value)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Bool::create(value));
|
||||
return {QPDF_Bool::create(value)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newNull()
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Null::create());
|
||||
return {QPDF_Null::create()};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newInteger(long long value)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Integer::create(value));
|
||||
return {QPDF_Integer::create(value)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newReal(std::string const& value)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Real::create(value));
|
||||
return {QPDF_Real::create(value)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newReal(double value, int decimal_places, bool trim_trailing_zeroes)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Real::create(value, decimal_places, trim_trailing_zeroes));
|
||||
return {QPDF_Real::create(value, decimal_places, trim_trailing_zeroes)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newName(std::string const& name)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Name::create(name));
|
||||
return {QPDF_Name::create(name)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newString(std::string const& str)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_String::create(str));
|
||||
return {QPDF_String::create(str)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newUnicodeString(std::string const& utf8_str)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_String::create_utf16(utf8_str));
|
||||
return {QPDF_String::create_utf16(utf8_str)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newOperator(std::string const& value)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Operator::create(value));
|
||||
return {QPDF_Operator::create(value)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newInlineImage(std::string const& value)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_InlineImage::create(value));
|
||||
return {QPDF_InlineImage::create(value)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
|
@ -1928,44 +1927,37 @@ QPDFObjectHandle::newArray()
|
|||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newArray(std::vector<QPDFObjectHandle> const& items)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Array::create(items));
|
||||
return {QPDF_Array::create(items)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newArray(Rectangle const& rect)
|
||||
{
|
||||
std::vector<QPDFObjectHandle> items;
|
||||
items.push_back(newReal(rect.llx));
|
||||
items.push_back(newReal(rect.lly));
|
||||
items.push_back(newReal(rect.urx));
|
||||
items.push_back(newReal(rect.ury));
|
||||
return newArray(items);
|
||||
return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newArray(Matrix const& matrix)
|
||||
{
|
||||
std::vector<QPDFObjectHandle> items;
|
||||
items.push_back(newReal(matrix.a));
|
||||
items.push_back(newReal(matrix.b));
|
||||
items.push_back(newReal(matrix.c));
|
||||
items.push_back(newReal(matrix.d));
|
||||
items.push_back(newReal(matrix.e));
|
||||
items.push_back(newReal(matrix.f));
|
||||
return newArray(items);
|
||||
return newArray(
|
||||
{newReal(matrix.a),
|
||||
newReal(matrix.b),
|
||||
newReal(matrix.c),
|
||||
newReal(matrix.d),
|
||||
newReal(matrix.e),
|
||||
newReal(matrix.f)});
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newArray(QPDFMatrix const& matrix)
|
||||
{
|
||||
std::vector<QPDFObjectHandle> items;
|
||||
items.push_back(newReal(matrix.a));
|
||||
items.push_back(newReal(matrix.b));
|
||||
items.push_back(newReal(matrix.c));
|
||||
items.push_back(newReal(matrix.d));
|
||||
items.push_back(newReal(matrix.e));
|
||||
items.push_back(newReal(matrix.f));
|
||||
return newArray(items);
|
||||
return newArray(
|
||||
{newReal(matrix.a),
|
||||
newReal(matrix.b),
|
||||
newReal(matrix.c),
|
||||
newReal(matrix.d),
|
||||
newReal(matrix.e),
|
||||
newReal(matrix.f)});
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
|
@ -1995,7 +1987,7 @@ QPDFObjectHandle::newDictionary()
|
|||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newDictionary(std::map<std::string, QPDFObjectHandle> const& items)
|
||||
{
|
||||
return QPDFObjectHandle(QPDF_Dictionary::create(items));
|
||||
return {QPDF_Dictionary::create(items)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
|
@ -2060,7 +2052,7 @@ QPDFObjectHandle::shallowCopy()
|
|||
if (!dereference()) {
|
||||
throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
|
||||
}
|
||||
return QPDFObjectHandle(obj->copy());
|
||||
return {obj->copy()};
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
|
@ -2069,7 +2061,7 @@ QPDFObjectHandle::unsafeShallowCopy()
|
|||
if (!dereference()) {
|
||||
throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
|
||||
}
|
||||
return QPDFObjectHandle(obj->copy(true));
|
||||
return {obj->copy(true)};
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2471,13 +2463,13 @@ QPDFObjectHandle::QPDFDictItems::iterator::Members::Members(QPDFObjectHandle& oh
|
|||
QPDFObjectHandle::QPDFDictItems::iterator
|
||||
QPDFObjectHandle::QPDFDictItems::begin()
|
||||
{
|
||||
return iterator(oh, true);
|
||||
return {oh, true};
|
||||
}
|
||||
|
||||
QPDFObjectHandle::QPDFDictItems::iterator
|
||||
QPDFObjectHandle::QPDFDictItems::end()
|
||||
{
|
||||
return iterator(oh, false);
|
||||
return {oh, false};
|
||||
}
|
||||
|
||||
QPDFObjectHandle::QPDFArrayItems::QPDFArrayItems(QPDFObjectHandle const& oh) :
|
||||
|
@ -2551,13 +2543,13 @@ QPDFObjectHandle::QPDFArrayItems::iterator::Members::Members(QPDFObjectHandle& o
|
|||
QPDFObjectHandle::QPDFArrayItems::iterator
|
||||
QPDFObjectHandle::QPDFArrayItems::begin()
|
||||
{
|
||||
return iterator(oh, true);
|
||||
return {oh, true};
|
||||
}
|
||||
|
||||
QPDFObjectHandle::QPDFArrayItems::iterator
|
||||
QPDFObjectHandle::QPDFArrayItems::end()
|
||||
{
|
||||
return iterator(oh, false);
|
||||
return {oh, false};
|
||||
}
|
||||
|
||||
QPDFObjGen
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <qpdf/QPDFObjectHelper.hh>
|
||||
|
||||
QPDFObjectHelper::~QPDFObjectHelper()
|
||||
QPDFObjectHelper::~QPDFObjectHelper() // NOLINT (modernize-use-equals-default)
|
||||
{
|
||||
// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ QPDFPageDocumentHelper::getAllPages()
|
|||
{
|
||||
std::vector<QPDFPageObjectHelper> pages;
|
||||
for (auto const& iter: this->qpdf.getAllPages()) {
|
||||
pages.push_back(QPDFPageObjectHelper(iter));
|
||||
pages.emplace_back(iter);
|
||||
}
|
||||
return pages;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace
|
|||
from_page(from_page)
|
||||
{
|
||||
}
|
||||
virtual ~ContentProvider() = default;
|
||||
virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline);
|
||||
~ContentProvider() override = default;
|
||||
void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
|
||||
|
||||
private:
|
||||
QPDFObjectHandle from_page;
|
||||
|
@ -44,8 +44,8 @@ namespace
|
|||
{
|
||||
public:
|
||||
InlineImageTracker(QPDF*, size_t min_size, QPDFObjectHandle resources);
|
||||
virtual ~InlineImageTracker() = default;
|
||||
virtual void handleToken(QPDFTokenizer::Token const&);
|
||||
~InlineImageTracker() override = default;
|
||||
void handleToken(QPDFTokenizer::Token const&) override;
|
||||
QPDFObjectHandle convertIIDict(QPDFObjectHandle odict);
|
||||
|
||||
QPDF* qpdf;
|
||||
|
@ -53,19 +53,16 @@ namespace
|
|||
QPDFObjectHandle resources;
|
||||
std::string dict_str;
|
||||
std::string bi_str;
|
||||
int min_suffix;
|
||||
bool any_images;
|
||||
enum { st_top, st_bi } state;
|
||||
int min_suffix{1};
|
||||
bool any_images{false};
|
||||
enum { st_top, st_bi } state{st_top};
|
||||
};
|
||||
} // namespace
|
||||
|
||||
InlineImageTracker::InlineImageTracker(QPDF* qpdf, size_t min_size, QPDFObjectHandle resources) :
|
||||
qpdf(qpdf),
|
||||
min_size(min_size),
|
||||
resources(resources),
|
||||
min_suffix(1),
|
||||
any_images(false),
|
||||
state(st_top)
|
||||
resources(resources)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -451,7 +448,7 @@ QPDFPageObjectHelper::getAnnotations(std::string const& only_subtype)
|
|||
for (int i = 0; i < nannots; ++i) {
|
||||
QPDFObjectHandle annot = annots.getArrayItem(i);
|
||||
if (annot.isDictionaryOfType("", only_subtype)) {
|
||||
result.push_back(QPDFAnnotationObjectHelper(annot));
|
||||
result.emplace_back(annot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -662,7 +659,7 @@ QPDFPageObjectHelper::shallowCopyPage()
|
|||
QPDF& qpdf =
|
||||
this->oh.getQPDF("QPDFPageObjectHelper::shallowCopyPage called with a direct object");
|
||||
QPDFObjectHandle new_page = this->oh.shallowCopy();
|
||||
return QPDFPageObjectHelper(qpdf.makeIndirectObject(new_page));
|
||||
return {qpdf.makeIndirectObject(new_page)};
|
||||
}
|
||||
|
||||
QPDFObjectHandle::Matrix
|
||||
|
@ -758,7 +755,7 @@ QPDFPageObjectHelper::getMatrixForFormXObjectPlacement(
|
|||
QPDFObjectHandle fdict = fo.getDict();
|
||||
QPDFObjectHandle bbox_obj = fdict.getKey("/BBox");
|
||||
if (!bbox_obj.isRectangle()) {
|
||||
return QPDFMatrix();
|
||||
return {};
|
||||
}
|
||||
|
||||
QPDFMatrix wmatrix; // work matrix
|
||||
|
@ -793,7 +790,7 @@ QPDFPageObjectHelper::getMatrixForFormXObjectPlacement(
|
|||
// Calculate a scale factor, if needed. Shrink or expand if needed and allowed.
|
||||
if ((T.urx == T.llx) || (T.ury == T.lly)) {
|
||||
// avoid division by zero
|
||||
return QPDFMatrix();
|
||||
return {};
|
||||
}
|
||||
double rect_w = rect.urx - rect.llx;
|
||||
double rect_h = rect.ury - rect.lly;
|
||||
|
|
|
@ -55,7 +55,7 @@ QPDFParser::parse(bool& empty, bool content_stream)
|
|||
bool set_offset = false;
|
||||
|
||||
std::vector<StackFrame> stack;
|
||||
stack.push_back(StackFrame(input));
|
||||
stack.emplace_back(input);
|
||||
std::vector<parser_state_e> state_stack;
|
||||
state_stack.push_back(st_top);
|
||||
qpdf_offset_t offset;
|
||||
|
@ -141,7 +141,7 @@ QPDFParser::parse(bool& empty, bool content_stream)
|
|||
(tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array
|
||||
: st_dictionary);
|
||||
b_contents = false;
|
||||
stack.push_back(StackFrame(input));
|
||||
stack.emplace_back(input);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
|
||||
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<voi
|
|||
{
|
||||
}
|
||||
|
||||
QPDFWriter::FunctionProgressReporter::~FunctionProgressReporter()
|
||||
QPDFWriter::FunctionProgressReporter::~FunctionProgressReporter() // NOLINT
|
||||
// (modernize-use-equals-default)
|
||||
{
|
||||
// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <qpdf/QIntC.hh>
|
||||
#include <qpdf/QPDFExc.hh>
|
||||
|
||||
QPDFXRefEntry::QPDFXRefEntry()
|
||||
QPDFXRefEntry::QPDFXRefEntry() // NOLINT (modernize-use-equals-default)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ QPDF_Array::getAsVector() const
|
|||
v.reserve(size_t(size()));
|
||||
for (auto const& item: sp_elements) {
|
||||
v.resize(size_t(item.first), null_oh);
|
||||
v.push_back(item.second);
|
||||
v.emplace_back(item.second);
|
||||
}
|
||||
v.resize(size_t(size()), null_oh);
|
||||
return v;
|
||||
|
|
|
@ -164,7 +164,7 @@ pad_or_truncate_password_V4(std::string const& password)
|
|||
{
|
||||
char k1[key_bytes];
|
||||
pad_or_truncate_password_V4(password, k1);
|
||||
return std::string(k1, key_bytes);
|
||||
return {k1, key_bytes};
|
||||
}
|
||||
|
||||
static std::string
|
||||
|
@ -235,7 +235,7 @@ process_with_aes(
|
|||
} else {
|
||||
outlength = std::min(outlength, bufp->getSize());
|
||||
}
|
||||
return std::string(reinterpret_cast<char*>(bufp->getBuffer()), outlength);
|
||||
return {reinterpret_cast<char*>(bufp->getBuffer()), outlength};
|
||||
}
|
||||
|
||||
static std::string
|
||||
|
@ -355,7 +355,7 @@ QPDF::compute_data_key(
|
|||
md5.encodeDataIncrementally(result.c_str(), result.length());
|
||||
MD5::Digest digest;
|
||||
md5.digest(digest);
|
||||
return std::string(reinterpret_cast<char*>(digest), std::min(result.length(), toS(16)));
|
||||
return {reinterpret_cast<char*>(digest), std::min(result.length(), toS(16))};
|
||||
}
|
||||
|
||||
std::string
|
||||
|
@ -401,7 +401,7 @@ QPDF::compute_encryption_key_from_password(std::string const& password, Encrypti
|
|||
MD5::Digest digest;
|
||||
int key_len = std::min(toI(sizeof(digest)), data.getLengthBytes());
|
||||
iterate_md5_digest(md5, digest, ((data.getR() >= 3) ? 50 : 0), key_len);
|
||||
return std::string(reinterpret_cast<char*>(digest), toS(key_len));
|
||||
return {reinterpret_cast<char*>(digest), toS(key_len)};
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -448,7 +448,7 @@ compute_O_value(
|
|||
data.getLengthBytes(),
|
||||
(data.getR() >= 3) ? 20 : 1,
|
||||
false);
|
||||
return std::string(upass, key_bytes);
|
||||
return {upass, key_bytes};
|
||||
}
|
||||
|
||||
static std::string
|
||||
|
@ -467,7 +467,7 @@ compute_U_value_R2(std::string const& user_password, QPDF::EncryptionData const&
|
|||
data.getLengthBytes(),
|
||||
1,
|
||||
false);
|
||||
return std::string(udata, key_bytes);
|
||||
return {udata, key_bytes};
|
||||
}
|
||||
|
||||
static std::string
|
||||
|
@ -496,7 +496,7 @@ compute_U_value_R3(std::string const& user_password, QPDF::EncryptionData const&
|
|||
for (unsigned int i = sizeof(MD5::Digest); i < key_bytes; ++i) {
|
||||
result[i] = static_cast<char>((i * i) % 0xff);
|
||||
}
|
||||
return std::string(result, key_bytes);
|
||||
return {result, key_bytes};
|
||||
}
|
||||
|
||||
static std::string
|
||||
|
|
|
@ -238,7 +238,7 @@ class QPDF::JSONReactor: public JSON::Reactor
|
|||
}
|
||||
}
|
||||
}
|
||||
virtual ~JSONReactor() = default;
|
||||
~JSONReactor() override = default;
|
||||
void dictionaryStart() override;
|
||||
void arrayStart() override;
|
||||
void containerEnd(JSON const& value) override;
|
||||
|
|
|
@ -1367,7 +1367,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
|
|||
for (auto& oh: m->part6) {
|
||||
int obj = oh.getObjectID();
|
||||
obj_to_index[obj] = toI(shared.size());
|
||||
shared.push_back(CHSharedObjectEntry(obj));
|
||||
shared.emplace_back(obj);
|
||||
}
|
||||
QTC::TC("qpdf", "QPDF lin part 8 empty", m->part8.empty() ? 1 : 0);
|
||||
if (!m->part8.empty()) {
|
||||
|
@ -1375,7 +1375,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
|
|||
for (auto& oh: m->part8) {
|
||||
int obj = oh.getObjectID();
|
||||
obj_to_index[obj] = toI(shared.size());
|
||||
shared.push_back(CHSharedObjectEntry(obj));
|
||||
shared.emplace_back(obj);
|
||||
}
|
||||
}
|
||||
if (static_cast<size_t>(m->c_shared_object_data.nshared_total) !=
|
||||
|
@ -1585,7 +1585,7 @@ QPDF::calculateHSharedObject(
|
|||
int length = outputLengthNextN(csoe.at(i).object, 1, lengths, obj_renumber);
|
||||
min_length = std::min(min_length, length);
|
||||
max_length = std::max(max_length, length);
|
||||
soe.push_back(HSharedObjectEntry());
|
||||
soe.emplace_back();
|
||||
soe.at(i).delta_group_length = length;
|
||||
}
|
||||
if (soe.size() != toS(cso.nshared_total)) {
|
||||
|
|
|
@ -903,14 +903,14 @@ QUtil::get_current_qpdf_time()
|
|||
// Don't know how to get timezone on this platform
|
||||
int tzoff = 0;
|
||||
# endif
|
||||
return QPDFTime(
|
||||
return {
|
||||
static_cast<int>(ltime.tm_year + 1900),
|
||||
static_cast<int>(ltime.tm_mon + 1),
|
||||
static_cast<int>(ltime.tm_mday),
|
||||
static_cast<int>(ltime.tm_hour),
|
||||
static_cast<int>(ltime.tm_min),
|
||||
static_cast<int>(ltime.tm_sec),
|
||||
tzoff);
|
||||
tzoff};
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1082,13 +1082,12 @@ namespace
|
|||
|
||||
private:
|
||||
RandomDataProvider* default_provider;
|
||||
RandomDataProvider* current_provider;
|
||||
RandomDataProvider* current_provider{nullptr};
|
||||
};
|
||||
} // namespace
|
||||
|
||||
RandomDataProviderProvider::RandomDataProviderProvider() :
|
||||
default_provider(CryptoRandomDataProvider::getInstance()),
|
||||
current_provider(nullptr)
|
||||
default_provider(CryptoRandomDataProvider::getInstance())
|
||||
{
|
||||
this->current_provider = default_provider;
|
||||
}
|
||||
|
@ -1246,7 +1245,7 @@ QUtil::read_lines_from_file(
|
|||
char c;
|
||||
while (next_char(c)) {
|
||||
if (buf == nullptr) {
|
||||
lines.push_back("");
|
||||
lines.emplace_back("");
|
||||
buf = &(lines.back());
|
||||
buf->reserve(80);
|
||||
}
|
||||
|
|
|
@ -813,13 +813,13 @@ trap_oh_errors(qpdf_data qpdf, std::function<RET()> fallback, std::function<RET(
|
|||
if (!qpdf->silence_errors) {
|
||||
QTC::TC("qpdf", "qpdf-c warn about oh error", qpdf->oh_error_occurred ? 0 : 1);
|
||||
if (!qpdf->oh_error_occurred) {
|
||||
qpdf->warnings.push_back(QPDFExc(
|
||||
qpdf->warnings.emplace_back(
|
||||
qpdf_e_internal,
|
||||
qpdf->qpdf->getFilename(),
|
||||
"",
|
||||
0,
|
||||
"C API function caught an exception that it isn't returning; please point the "
|
||||
"application developer to ERROR HANDLING in qpdf-c.h"));
|
||||
"application developer to ERROR HANDLING in qpdf-c.h");
|
||||
qpdf->oh_error_occurred = true;
|
||||
}
|
||||
*QPDFLogger::defaultLogger()->getError() << qpdf->error->what() << "\n";
|
||||
|
|
|
@ -10,9 +10,9 @@ class Pl_LZWDecoder: public Pipeline
|
|||
{
|
||||
public:
|
||||
Pl_LZWDecoder(char const* identifier, Pipeline* next, bool early_code_change);
|
||||
virtual ~Pl_LZWDecoder() = default;
|
||||
virtual void write(unsigned char const* buf, size_t len);
|
||||
virtual void finish();
|
||||
~Pl_LZWDecoder() override = default;
|
||||
void write(unsigned char const* buf, size_t len) override;
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
void sendNextCode();
|
||||
|
|
|
@ -14,9 +14,9 @@ class Pl_MD5: public Pipeline
|
|||
{
|
||||
public:
|
||||
Pl_MD5(char const* identifier, Pipeline* next);
|
||||
virtual ~Pl_MD5() = default;
|
||||
virtual void write(unsigned char const*, size_t);
|
||||
virtual void finish();
|
||||
~Pl_MD5() override = default;
|
||||
void write(unsigned char const*, size_t) override;
|
||||
void finish() override;
|
||||
std::string getHexDigest();
|
||||
// Enable/disable. Disabling the pipeline causes it to become a pass-through. This makes it
|
||||
// possible to stick an MD5 pipeline in a pipeline when it may or may not be required. Disabling
|
||||
|
|
|
@ -145,19 +145,12 @@ class QPDFArgParser
|
|||
private:
|
||||
struct OptionEntry
|
||||
{
|
||||
OptionEntry() :
|
||||
parameter_needed(false),
|
||||
bare_arg_handler(nullptr),
|
||||
param_arg_handler(nullptr),
|
||||
invalid_choice_handler(nullptr)
|
||||
{
|
||||
}
|
||||
bool parameter_needed;
|
||||
bool parameter_needed{false};
|
||||
std::string parameter_name;
|
||||
std::set<std::string> choices;
|
||||
bare_arg_handler_t bare_arg_handler;
|
||||
param_arg_handler_t param_arg_handler;
|
||||
param_arg_handler_t invalid_choice_handler;
|
||||
bare_arg_handler_t bare_arg_handler{nullptr};
|
||||
param_arg_handler_t param_arg_handler{nullptr};
|
||||
param_arg_handler_t invalid_choice_handler{nullptr};
|
||||
};
|
||||
typedef std::map<std::string, OptionEntry> option_table_t;
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
class QPDF_Array: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Array() = default;
|
||||
~QPDF_Array() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(std::vector<QPDFObjectHandle> const& items);
|
||||
static std::shared_ptr<QPDFObject>
|
||||
create(std::vector<std::shared_ptr<QPDFObject>>&& items, bool sparse);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual void disconnect();
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
void disconnect() override;
|
||||
|
||||
int
|
||||
size() const noexcept
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
class QPDF_Bool: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Bool() = default;
|
||||
~QPDF_Bool() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(bool val);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
bool getVal() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
class QPDF_Destroyed: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Destroyed() = default;
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
~QPDF_Destroyed() override = default;
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
static std::shared_ptr<QPDFValue> getInstance();
|
||||
|
||||
private:
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
class QPDF_Dictionary: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Dictionary() = default;
|
||||
~QPDF_Dictionary() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(std::map<std::string, QPDFObjectHandle> const& items);
|
||||
static std::shared_ptr<QPDFObject> create(std::map<std::string, QPDFObjectHandle>&& items);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual void disconnect();
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
void disconnect() override;
|
||||
|
||||
// hasKey() and getKeys() treat keys with null values as if they aren't there. getKey() returns
|
||||
// null for the value of a non-existent key. This is as per the PDF spec.
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
class QPDF_InlineImage: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_InlineImage() = default;
|
||||
~QPDF_InlineImage() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(std::string const& val);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual std::string
|
||||
getStringValue() const
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
std::string
|
||||
getStringValue() const override
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
class QPDF_Integer: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Integer() = default;
|
||||
~QPDF_Integer() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(long long value);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
long long getVal() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
class QPDF_Name: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Name() = default;
|
||||
~QPDF_Name() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(std::string const& name);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
|
||||
// Put # into strings with characters unsuitable for name token
|
||||
static std::string normalizeName(std::string const& name);
|
||||
virtual std::string
|
||||
getStringValue() const
|
||||
std::string
|
||||
getStringValue() const override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class QPDF_Null: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Null() = default;
|
||||
~QPDF_Null() override = default;
|
||||
static std::shared_ptr<QPDFObject> create();
|
||||
static std::shared_ptr<QPDFObject> create(
|
||||
std::shared_ptr<QPDFObject> parent,
|
||||
|
@ -16,9 +16,9 @@ class QPDF_Null: public QPDFValue
|
|||
std::shared_ptr<QPDFValue> parent,
|
||||
std::string_view const& static_descr,
|
||||
std::string var_descr);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
|
||||
private:
|
||||
QPDF_Null();
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
class QPDF_Operator: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Operator() = default;
|
||||
~QPDF_Operator() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(std::string const& val);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual std::string
|
||||
getStringValue() const
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
std::string
|
||||
getStringValue() const override
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
class QPDF_Real: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Real() = default;
|
||||
~QPDF_Real() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(std::string const& val);
|
||||
static std::shared_ptr<QPDFObject>
|
||||
create(double value, int decimal_places, bool trim_trailing_zeroes);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual std::string
|
||||
getStringValue() const
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
std::string
|
||||
getStringValue() const override
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
class QPDF_Reserved: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Reserved() = default;
|
||||
~QPDF_Reserved() override = default;
|
||||
static std::shared_ptr<QPDFObject> create();
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
|
||||
private:
|
||||
QPDF_Reserved();
|
||||
|
|
|
@ -16,19 +16,19 @@ class QPDF;
|
|||
class QPDF_Stream: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Stream() = default;
|
||||
~QPDF_Stream() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(
|
||||
QPDF*,
|
||||
QPDFObjGen const& og,
|
||||
QPDFObjectHandle stream_dict,
|
||||
qpdf_offset_t offset,
|
||||
size_t length);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual void setDescription(
|
||||
QPDF*, std::shared_ptr<QPDFValue::Description>& description, qpdf_offset_t offset);
|
||||
virtual void disconnect();
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
void setDescription(
|
||||
QPDF*, std::shared_ptr<QPDFValue::Description>& description, qpdf_offset_t offset) override;
|
||||
void disconnect() override;
|
||||
QPDFObjectHandle getDict() const;
|
||||
bool isDataModified() const;
|
||||
void setFilterOnWrite(bool);
|
||||
|
|
|
@ -10,16 +10,16 @@ class QPDF_String: public QPDFValue
|
|||
friend class QPDFWriter;
|
||||
|
||||
public:
|
||||
virtual ~QPDF_String() = default;
|
||||
~QPDF_String() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(std::string const& val);
|
||||
static std::shared_ptr<QPDFObject> create_utf16(std::string const& utf8_val);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
std::string unparse(bool force_binary);
|
||||
virtual JSON getJSON(int json_version);
|
||||
JSON getJSON(int json_version) override;
|
||||
std::string getUTF8Val() const;
|
||||
virtual std::string
|
||||
getStringValue() const
|
||||
std::string
|
||||
getStringValue() const override
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
class QPDF_Unresolved: public QPDFValue
|
||||
{
|
||||
public:
|
||||
virtual ~QPDF_Unresolved() = default;
|
||||
~QPDF_Unresolved() override = default;
|
||||
static std::shared_ptr<QPDFObject> create(QPDF* qpdf, QPDFObjGen const& og);
|
||||
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
std::shared_ptr<QPDFObject> copy(bool shallow = false) override;
|
||||
std::string unparse() override;
|
||||
JSON getJSON(int json_version) override;
|
||||
|
||||
private:
|
||||
QPDF_Unresolved(QPDF* qpdf, QPDFObjGen const& og);
|
||||
|
|
|
@ -7,7 +7,7 @@ class ResourceFinder: public QPDFObjectHandle::ParserCallbacks
|
|||
{
|
||||
public:
|
||||
ResourceFinder();
|
||||
virtual ~ResourceFinder() = default;
|
||||
~ResourceFinder() override = default;
|
||||
void handleObject(QPDFObjectHandle, size_t, size_t) override;
|
||||
void handleEOF() override;
|
||||
std::set<std::string> const& getNames() const;
|
||||
|
|
|
@ -9,7 +9,7 @@ class SF_ASCII85Decode: public QPDFStreamFilter
|
|||
{
|
||||
public:
|
||||
SF_ASCII85Decode() = default;
|
||||
virtual ~SF_ASCII85Decode() = default;
|
||||
~SF_ASCII85Decode() override = default;
|
||||
|
||||
Pipeline*
|
||||
getDecodePipeline(Pipeline* next) override
|
||||
|
|
|
@ -9,7 +9,7 @@ class SF_ASCIIHexDecode: public QPDFStreamFilter
|
|||
{
|
||||
public:
|
||||
SF_ASCIIHexDecode() = default;
|
||||
virtual ~SF_ASCIIHexDecode() = default;
|
||||
~SF_ASCIIHexDecode() override = default;
|
||||
|
||||
Pipeline*
|
||||
getDecodePipeline(Pipeline* next) override
|
||||
|
|
|
@ -9,7 +9,7 @@ class SF_DCTDecode: public QPDFStreamFilter
|
|||
{
|
||||
public:
|
||||
SF_DCTDecode() = default;
|
||||
virtual ~SF_DCTDecode() = default;
|
||||
~SF_DCTDecode() override = default;
|
||||
|
||||
Pipeline*
|
||||
getDecodePipeline(Pipeline* next) override
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user