mirror of
https://github.com/qpdf/qpdf.git
synced 2024-06-15 16:42:19 +00:00
commit
fd17c8e3fe
|
@ -5,8 +5,8 @@
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
// This program demonstrates extraction of bookmarks using the qpdf
|
// This program demonstrates extraction of bookmarks using the qpdf
|
||||||
// outlines API. Note that all the information shown by this program
|
// outlines API. Note that all the information shown by this program
|
||||||
|
|
|
@ -5,14 +5,12 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <qpdf/Pl_StdioFile.hh>
|
#include <qpdf/Pl_StdioFile.hh>
|
||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
#include <qpdf/QPDFObjectHandle.hh>
|
#include <qpdf/QPDFObjectHandle.hh>
|
||||||
#include <qpdf/QPDFPageDocumentHelper.hh>
|
#include <qpdf/QPDFPageDocumentHelper.hh>
|
||||||
#include <qpdf/QPDFPageObjectHelper.hh>
|
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
static char const* whoami = nullptr;
|
static char const* whoami = nullptr;
|
||||||
|
@ -32,9 +30,9 @@ class StringCounter: public QPDFObjectHandle::TokenFilter
|
||||||
count(0)
|
count(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~StringCounter() = default;
|
~StringCounter() override = default;
|
||||||
virtual void handleToken(QPDFTokenizer::Token const&);
|
void handleToken(QPDFTokenizer::Token const&) override;
|
||||||
virtual void handleEOF();
|
void handleEOF() override;
|
||||||
int getCount() const;
|
int getCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -12,13 +12,11 @@
|
||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
#include <qpdf/QPDFObjectHandle.hh>
|
#include <qpdf/QPDFObjectHandle.hh>
|
||||||
#include <qpdf/QPDFPageDocumentHelper.hh>
|
#include <qpdf/QPDFPageDocumentHelper.hh>
|
||||||
#include <qpdf/QPDFPageObjectHelper.hh>
|
|
||||||
#include <qpdf/QPDFWriter.hh>
|
#include <qpdf/QPDFWriter.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
static char const* whoami = nullptr;
|
static char const* whoami = nullptr;
|
||||||
|
|
||||||
|
@ -28,8 +26,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ImageProvider(std::string const& color_space, std::string const& filter);
|
ImageProvider(std::string const& color_space, std::string const& filter);
|
||||||
virtual ~ImageProvider() = default;
|
~ImageProvider() override = default;
|
||||||
virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline);
|
void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
|
||||||
size_t getWidth() const;
|
size_t getWidth() const;
|
||||||
size_t getHeight() const;
|
size_t getHeight() const;
|
||||||
|
|
||||||
|
@ -168,7 +166,7 @@ add_page(
|
||||||
// mode. Since we are not specifying, QPDFWriter will compress
|
// mode. Since we are not specifying, QPDFWriter will compress
|
||||||
// with /FlateDecode if we don't provide any other form of
|
// with /FlateDecode if we don't provide any other form of
|
||||||
// compression.
|
// compression.
|
||||||
ImageProvider* p = new ImageProvider(color_space, filter);
|
auto* p = new ImageProvider(color_space, filter);
|
||||||
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
|
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
|
||||||
size_t width = p->getWidth();
|
size_t width = p->getWidth();
|
||||||
size_t height = p->getHeight();
|
size_t height = p->getHeight();
|
||||||
|
@ -288,7 +286,7 @@ check(
|
||||||
if (!this_errors) {
|
if (!this_errors) {
|
||||||
// Check image data
|
// Check image data
|
||||||
auto actual_data = image.getStreamData(qpdf_dl_all);
|
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);
|
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
|
||||||
Pl_Buffer b_p("get image data");
|
Pl_Buffer b_p("get image data");
|
||||||
provider->provideStreamData(QPDFObjGen(), &b_p);
|
provider->provideStreamData(QPDFObjGen(), &b_p);
|
||||||
|
|
|
@ -48,9 +48,9 @@ class Pl_XOR: public Pipeline
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Pl_XOR(char const* identifier, Pipeline* next, unsigned char key);
|
Pl_XOR(char const* identifier, Pipeline* next, unsigned char key);
|
||||||
virtual ~Pl_XOR() = default;
|
~Pl_XOR() override = default;
|
||||||
virtual void write(unsigned char const* data, size_t len) override;
|
void write(unsigned char const* data, size_t len) override;
|
||||||
virtual void finish() override;
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned char key;
|
unsigned char key;
|
||||||
|
@ -91,10 +91,10 @@ class SF_XORDecode: public QPDFStreamFilter
|
||||||
// filter, which just means QPDF assumes that it should not
|
// filter, which just means QPDF assumes that it should not
|
||||||
// "uncompress" the stream by default.
|
// "uncompress" the stream by default.
|
||||||
public:
|
public:
|
||||||
virtual ~SF_XORDecode() = default;
|
~SF_XORDecode() override = default;
|
||||||
virtual bool setDecodeParms(QPDFObjectHandle decode_parms) override;
|
bool setDecodeParms(QPDFObjectHandle decode_parms) override;
|
||||||
virtual Pipeline* getDecodePipeline(Pipeline* next) override;
|
Pipeline* getDecodePipeline(Pipeline* next) override;
|
||||||
virtual bool isSpecializedCompression() override;
|
bool isSpecializedCompression() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned char key;
|
unsigned char key;
|
||||||
|
@ -199,8 +199,8 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StreamReplacer(QPDF* pdf);
|
StreamReplacer(QPDF* pdf);
|
||||||
virtual ~StreamReplacer() = default;
|
~StreamReplacer() override = default;
|
||||||
virtual void
|
void
|
||||||
provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
|
provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
|
||||||
|
|
||||||
void registerStream(
|
void registerStream(
|
||||||
|
@ -409,7 +409,7 @@ process(
|
||||||
// Create a single StreamReplacer instance. The interface requires
|
// Create a single StreamReplacer instance. The interface requires
|
||||||
// a std::shared_ptr in various places, so allocate a StreamReplacer
|
// a std::shared_ptr in various places, so allocate a StreamReplacer
|
||||||
// and stash it in a std::shared_ptr.
|
// 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);
|
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer);
|
||||||
|
|
||||||
for (auto& o: qpdf.getAllObjects()) {
|
for (auto& o: qpdf.getAllObjects()) {
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
#include <qpdf/QPDFWriter.hh>
|
#include <qpdf/QPDFWriter.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
static char const* whoami = nullptr;
|
static char const* whoami = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,11 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
#include <qpdf/QPDFObjectHandle.hh>
|
#include <qpdf/QPDFObjectHandle.hh>
|
||||||
#include <qpdf/QPDFPageDocumentHelper.hh>
|
#include <qpdf/QPDFPageDocumentHelper.hh>
|
||||||
#include <qpdf/QPDFPageObjectHelper.hh>
|
|
||||||
#include <qpdf/QPDFWriter.hh>
|
#include <qpdf/QPDFWriter.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
|
@ -35,8 +33,8 @@ usage()
|
||||||
class StringReverser: public QPDFObjectHandle::TokenFilter
|
class StringReverser: public QPDFObjectHandle::TokenFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~StringReverser() = default;
|
~StringReverser() override = default;
|
||||||
virtual void handleToken(QPDFTokenizer::Token const&);
|
void handleToken(QPDFTokenizer::Token const&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -68,9 +66,9 @@ StringReverser::handleToken(QPDFTokenizer::Token const& token)
|
||||||
class ColorToGray: public QPDFObjectHandle::TokenFilter
|
class ColorToGray: public QPDFObjectHandle::TokenFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ColorToGray() = default;
|
~ColorToGray() override = default;
|
||||||
virtual void handleToken(QPDFTokenizer::Token const&);
|
void handleToken(QPDFTokenizer::Token const&) override;
|
||||||
virtual void handleEOF();
|
void handleEOF() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isNumeric(QPDFTokenizer::token_type_e);
|
bool isNumeric(QPDFTokenizer::token_type_e);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include <qpdf/QPDFWriter.hh>
|
#include <qpdf/QPDFWriter.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
static char const* whoami = nullptr;
|
static char const* whoami = nullptr;
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ usage()
|
||||||
class ImageInverter: public QPDFObjectHandle::StreamDataProvider
|
class ImageInverter: public QPDFObjectHandle::StreamDataProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ImageInverter() = default;
|
~ImageInverter() override = default;
|
||||||
virtual void
|
void
|
||||||
provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
|
provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
|
||||||
|
|
||||||
void registerImage(
|
void registerImage(
|
||||||
|
@ -124,7 +124,7 @@ main(int argc, char* argv[])
|
||||||
QPDF qpdf;
|
QPDF qpdf;
|
||||||
qpdf.processFile(infilename, password);
|
qpdf.processFile(infilename, password);
|
||||||
|
|
||||||
ImageInverter* inv = new ImageInverter;
|
auto* inv = new ImageInverter;
|
||||||
auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(inv);
|
auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(inv);
|
||||||
|
|
||||||
// For each page...
|
// For each page...
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
static char const* version = "1.1";
|
static char const* version = "1.1";
|
||||||
static char const* whoami = nullptr;
|
static char const* whoami = nullptr;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <qpdf/QPDFNumberTreeObjectHelper.hh>
|
#include <qpdf/QPDFNumberTreeObjectHelper.hh>
|
||||||
#include <qpdf/QPDFWriter.hh>
|
#include <qpdf/QPDFWriter.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <cstring>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
static char const* whoami = nullptr;
|
static char const* whoami = nullptr;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#include <qpdf/QPDFWriter.hh>
|
#include <qpdf/QPDFWriter.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
// This program demonstrates use of form XObjects to overlay a page
|
// This program demonstrates use of form XObjects to overlay a page
|
||||||
// from one file onto all pages of another file. The qpdf program's
|
// from one file onto all pages of another file. The qpdf program's
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
|
@ -23,10 +22,10 @@ usage()
|
||||||
class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks
|
class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ParserCallbacks() = default;
|
~ParserCallbacks() override = default;
|
||||||
virtual void contentSize(size_t);
|
void contentSize(size_t) override;
|
||||||
virtual void handleObject(QPDFObjectHandle, size_t offset, size_t length);
|
void handleObject(QPDFObjectHandle, size_t offset, size_t length) override;
|
||||||
virtual void handleEOF();
|
void handleEOF() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
#include <qpdf/QPDFWriter.hh>
|
#include <qpdf/QPDFWriter.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <cstdlib>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
static char const* whoami = nullptr;
|
static char const* whoami = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
static bool static_id = false;
|
static bool static_id = false;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include <qpdf/QIntC.hh>
|
|
||||||
#include <qpdf/QPDFJob.hh>
|
#include <qpdf/QPDFJob.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// This program is a simple demonstration of different ways to use the
|
// This program is a simple demonstration of different ways to use the
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#include <qpdf/Constants.h>
|
|
||||||
#include <qpdf/qpdfjob-c.h>
|
#include <qpdf/qpdfjob-c.h>
|
||||||
#include <qpdf/qpdflogger-c.h>
|
#include <qpdf/qpdflogger-c.h>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// This example demonstrates how we can use the QPDFJob createQPDF and writeQPDF
|
// 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
|
// The example is a full copy of the qpdf program modified to allways remove all
|
||||||
// annotations from the final output.
|
// annotations from the final output.
|
||||||
|
|
||||||
static char const* whoami = 0;
|
static char const* whoami = nullptr;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usageExit(std::string const& msg)
|
usageExit(std::string const& msg)
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
|
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~DiscardContents() = default;
|
~DiscardContents() override = default;
|
||||||
virtual void
|
void
|
||||||
handleObject(QPDFObjectHandle)
|
handleObject(QPDFObjectHandle) override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual void
|
void
|
||||||
handleEOF()
|
handleEOF() override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
|
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stddef.h>
|
#include <cstddef>
|
||||||
|
|
||||||
class Buffer
|
class Buffer
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <qpdf/Types.h>
|
#include <qpdf/Types.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// Remember to use QPDF_DLL_CLASS on anything derived from InputSource
|
// Remember to use QPDF_DLL_CLASS on anything derived from InputSource
|
||||||
|
|
|
@ -369,8 +369,8 @@ class JSON
|
||||||
JSON_value(vt_dictionary)
|
JSON_value(vt_dictionary)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~JSON_dictionary() = default;
|
~JSON_dictionary() override = default;
|
||||||
virtual void write(Pipeline*, size_t depth) const;
|
void write(Pipeline*, size_t depth) const override;
|
||||||
std::map<std::string, JSON> members;
|
std::map<std::string, JSON> members;
|
||||||
std::set<std::string> parsed_keys;
|
std::set<std::string> parsed_keys;
|
||||||
};
|
};
|
||||||
|
@ -380,15 +380,15 @@ class JSON
|
||||||
JSON_value(vt_array)
|
JSON_value(vt_array)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~JSON_array() = default;
|
~JSON_array() override = default;
|
||||||
virtual void write(Pipeline*, size_t depth) const;
|
void write(Pipeline*, size_t depth) const override;
|
||||||
std::vector<JSON> elements;
|
std::vector<JSON> elements;
|
||||||
};
|
};
|
||||||
struct JSON_string: public JSON_value
|
struct JSON_string: public JSON_value
|
||||||
{
|
{
|
||||||
JSON_string(std::string const& utf8);
|
JSON_string(std::string const& utf8);
|
||||||
virtual ~JSON_string() = default;
|
~JSON_string() override = default;
|
||||||
virtual void write(Pipeline*, size_t depth) const;
|
void write(Pipeline*, size_t depth) const override;
|
||||||
std::string utf8;
|
std::string utf8;
|
||||||
std::string encoded;
|
std::string encoded;
|
||||||
};
|
};
|
||||||
|
@ -397,15 +397,15 @@ class JSON
|
||||||
JSON_number(long long val);
|
JSON_number(long long val);
|
||||||
JSON_number(double val);
|
JSON_number(double val);
|
||||||
JSON_number(std::string const& val);
|
JSON_number(std::string const& val);
|
||||||
virtual ~JSON_number() = default;
|
~JSON_number() override = default;
|
||||||
virtual void write(Pipeline*, size_t depth) const;
|
void write(Pipeline*, size_t depth) const override;
|
||||||
std::string encoded;
|
std::string encoded;
|
||||||
};
|
};
|
||||||
struct JSON_bool: public JSON_value
|
struct JSON_bool: public JSON_value
|
||||||
{
|
{
|
||||||
JSON_bool(bool val);
|
JSON_bool(bool val);
|
||||||
virtual ~JSON_bool() = default;
|
~JSON_bool() override = default;
|
||||||
virtual void write(Pipeline*, size_t depth) const;
|
void write(Pipeline*, size_t depth) const override;
|
||||||
bool value;
|
bool value;
|
||||||
};
|
};
|
||||||
struct JSON_null: public JSON_value
|
struct JSON_null: public JSON_value
|
||||||
|
@ -414,14 +414,14 @@ class JSON
|
||||||
JSON_value(vt_null)
|
JSON_value(vt_null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~JSON_null() = default;
|
~JSON_null() override = default;
|
||||||
virtual void write(Pipeline*, size_t depth) const;
|
void write(Pipeline*, size_t depth) const override;
|
||||||
};
|
};
|
||||||
struct JSON_blob: public JSON_value
|
struct JSON_blob: public JSON_value
|
||||||
{
|
{
|
||||||
JSON_blob(std::function<void(Pipeline*)> fn);
|
JSON_blob(std::function<void(Pipeline*)> fn);
|
||||||
virtual ~JSON_blob() = default;
|
~JSON_blob() override = default;
|
||||||
virtual void write(Pipeline*, size_t depth) const;
|
void write(Pipeline*, size_t depth) const override;
|
||||||
std::function<void(Pipeline*)> fn;
|
std::function<void(Pipeline*)> fn;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,13 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
Pl_Buffer(char const* identifier, Pipeline* next = 0);
|
Pl_Buffer(char const* identifier, Pipeline* next = nullptr);
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual ~Pl_Buffer();
|
~Pl_Buffer() override;
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual void write(unsigned char const*, size_t);
|
void write(unsigned char const*, size_t) override;
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
|
|
||||||
// Each call to getBuffer() resets this object -- see notes above.
|
// Each call to getBuffer() resets this object -- see notes above.
|
||||||
// The caller is responsible for deleting the returned Buffer
|
// The caller is responsible for deleting the returned Buffer
|
||||||
|
|
|
@ -57,7 +57,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
|
||||||
JDIMENSION image_height,
|
JDIMENSION image_height,
|
||||||
int components,
|
int components,
|
||||||
J_COLOR_SPACE color_space,
|
J_COLOR_SPACE color_space,
|
||||||
CompressConfig* config_callback = 0);
|
CompressConfig* config_callback = nullptr);
|
||||||
|
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual ~Pl_DCT();
|
virtual ~Pl_DCT();
|
||||||
|
@ -91,7 +91,7 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
|
||||||
JDIMENSION image_height = 0,
|
JDIMENSION image_height = 0,
|
||||||
int components = 1,
|
int components = 1,
|
||||||
J_COLOR_SPACE color_space = JCS_GRAYSCALE,
|
J_COLOR_SPACE color_space = JCS_GRAYSCALE,
|
||||||
CompressConfig* config_callback = 0);
|
CompressConfig* config_callback = nullptr);
|
||||||
Members(Members const&) = delete;
|
Members(Members const&) = delete;
|
||||||
|
|
||||||
action_e action;
|
action_e action;
|
||||||
|
|
|
@ -51,7 +51,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
|
||||||
Pl_QPDFTokenizer(
|
Pl_QPDFTokenizer(
|
||||||
char const* identifier,
|
char const* identifier,
|
||||||
QPDFObjectHandle::TokenFilter* filter,
|
QPDFObjectHandle::TokenFilter* filter,
|
||||||
Pipeline* next = 0);
|
Pipeline* next = nullptr);
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual ~Pl_QPDFTokenizer();
|
virtual ~Pl_QPDFTokenizer();
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <qpdf/Pipeline.hh>
|
#include <qpdf/Pipeline.hh>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
|
|
||||||
//
|
//
|
||||||
// This pipeline is reusable.
|
// This pipeline is reusable.
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -83,7 +83,7 @@ class QPDF
|
||||||
// interpreted as a raw encryption key. See comments on
|
// interpreted as a raw encryption key. See comments on
|
||||||
// setPasswordIsHexKey for more information.
|
// setPasswordIsHexKey for more information.
|
||||||
QPDF_DLL
|
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
|
// 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.
|
// binary mode and must be seekable. It may be open read only.
|
||||||
|
@ -96,7 +96,7 @@ class QPDF
|
||||||
char const* description,
|
char const* description,
|
||||||
FILE* file,
|
FILE* file,
|
||||||
bool close_file,
|
bool close_file,
|
||||||
char const* password = 0);
|
char const* password = nullptr);
|
||||||
|
|
||||||
// Parse a PDF file loaded into a memory buffer. This works
|
// Parse a PDF file loaded into a memory buffer. This works
|
||||||
// exactly like processFile except that the PDF file is in memory
|
// exactly like processFile except that the PDF file is in memory
|
||||||
|
@ -107,14 +107,14 @@ class QPDF
|
||||||
char const* description,
|
char const* description,
|
||||||
char const* buf,
|
char const* buf,
|
||||||
size_t length,
|
size_t length,
|
||||||
char const* password = 0);
|
char const* password = nullptr);
|
||||||
|
|
||||||
// Parse a PDF file loaded from a custom InputSource. If you have
|
// Parse a PDF file loaded from a custom InputSource. If you have
|
||||||
// your own method of retrieving a PDF file, you can subclass
|
// your own method of retrieving a PDF file, you can subclass
|
||||||
// InputSource and use this method.
|
// InputSource and use this method.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void
|
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
|
// Create a PDF from an input source that contains JSON as written
|
||||||
// by writeJSON (or qpdf --json-output, version 2 or higher). The
|
// by writeJSON (or qpdf --json-output, version 2 or higher). The
|
||||||
|
|
|
@ -80,7 +80,7 @@ class QPDF_DLL_CLASS QPDFCryptoImpl
|
||||||
virtual void RC4_process(
|
virtual void RC4_process(
|
||||||
unsigned char const* in_data,
|
unsigned char const* in_data,
|
||||||
size_t len,
|
size_t len,
|
||||||
unsigned char* out_data = 0) = 0;
|
unsigned char* out_data = nullptr) = 0;
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual void RC4_finalize() = 0;
|
virtual void RC4_finalize() = 0;
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,7 @@ class QPDFJob
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
static void usage(std::string const& msg);
|
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(
|
static void parse_object_id(
|
||||||
std::string const& objspec, bool& trailer, int& obj, int& gen);
|
std::string const& objspec, bool& trailer, int& obj, int& gen);
|
||||||
void parseRotationParameter(std::string const&);
|
void parseRotationParameter(std::string const&);
|
||||||
|
|
|
@ -526,7 +526,7 @@ class QPDFObjectHandle
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void parsePageContents(ParserCallbacks* callbacks);
|
void parsePageContents(ParserCallbacks* callbacks);
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void filterPageContents(TokenFilter* filter, Pipeline* next = 0);
|
void filterPageContents(TokenFilter* filter, Pipeline* next = nullptr);
|
||||||
// See comments for QPDFPageObjectHelper::pipeContents.
|
// See comments for QPDFPageObjectHelper::pipeContents.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void pipePageContents(Pipeline* p);
|
void pipePageContents(Pipeline* p);
|
||||||
|
@ -538,7 +538,7 @@ class QPDFObjectHandle
|
||||||
// contents. This can be used to apply a TokenFilter to a form
|
// contents. This can be used to apply a TokenFilter to a form
|
||||||
// XObject, whose data is in the same format as a content stream.
|
// XObject, whose data is in the same format as a content stream.
|
||||||
QPDF_DLL
|
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
|
// Called on a stream to parse the stream as page contents. This
|
||||||
// can be used to parse a form XObject.
|
// can be used to parse a form XObject.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
|
|
|
@ -42,7 +42,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
|
||||||
{
|
{
|
||||||
// This must be cleared explicitly to avoid circular references
|
// This must be cleared explicitly to avoid circular references
|
||||||
// that prevent cleanup of pointer holders.
|
// 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
|
// All constructors are private. You can only create one of these
|
||||||
|
|
|
@ -320,12 +320,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
|
||||||
// examples/pdf-count-strings.cc for an example.
|
// examples/pdf-count-strings.cc for an example.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void
|
void
|
||||||
filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = 0);
|
filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
|
||||||
|
|
||||||
// Old name -- calls filterContents()
|
// Old name -- calls filterContents()
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void filterPageContents(
|
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
|
// Pipe a page's contents through the given pipeline. This method
|
||||||
// works whether the contents are a single stream or an array of
|
// works whether the contents are a single stream or an array of
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
|
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class QPDFTokenizer
|
class QPDFTokenizer
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -102,7 +102,7 @@ class QPDFWriter
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual ~FunctionProgressReporter();
|
virtual ~FunctionProgressReporter();
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual void reportProgress(int) override;
|
void reportProgress(int) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::function<void(int)> handler;
|
std::function<void(int)> handler;
|
||||||
|
@ -539,7 +539,7 @@ class QPDFWriter
|
||||||
friend class QPDFWriter;
|
friend class QPDFWriter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = 0) :
|
PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = nullptr) :
|
||||||
qw(qw),
|
qw(qw),
|
||||||
bp(bp)
|
bp(bp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <time.h>
|
#include <ctime>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class RandomDataProvider;
|
class RandomDataProvider;
|
||||||
|
@ -245,7 +245,7 @@ namespace QUtil
|
||||||
// Returns true iff the variable is defined. If `value' is
|
// Returns true iff the variable is defined. If `value' is
|
||||||
// non-null, initializes it with the value of the variable.
|
// non-null, initializes it with the value of the variable.
|
||||||
QPDF_DLL
|
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
|
QPDF_DLL
|
||||||
time_t get_current_time();
|
time_t get_current_time();
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#define RANDOMDATAPROVIDER_HH
|
#define RANDOMDATAPROVIDER_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
#include <qpdf/DLL.h>
|
||||||
#include <string.h> // for size_t
|
#include <cstring> // for size_t
|
||||||
|
|
||||||
class QPDF_DLL_CLASS RandomDataProvider
|
class QPDF_DLL_CLASS RandomDataProvider
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <cstring>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
BufferInputSource::BufferInputSource(
|
BufferInputSource::BufferInputSource(
|
||||||
std::string const& description, Buffer* buf, bool own_memory) :
|
std::string const& description, Buffer* buf, bool own_memory) :
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <qpdf/QPDFExc.hh>
|
#include <qpdf/QPDFExc.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
FileInputSource::FileInputSource() :
|
FileInputSource::FileInputSource() :
|
||||||
close_file(false),
|
close_file(false),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
void
|
void
|
||||||
InputSource::setLastOffset(qpdf_offset_t offset)
|
InputSource::setLastOffset(qpdf_offset_t offset)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <qpdf/qpdf-config.h>
|
#include <qpdf/qpdf-config.h>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
InsecureRandomDataProvider::InsecureRandomDataProvider() :
|
InsecureRandomDataProvider::InsecureRandomDataProvider() :
|
||||||
seeded_random(false)
|
seeded_random(false)
|
||||||
|
@ -24,7 +24,7 @@ InsecureRandomDataProvider::random()
|
||||||
// Seed the random number generator with something simple, but
|
// Seed the random number generator with something simple, but
|
||||||
// just to be interesting, don't use the unmodified current
|
// just to be interesting, don't use the unmodified current
|
||||||
// time. It would be better if this were a more secure seed.
|
// 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);
|
static_cast<unsigned int>(QUtil::get_current_time() ^ 0xcccc);
|
||||||
#ifdef HAVE_RANDOM
|
#ifdef HAVE_RANDOM
|
||||||
::srandom(seed);
|
::srandom(seed);
|
||||||
|
|
|
@ -294,7 +294,7 @@ JSON::addDictionaryMember(std::string const& key, JSON const& val)
|
||||||
bool
|
bool
|
||||||
JSON::checkDictionaryKeySeen(std::string const& key)
|
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) {
|
if (nullptr == obj) {
|
||||||
throw std::logic_error(
|
throw std::logic_error(
|
||||||
"JSON::checkDictionaryKey called on non-dictionary");
|
"JSON::checkDictionaryKey called on non-dictionary");
|
||||||
|
@ -315,7 +315,7 @@ JSON::makeArray()
|
||||||
JSON
|
JSON
|
||||||
JSON::addArrayElement(JSON const& val)
|
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) {
|
if (nullptr == arr) {
|
||||||
throw std::runtime_error("JSON::addArrayElement called on non-array");
|
throw std::runtime_error("JSON::addArrayElement called on non-array");
|
||||||
}
|
}
|
||||||
|
@ -470,13 +470,13 @@ JSON::checkSchemaInternal(
|
||||||
std::list<std::string>& errors,
|
std::list<std::string>& errors,
|
||||||
std::string prefix)
|
std::string prefix)
|
||||||
{
|
{
|
||||||
JSON_array* this_arr = dynamic_cast<JSON_array*>(this_v);
|
auto* this_arr = dynamic_cast<JSON_array*>(this_v);
|
||||||
JSON_dictionary* this_dict = dynamic_cast<JSON_dictionary*>(this_v);
|
auto* this_dict = dynamic_cast<JSON_dictionary*>(this_v);
|
||||||
|
|
||||||
JSON_array* sch_arr = dynamic_cast<JSON_array*>(sch_v);
|
auto* sch_arr = dynamic_cast<JSON_array*>(sch_v);
|
||||||
JSON_dictionary* sch_dict = dynamic_cast<JSON_dictionary*>(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;
|
std::string err_prefix;
|
||||||
if (prefix.empty()) {
|
if (prefix.empty()) {
|
||||||
|
|
|
@ -4,11 +4,7 @@
|
||||||
#include <qpdf/QPDFCryptoProvider.hh>
|
#include <qpdf/QPDFCryptoProvider.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <cstring>
|
||||||
#include <memory.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
MD5::MD5()
|
MD5::MD5()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include <qpdf/Pipeline.hh>
|
#include <qpdf/Pipeline.hh>
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
bool Pl_AES_PDF::use_static_iv = false;
|
bool Pl_AES_PDF::use_static_iv = false;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
Pl_ASCII85Decoder::Pl_ASCII85Decoder(char const* identifier, Pipeline* next) :
|
Pl_ASCII85Decoder::Pl_ASCII85Decoder(char const* identifier, Pipeline* next) :
|
||||||
Pipeline(identifier, next),
|
Pipeline(identifier, next),
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#include <qpdf/Pl_ASCIIHexDecoder.hh>
|
#include <qpdf/Pl_ASCIIHexDecoder.hh>
|
||||||
|
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <ctype.h>
|
#include <cctype>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) :
|
Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) :
|
||||||
Pipeline(identifier, next),
|
Pipeline(identifier, next),
|
||||||
|
@ -77,7 +76,7 @@ Pl_ASCIIHexDecoder::flush()
|
||||||
b[i] = this->inbuf[i] - '0';
|
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(
|
QTC::TC(
|
||||||
"libtests",
|
"libtests",
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <algorithm>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
|
Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
|
||||||
Pipeline(identifier, next),
|
Pipeline(identifier, next),
|
||||||
|
@ -45,7 +45,7 @@ Pl_Buffer::getBuffer()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto size = this->m->data.length();
|
auto size = this->m->data.length();
|
||||||
Buffer* b = new Buffer(size);
|
auto* b = new Buffer(size);
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
unsigned char* p = b->getBuffer();
|
unsigned char* p = b->getBuffer();
|
||||||
memcpy(p, this->m->data.data(), size);
|
memcpy(p, this->m->data.data(), size);
|
||||||
|
|
|
@ -2,12 +2,9 @@
|
||||||
|
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <csetjmp>
|
||||||
#include <setjmp.h>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#if BITS_IN_JSAMPLE != 8
|
#if BITS_IN_JSAMPLE != 8
|
||||||
|
@ -27,7 +24,7 @@ namespace
|
||||||
static void
|
static void
|
||||||
error_handler(j_common_ptr cinfo)
|
error_handler(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
qpdf_jpeg_error_mgr* jerr =
|
auto* jerr =
|
||||||
reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
|
reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
|
||||||
char buf[JMSG_LENGTH_MAX];
|
char buf[JMSG_LENGTH_MAX];
|
||||||
(*cinfo->err->format_message)(cinfo, buf);
|
(*cinfo->err->format_message)(cinfo, buf);
|
||||||
|
@ -170,7 +167,7 @@ static boolean
|
||||||
empty_pipeline_output_buffer(j_compress_ptr cinfo)
|
empty_pipeline_output_buffer(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
QTC::TC("libtests", "Pl_DCT empty_pipeline_output_buffer");
|
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->next->write(dest->buffer, dest->size);
|
||||||
dest->pub.next_output_byte = dest->buffer;
|
dest->pub.next_output_byte = dest->buffer;
|
||||||
dest->pub.free_in_buffer = dest->size;
|
dest->pub.free_in_buffer = dest->size;
|
||||||
|
@ -181,7 +178,7 @@ static void
|
||||||
term_pipeline_destination(j_compress_ptr cinfo)
|
term_pipeline_destination(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
QTC::TC("libtests", "Pl_DCT term_pipeline_destination");
|
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);
|
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),
|
reinterpret_cast<j_common_ptr>(cinfo),
|
||||||
JPOOL_PERMANENT,
|
JPOOL_PERMANENT,
|
||||||
sizeof(dct_pipeline_dest)));
|
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.init_destination = init_pipeline_destination;
|
||||||
dest->pub.empty_output_buffer = empty_pipeline_output_buffer;
|
dest->pub.empty_output_buffer = empty_pipeline_output_buffer;
|
||||||
dest->pub.term_destination = term_pipeline_destination;
|
dest->pub.term_destination = term_pipeline_destination;
|
||||||
|
@ -264,7 +261,7 @@ jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer)
|
||||||
void
|
void
|
||||||
Pl_DCT::compress(void* cinfo_p, Buffer* b)
|
Pl_DCT::compress(void* cinfo_p, Buffer* b)
|
||||||
{
|
{
|
||||||
struct jpeg_compress_struct* cinfo =
|
auto* cinfo =
|
||||||
reinterpret_cast<jpeg_compress_struct*>(cinfo_p);
|
reinterpret_cast<jpeg_compress_struct*>(cinfo_p);
|
||||||
|
|
||||||
#if ( \
|
#if ( \
|
||||||
|
@ -319,7 +316,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b)
|
||||||
void
|
void
|
||||||
Pl_DCT::decompress(void* cinfo_p, Buffer* b)
|
Pl_DCT::decompress(void* cinfo_p, Buffer* b)
|
||||||
{
|
{
|
||||||
struct jpeg_decompress_struct* cinfo =
|
auto* cinfo =
|
||||||
reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
|
reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
|
||||||
|
|
||||||
#if ( \
|
#if ( \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <qpdf/Pl_Flate.hh>
|
#include <qpdf/Pl_Flate.hh>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include <qpdf/Pl_Function.hh>
|
#include <qpdf/Pl_Function.hh>
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
Pl_Function::Members::Members(writer_t fn) :
|
Pl_Function::Members::Members(writer_t fn) :
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
Pl_LZWDecoder::Pl_LZWDecoder(
|
Pl_LZWDecoder::Pl_LZWDecoder(
|
||||||
char const* identifier, Pipeline* next, bool early_code_change) :
|
char const* identifier, Pipeline* next, bool early_code_change) :
|
||||||
|
@ -189,7 +189,7 @@ Pl_LZWDecoder::handleCode(unsigned int code)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code < 256) {
|
if (code < 256) {
|
||||||
unsigned char ch = static_cast<unsigned char>(code);
|
auto ch = static_cast<unsigned char>(code);
|
||||||
getNext()->write(&ch, 1);
|
getNext()->write(&ch, 1);
|
||||||
} else {
|
} else {
|
||||||
unsigned int idx = code - 258;
|
unsigned int idx = code - 258;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include <qpdf/Pl_OStream.hh>
|
#include <qpdf/Pl_OStream.hh>
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
Pl_OStream::Members::Members(std::ostream& os) :
|
Pl_OStream::Members::Members(std::ostream& os) :
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
abs_diff(int a, int b)
|
abs_diff(int a, int b)
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
#include <qpdf/BufferInputSource.hh>
|
#include <qpdf/BufferInputSource.hh>
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
Pl_QPDFTokenizer::Members::Members() :
|
Pl_QPDFTokenizer::Members::Members() :
|
||||||
filter(nullptr),
|
filter(nullptr),
|
||||||
|
|
|
@ -127,11 +127,11 @@ Pl_RunLength::flush_encode()
|
||||||
throw std::logic_error(
|
throw std::logic_error(
|
||||||
"Pl_RunLength: invalid length in flush_encode for run");
|
"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(&ch, 1);
|
||||||
this->getNext()->write(&this->m->buf[0], 1);
|
this->getNext()->write(&this->m->buf[0], 1);
|
||||||
} else if (this->m->length > 0) {
|
} 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(&ch, 1);
|
||||||
this->getNext()->write(this->m->buf, this->m->length);
|
this->getNext()->write(this->m->buf, this->m->length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <qpdf/QPDFCryptoProvider.hh>
|
#include <qpdf/QPDFCryptoProvider.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <cstdio>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
Pl_SHA2::Pl_SHA2(int bits, Pipeline* next) :
|
Pl_SHA2::Pl_SHA2(int bits, Pipeline* next) :
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <qpdf/Pl_StdioFile.hh>
|
#include <qpdf/Pl_StdioFile.hh>
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <errno.h>
|
#include <cerrno>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
Pl_StdioFile::Members::Members(FILE* f) :
|
Pl_StdioFile::Members::Members(FILE* f) :
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include <qpdf/Pl_String.hh>
|
#include <qpdf/Pl_String.hh>
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
Pl_String::Members::Members(std::string& s) :
|
Pl_String::Members::Members(std::string& s) :
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
Pl_TIFFPredictor::Pl_TIFFPredictor(
|
Pl_TIFFPredictor::Pl_TIFFPredictor(
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <qpdf/BufferInputSource.hh>
|
#include <qpdf/BufferInputSource.hh>
|
||||||
|
@ -60,42 +60,42 @@ namespace
|
||||||
class InvalidInputSource: public InputSource
|
class InvalidInputSource: public InputSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~InvalidInputSource() = default;
|
~InvalidInputSource() override = default;
|
||||||
virtual qpdf_offset_t
|
qpdf_offset_t
|
||||||
findAndSkipNextEOL() override
|
findAndSkipNextEOL() override
|
||||||
{
|
{
|
||||||
throwException();
|
throwException();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual std::string const&
|
std::string const&
|
||||||
getName() const override
|
getName() const override
|
||||||
{
|
{
|
||||||
static std::string name("closed input source");
|
static std::string name("closed input source");
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
virtual qpdf_offset_t
|
qpdf_offset_t
|
||||||
tell() override
|
tell() override
|
||||||
{
|
{
|
||||||
throwException();
|
throwException();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual void
|
void
|
||||||
seek(qpdf_offset_t offset, int whence) override
|
seek(qpdf_offset_t offset, int whence) override
|
||||||
{
|
{
|
||||||
throwException();
|
throwException();
|
||||||
}
|
}
|
||||||
virtual void
|
void
|
||||||
rewind() override
|
rewind() override
|
||||||
{
|
{
|
||||||
throwException();
|
throwException();
|
||||||
}
|
}
|
||||||
virtual size_t
|
size_t
|
||||||
read(char* buffer, size_t length) override
|
read(char* buffer, size_t length) override
|
||||||
{
|
{
|
||||||
throwException();
|
throwException();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual void
|
void
|
||||||
unreadCh(char ch) override
|
unreadCh(char ch) override
|
||||||
{
|
{
|
||||||
throwException();
|
throwException();
|
||||||
|
@ -264,7 +264,7 @@ QPDF::create()
|
||||||
void
|
void
|
||||||
QPDF::processFile(char const* filename, char const* password)
|
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);
|
processInputSource(std::shared_ptr<InputSource>(fi), password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void
|
||||||
QPDF::processFile(
|
QPDF::processFile(
|
||||||
char const* description, FILE* filep, bool close_file, char const* password)
|
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);
|
processInputSource(std::shared_ptr<InputSource>(fi), password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2537,7 +2537,7 @@ QPDF::getCompressibleObjGens()
|
||||||
if (obj.isStream()) {
|
if (obj.isStream()) {
|
||||||
QPDFObjectHandle dict = obj.getDict();
|
QPDFObjectHandle dict = obj.getDict();
|
||||||
std::set<std::string> keys = dict.getKeys();
|
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 != keys.rend();
|
||||||
++iter) {
|
++iter) {
|
||||||
std::string const& key = *iter;
|
std::string const& key = *iter;
|
||||||
|
@ -2553,7 +2553,7 @@ QPDF::getCompressibleObjGens()
|
||||||
}
|
}
|
||||||
} else if (obj.isDictionary()) {
|
} else if (obj.isDictionary()) {
|
||||||
std::set<std::string> keys = obj.getKeys();
|
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 != keys.rend();
|
||||||
++iter) {
|
++iter) {
|
||||||
queue.push_front(obj.getKey(*iter));
|
queue.push_front(obj.getKey(*iter));
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
#include <qpdf/QPDFMatrix.hh>
|
#include <qpdf/QPDFMatrix.hh>
|
||||||
#include <qpdf/QPDFNameTreeObjectHelper.hh>
|
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include <qpdf/QPDFExc.hh>
|
#include <qpdf/QPDFExc.hh>
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
|
||||||
|
|
||||||
QPDFExc::QPDFExc(
|
QPDFExc::QPDFExc(
|
||||||
qpdf_error_code_e error_code,
|
qpdf_error_code_e error_code,
|
||||||
std::string const& filename,
|
std::string const& filename,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <qpdf/QPDFAnnotationObjectHelper.hh>
|
#include <qpdf/QPDFAnnotationObjectHelper.hh>
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper(QPDFObjectHandle oh) :
|
QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper(QPDFObjectHandle oh) :
|
||||||
QPDFObjectHelper(oh),
|
QPDFObjectHelper(oh),
|
||||||
|
@ -515,9 +515,9 @@ namespace
|
||||||
std::vector<std::string> const& opt,
|
std::vector<std::string> const& opt,
|
||||||
double tf,
|
double tf,
|
||||||
QPDFObjectHandle::Rectangle const& bbox);
|
QPDFObjectHandle::Rectangle const& bbox);
|
||||||
virtual ~ValueSetter() = default;
|
~ValueSetter() override = default;
|
||||||
virtual void handleToken(QPDFTokenizer::Token const&);
|
void handleToken(QPDFTokenizer::Token const&) override;
|
||||||
virtual void handleEOF();
|
void handleEOF() override;
|
||||||
void writeAppearance();
|
void writeAppearance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -611,7 +611,7 @@ ValueSetter::writeAppearance()
|
||||||
// Write one or more lines, centered vertically, possibly with
|
// Write one or more lines, centered vertically, possibly with
|
||||||
// one row highlighted.
|
// 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;
|
bool highlight = false;
|
||||||
size_t highlight_idx = 0;
|
size_t highlight_idx = 0;
|
||||||
|
|
||||||
|
@ -706,10 +706,10 @@ namespace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TfFinder();
|
TfFinder();
|
||||||
virtual ~TfFinder()
|
~TfFinder() override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual void handleToken(QPDFTokenizer::Token const&);
|
void handleToken(QPDFTokenizer::Token const&) override;
|
||||||
double getTf();
|
double getTf();
|
||||||
std::string getFontName();
|
std::string getFontName();
|
||||||
std::string getDA();
|
std::string getDA();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctype.h>
|
#include <cctype>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -48,8 +48,8 @@ namespace
|
||||||
size_t oi_min_height,
|
size_t oi_min_height,
|
||||||
size_t oi_min_area,
|
size_t oi_min_area,
|
||||||
QPDFObjectHandle& image);
|
QPDFObjectHandle& image);
|
||||||
virtual ~ImageOptimizer() = default;
|
~ImageOptimizer() override = default;
|
||||||
virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline);
|
void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
|
||||||
std::shared_ptr<Pipeline>
|
std::shared_ptr<Pipeline>
|
||||||
makePipeline(std::string const& description, Pipeline* next);
|
makePipeline(std::string const& description, Pipeline* next);
|
||||||
bool evaluate(std::string const& description);
|
bool evaluate(std::string const& description);
|
||||||
|
@ -65,13 +65,13 @@ namespace
|
||||||
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
|
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~DiscardContents() = default;
|
~DiscardContents() override = default;
|
||||||
virtual void
|
void
|
||||||
handleObject(QPDFObjectHandle)
|
handleObject(QPDFObjectHandle) override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual void
|
void
|
||||||
handleEOF()
|
handleEOF() override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -98,8 +98,8 @@ namespace
|
||||||
filename(filename)
|
filename(filename)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~ProgressReporter() = default;
|
~ProgressReporter() override = default;
|
||||||
virtual void reportProgress(int);
|
void reportProgress(int) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pipeline& p;
|
Pipeline& p;
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
// See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer.
|
// See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer.
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <ctype.h>
|
#include <cctype>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
#include <qpdf/QPDFArgParser.hh>
|
#include <qpdf/QPDFArgParser.hh>
|
||||||
|
|
|
@ -17,14 +17,14 @@ namespace
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
void
|
||||||
write(unsigned char const* data, size_t len) override
|
write(unsigned char const* data, size_t len) override
|
||||||
{
|
{
|
||||||
this->used = true;
|
this->used = true;
|
||||||
getNext()->write(data, len);
|
getNext()->write(data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
void
|
||||||
finish() override
|
finish() override
|
||||||
{
|
{
|
||||||
getNext()->finish();
|
getNext()->finish();
|
||||||
|
|
|
@ -7,18 +7,18 @@ namespace
|
||||||
class NameTreeDetails: public NNTreeDetails
|
class NameTreeDetails: public NNTreeDetails
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::string const&
|
std::string const&
|
||||||
itemsKey() const override
|
itemsKey() const override
|
||||||
{
|
{
|
||||||
static std::string k("/Names");
|
static std::string k("/Names");
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
virtual bool
|
bool
|
||||||
keyValid(QPDFObjectHandle oh) const override
|
keyValid(QPDFObjectHandle oh) const override
|
||||||
{
|
{
|
||||||
return oh.isString();
|
return oh.isString();
|
||||||
}
|
}
|
||||||
virtual int
|
int
|
||||||
compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override
|
compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override
|
||||||
{
|
{
|
||||||
if (!(keyValid(a) && keyValid(b))) {
|
if (!(keyValid(a) && keyValid(b))) {
|
||||||
|
|
|
@ -8,18 +8,18 @@ namespace
|
||||||
class NumberTreeDetails: public NNTreeDetails
|
class NumberTreeDetails: public NNTreeDetails
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::string const&
|
std::string const&
|
||||||
itemsKey() const override
|
itemsKey() const override
|
||||||
{
|
{
|
||||||
static std::string k("/Nums");
|
static std::string k("/Nums");
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
virtual bool
|
bool
|
||||||
keyValid(QPDFObjectHandle oh) const override
|
keyValid(QPDFObjectHandle oh) const override
|
||||||
{
|
{
|
||||||
return oh.isInteger();
|
return oh.isInteger();
|
||||||
}
|
}
|
||||||
virtual int
|
int
|
||||||
compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override
|
compareKeys(QPDFObjectHandle a, QPDFObjectHandle b) const override
|
||||||
{
|
{
|
||||||
if (!(keyValid(a) && keyValid(b))) {
|
if (!(keyValid(a) && keyValid(b))) {
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctype.h>
|
#include <cctype>
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ namespace
|
||||||
old_contents(old_contents)
|
old_contents(old_contents)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~CoalesceProvider() = default;
|
~CoalesceProvider() override = default;
|
||||||
virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline);
|
void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPDFObjectHandle containing_page;
|
QPDFObjectHandle containing_page;
|
||||||
|
@ -200,9 +200,9 @@ namespace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LastChar(Pipeline* next);
|
LastChar(Pipeline* next);
|
||||||
virtual ~LastChar() = default;
|
~LastChar() override = default;
|
||||||
virtual void write(unsigned char const* data, size_t len);
|
void write(unsigned char const* data, size_t len) override;
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
unsigned char getLastChar();
|
unsigned char getLastChar();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1446,13 +1446,13 @@ namespace
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
void
|
||||||
provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override
|
provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override
|
||||||
{
|
{
|
||||||
p1(pipeline);
|
p1(pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool
|
bool
|
||||||
provideStreamData(
|
provideStreamData(
|
||||||
QPDFObjGen const&,
|
QPDFObjGen const&,
|
||||||
Pipeline* pipeline,
|
Pipeline* pipeline,
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <qpdf/QPDF_Reserved.hh>
|
#include <qpdf/QPDF_Reserved.hh>
|
||||||
#include <qpdf/QPDF_Stream.hh>
|
#include <qpdf/QPDF_Stream.hh>
|
||||||
#include <qpdf/QPDF_String.hh>
|
#include <qpdf/QPDF_String.hh>
|
||||||
#include <qpdf/QPDF_Unresolved.hh>
|
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include <qpdf/QPDFSystemError.hh>
|
#include <qpdf/QPDFSystemError.hh>
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
#include <cstring>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
QPDFSystemError::QPDFSystemError(
|
QPDFSystemError::QPDFSystemError(
|
||||||
std::string const& description, int system_errno) :
|
std::string const& description, int system_errno) :
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
is_delimiter(char ch)
|
is_delimiter(char ch)
|
||||||
|
@ -35,8 +35,8 @@ namespace
|
||||||
str(str)
|
str(str)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~QPDFWordTokenFinder() = default;
|
~QPDFWordTokenFinder() override = default;
|
||||||
virtual bool check();
|
bool check() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<InputSource> is;
|
std::shared_ptr<InputSource> is;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
QPDFWriter::ProgressReporter::~ProgressReporter()
|
QPDFWriter::ProgressReporter::~ProgressReporter()
|
||||||
{
|
{
|
||||||
|
@ -997,7 +997,7 @@ void
|
||||||
QPDFWriter::activatePipelineStack(PipelinePopper& pp)
|
QPDFWriter::activatePipelineStack(PipelinePopper& pp)
|
||||||
{
|
{
|
||||||
std::string stack_id("stack " + std::to_string(this->m->next_stack_id));
|
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());
|
new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back());
|
||||||
++this->m->next_stack_id;
|
++this->m->next_stack_id;
|
||||||
this->m->pipeline_stack.push_back(c);
|
this->m->pipeline_stack.push_back(c);
|
||||||
|
@ -1030,7 +1030,7 @@ QPDFWriter::PipelinePopper::~PipelinePopper()
|
||||||
qw->m->md5_pipeline = nullptr;
|
qw->m->md5_pipeline = nullptr;
|
||||||
}
|
}
|
||||||
qw->m->pipeline_stack.pop_back();
|
qw->m->pipeline_stack.pop_back();
|
||||||
Pl_Buffer* buf = dynamic_cast<Pl_Buffer*>(p);
|
auto* buf = dynamic_cast<Pl_Buffer*>(p);
|
||||||
if (bp && buf) {
|
if (bp && buf) {
|
||||||
*bp = buf->getBufferSharedPointer();
|
*bp = buf->getBufferSharedPointer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
#include <qpdf/QPDFExc.hh>
|
#include <qpdf/QPDFExc.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
|
||||||
|
|
||||||
QPDFXRefEntry::QPDFXRefEntry()
|
QPDFXRefEntry::QPDFXRefEntry()
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,7 @@ QPDF_Array::copy(bool shallow)
|
||||||
return do_create(new QPDF_Array(*this));
|
return do_create(new QPDF_Array(*this));
|
||||||
} else {
|
} else {
|
||||||
if (sparse) {
|
if (sparse) {
|
||||||
QPDF_Array* result = new QPDF_Array();
|
auto* result = new QPDF_Array();
|
||||||
result->sp_size = sp_size;
|
result->sp_size = sp_size;
|
||||||
for (auto const& element: sp_elements) {
|
for (auto const& element: sp_elements) {
|
||||||
auto const& obj = element.second;
|
auto const& obj = element.second;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include <qpdf/QPDF_Name.hh>
|
#include <qpdf/QPDF_Name.hh>
|
||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
QPDF_Name::QPDF_Name(std::string const& name) :
|
QPDF_Name::QPDF_Name(std::string const& name) :
|
||||||
QPDFValue(::ot_name, "name"),
|
QPDFValue(::ot_name, "name"),
|
||||||
|
|
|
@ -27,10 +27,10 @@ namespace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SF_Crypt() = default;
|
SF_Crypt() = default;
|
||||||
virtual ~SF_Crypt() = default;
|
~SF_Crypt() override = default;
|
||||||
|
|
||||||
virtual bool
|
bool
|
||||||
setDecodeParms(QPDFObjectHandle decode_parms)
|
setDecodeParms(QPDFObjectHandle decode_parms) override
|
||||||
{
|
{
|
||||||
if (decode_parms.isNull()) {
|
if (decode_parms.isNull()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -49,8 +49,8 @@ namespace
|
||||||
return filterable;
|
return filterable;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Pipeline*
|
Pipeline*
|
||||||
getDecodePipeline(Pipeline*)
|
getDecodePipeline(Pipeline*) override
|
||||||
{
|
{
|
||||||
// Not used -- handled by pipeStreamData
|
// Not used -- handled by pipeStreamData
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -557,7 +557,7 @@ QPDF_Stream::pipeStreamData(
|
||||||
if (decode_pipeline) {
|
if (decode_pipeline) {
|
||||||
pipeline = decode_pipeline;
|
pipeline = decode_pipeline;
|
||||||
}
|
}
|
||||||
Pl_Flate* flate = dynamic_cast<Pl_Flate*>(pipeline);
|
auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
|
||||||
if (flate != nullptr) {
|
if (flate != nullptr) {
|
||||||
flate->setWarnCallback(
|
flate->setWarnCallback(
|
||||||
[this](char const* msg, int code) { warn(msg); });
|
[this](char const* msg, int code) { warn(msg); });
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// DO NOT USE ctype -- it is locale dependent for some things, and
|
// 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
|
// it's not worth the risk of including it in case it may accidentally
|
||||||
// be used.
|
// be used.
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_iso_latin1_printable(char ch)
|
is_iso_latin1_printable(char ch)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <qpdf/RC4.hh>
|
#include <qpdf/RC4.hh>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
static unsigned char const padding_string[] = {
|
static unsigned char const padding_string[] = {
|
||||||
0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e,
|
0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e,
|
||||||
|
|
|
@ -242,13 +242,13 @@ class QPDF::JSONReactor: public JSON::Reactor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual ~JSONReactor() = default;
|
virtual ~JSONReactor() = default;
|
||||||
virtual void dictionaryStart() override;
|
void dictionaryStart() override;
|
||||||
virtual void arrayStart() override;
|
void arrayStart() override;
|
||||||
virtual void containerEnd(JSON const& value) override;
|
void containerEnd(JSON const& value) override;
|
||||||
virtual void topLevelScalar() override;
|
void topLevelScalar() override;
|
||||||
virtual bool
|
bool
|
||||||
dictionaryItem(std::string const& key, JSON const& value) override;
|
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;
|
bool anyErrors() const;
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,8 @@
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <cmath>
|
||||||
#include <math.h>
|
#include <cstring>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
template <class T, class int_type>
|
template <class T, class int_type>
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -115,7 +115,7 @@ QPDF::optimize(
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjUser root_ou = ObjUser(ObjUser::ou_root);
|
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->obj_user_to_objects[root_ou].insert(root_og);
|
||||||
this->m->object_to_obj_users[root_og].insert(root_ou);
|
this->m->object_to_obj_users[root_og].insert(root_ou);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
tc_active(char const* const scope)
|
tc_active(char const* const scope)
|
||||||
|
|
|
@ -9,9 +9,8 @@
|
||||||
#include <qpdf/QPDFSystemError.hh>
|
#include <qpdf/QPDFSystemError.hh>
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cctype>
|
||||||
#include <ctype.h>
|
#include <cerrno>
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
@ -22,9 +21,9 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#ifndef QPDF_NO_WCHAR_T
|
#ifndef QPDF_NO_WCHAR_T
|
||||||
# include <cwchar>
|
# include <cwchar>
|
||||||
#endif
|
#endif
|
||||||
|
@ -837,8 +836,8 @@ char*
|
||||||
QUtil::getWhoami(char* argv0)
|
QUtil::getWhoami(char* argv0)
|
||||||
{
|
{
|
||||||
char* whoami = nullptr;
|
char* whoami = nullptr;
|
||||||
if (((whoami = strrchr(argv0, '/')) == NULL) &&
|
if (((whoami = strrchr(argv0, '/')) == nullptr) &&
|
||||||
((whoami = strrchr(argv0, '\\')) == NULL)) {
|
((whoami = strrchr(argv0, '\\')) == nullptr)) {
|
||||||
whoami = argv0;
|
whoami = argv0;
|
||||||
} else {
|
} else {
|
||||||
++whoami;
|
++whoami;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <qpdf/QPDFCryptoProvider.hh>
|
#include <qpdf/QPDFCryptoProvider.hh>
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
RC4::RC4(unsigned char const* key_data, int key_len) :
|
RC4::RC4(unsigned char const* key_data, int key_len) :
|
||||||
crypto(QPDFCryptoProvider::getImpl())
|
crypto(QPDFCryptoProvider::getImpl())
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <qpdf/qpdf-c_impl.hh>
|
#include <qpdf/qpdf-c_impl.hh>
|
||||||
#include <qpdf/qpdflogger-c_impl.hh>
|
#include <qpdf/qpdflogger-c_impl.hh>
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -107,7 +106,7 @@ qpdf_data
|
||||||
qpdf_init()
|
qpdf_init()
|
||||||
{
|
{
|
||||||
QTC::TC("qpdf", "qpdf-c called 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();
|
qpdf->qpdf = QPDF::create();
|
||||||
return qpdf;
|
return qpdf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef BITSTREAM_HH
|
#ifndef BITSTREAM_HH
|
||||||
#define BITSTREAM_HH
|
#define BITSTREAM_HH
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <cstddef>
|
||||||
|
|
||||||
class BitStream
|
class BitStream
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef BITWRITER_HH
|
#ifndef BITWRITER_HH
|
||||||
#define BITWRITER_HH
|
#define BITWRITER_HH
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <cstddef>
|
||||||
|
|
||||||
class Pipeline;
|
class Pipeline;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ class ContentNormalizer: public QPDFObjectHandle::TokenFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ContentNormalizer();
|
ContentNormalizer();
|
||||||
virtual ~ContentNormalizer() = default;
|
~ContentNormalizer() override = default;
|
||||||
virtual void handleToken(QPDFTokenizer::Token const&);
|
void handleToken(QPDFTokenizer::Token const&) override;
|
||||||
|
|
||||||
bool anyBadTokens() const;
|
bool anyBadTokens() const;
|
||||||
bool lastTokenWasBad() const;
|
bool lastTokenWasBad() const;
|
||||||
|
|
|
@ -7,8 +7,8 @@ class CryptoRandomDataProvider: public RandomDataProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CryptoRandomDataProvider() = default;
|
CryptoRandomDataProvider() = default;
|
||||||
virtual ~CryptoRandomDataProvider() = default;
|
~CryptoRandomDataProvider() override = default;
|
||||||
virtual void provideRandomData(unsigned char* data, size_t len);
|
void provideRandomData(unsigned char* data, size_t len) override;
|
||||||
static RandomDataProvider* getInstance();
|
static RandomDataProvider* getInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ class InsecureRandomDataProvider: public RandomDataProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InsecureRandomDataProvider();
|
InsecureRandomDataProvider();
|
||||||
virtual ~InsecureRandomDataProvider() = default;
|
~InsecureRandomDataProvider() override = default;
|
||||||
virtual void provideRandomData(unsigned char* data, size_t len);
|
void provideRandomData(unsigned char* data, size_t len) override;
|
||||||
static RandomDataProvider* getInstance();
|
static RandomDataProvider* getInstance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -11,15 +11,15 @@ class OffsetInputSource: public InputSource
|
||||||
public:
|
public:
|
||||||
OffsetInputSource(
|
OffsetInputSource(
|
||||||
std::shared_ptr<InputSource>, qpdf_offset_t global_offset);
|
std::shared_ptr<InputSource>, qpdf_offset_t global_offset);
|
||||||
virtual ~OffsetInputSource() = default;
|
~OffsetInputSource() override = default;
|
||||||
|
|
||||||
virtual qpdf_offset_t findAndSkipNextEOL();
|
qpdf_offset_t findAndSkipNextEOL() override;
|
||||||
virtual std::string const& getName() const;
|
std::string const& getName() const override;
|
||||||
virtual qpdf_offset_t tell();
|
qpdf_offset_t tell() override;
|
||||||
virtual void seek(qpdf_offset_t offset, int whence);
|
void seek(qpdf_offset_t offset, int whence) override;
|
||||||
virtual void rewind();
|
void rewind() override;
|
||||||
virtual size_t read(char* buffer, size_t length);
|
size_t read(char* buffer, size_t length) override;
|
||||||
virtual void unreadCh(char ch);
|
void unreadCh(char ch) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<InputSource> proxied;
|
std::shared_ptr<InputSource> proxied;
|
||||||
|
|
|
@ -18,10 +18,10 @@ class Pl_AES_PDF: public Pipeline
|
||||||
bool encrypt,
|
bool encrypt,
|
||||||
unsigned char const* key,
|
unsigned char const* key,
|
||||||
size_t key_bytes);
|
size_t key_bytes);
|
||||||
virtual ~Pl_AES_PDF() = default;
|
~Pl_AES_PDF() override = default;
|
||||||
|
|
||||||
virtual void write(unsigned char const* data, size_t len);
|
void write(unsigned char const* data, size_t len) override;
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
|
|
||||||
// Use zero initialization vector; needed for AESV3
|
// Use zero initialization vector; needed for AESV3
|
||||||
void useZeroIV();
|
void useZeroIV();
|
||||||
|
|
|
@ -7,9 +7,9 @@ class Pl_ASCII85Decoder: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pl_ASCII85Decoder(char const* identifier, Pipeline* next);
|
Pl_ASCII85Decoder(char const* identifier, Pipeline* next);
|
||||||
virtual ~Pl_ASCII85Decoder() = default;
|
~Pl_ASCII85Decoder() override = default;
|
||||||
virtual void write(unsigned char const* buf, size_t len);
|
void write(unsigned char const* buf, size_t len) override;
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void flush();
|
void flush();
|
||||||
|
|
|
@ -7,9 +7,9 @@ class Pl_ASCIIHexDecoder: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next);
|
Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next);
|
||||||
virtual ~Pl_ASCIIHexDecoder() = default;
|
~Pl_ASCIIHexDecoder() override = default;
|
||||||
virtual void write(unsigned char const* buf, size_t len);
|
void write(unsigned char const* buf, size_t len) override;
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void flush();
|
void flush();
|
||||||
|
|
|
@ -8,9 +8,9 @@ class Pl_Base64: public Pipeline
|
||||||
public:
|
public:
|
||||||
enum action_e { a_encode, a_decode };
|
enum action_e { a_encode, a_decode };
|
||||||
Pl_Base64(char const* identifier, Pipeline* next, action_e);
|
Pl_Base64(char const* identifier, Pipeline* next, action_e);
|
||||||
virtual ~Pl_Base64() = default;
|
~Pl_Base64() override = default;
|
||||||
virtual void write(unsigned char const* buf, size_t len) override;
|
void write(unsigned char const* buf, size_t len) override;
|
||||||
virtual void finish() override;
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void decode(unsigned char const* buf, size_t len);
|
void decode(unsigned char const* buf, size_t len);
|
||||||
|
|
|
@ -22,10 +22,10 @@ class Pl_PNGFilter: public Pipeline
|
||||||
unsigned int columns,
|
unsigned int columns,
|
||||||
unsigned int samples_per_pixel = 1,
|
unsigned int samples_per_pixel = 1,
|
||||||
unsigned int bits_per_sample = 8);
|
unsigned int bits_per_sample = 8);
|
||||||
virtual ~Pl_PNGFilter() = default;
|
~Pl_PNGFilter() override = default;
|
||||||
|
|
||||||
virtual void write(unsigned char const* data, size_t len);
|
void write(unsigned char const* data, size_t len) override;
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void decodeSub();
|
void decodeSub();
|
||||||
|
|
|
@ -17,10 +17,10 @@ class Pl_RC4: public Pipeline
|
||||||
unsigned char const* key_data,
|
unsigned char const* key_data,
|
||||||
int key_len = -1,
|
int key_len = -1,
|
||||||
size_t out_bufsize = def_bufsize);
|
size_t out_bufsize = def_bufsize);
|
||||||
virtual ~Pl_RC4() = default;
|
~Pl_RC4() override = default;
|
||||||
|
|
||||||
virtual void write(unsigned char const* data, size_t len);
|
void write(unsigned char const* data, size_t len) override;
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<unsigned char> outbuf;
|
std::shared_ptr<unsigned char> outbuf;
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
class Pl_SHA2: public Pipeline
|
class Pl_SHA2: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pl_SHA2(int bits = 0, Pipeline* next = 0);
|
Pl_SHA2(int bits = 0, Pipeline* next = nullptr);
|
||||||
virtual ~Pl_SHA2() = default;
|
~Pl_SHA2() override = default;
|
||||||
virtual void write(unsigned char const*, size_t);
|
void write(unsigned char const*, size_t) override;
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
void resetBits(int bits);
|
void resetBits(int bits);
|
||||||
std::string getHexDigest();
|
std::string getHexDigest();
|
||||||
std::string getRawDigest();
|
std::string getRawDigest();
|
||||||
|
|
|
@ -18,10 +18,10 @@ class Pl_TIFFPredictor: public Pipeline
|
||||||
unsigned int columns,
|
unsigned int columns,
|
||||||
unsigned int samples_per_pixel = 1,
|
unsigned int samples_per_pixel = 1,
|
||||||
unsigned int bits_per_sample = 8);
|
unsigned int bits_per_sample = 8);
|
||||||
virtual ~Pl_TIFFPredictor() = default;
|
~Pl_TIFFPredictor() override = default;
|
||||||
|
|
||||||
virtual void write(unsigned char const* data, size_t len);
|
void write(unsigned char const* data, size_t len) override;
|
||||||
virtual void finish();
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processRow();
|
void processRow();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user