2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

Rerun format_code (after merging clang-tidy PR)

This commit is contained in:
Jay Berkenbilt 2023-05-20 14:13:09 -04:00
parent 5f02c7c9e7
commit d740c6ccce
65 changed files with 91 additions and 105 deletions

View File

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

View File

@ -4,8 +4,8 @@
// that uses QPDFObjectHandle::TokenFilter with addContentTokenFilter.
//
#include <iostream>
#include <cstdlib>
#include <iostream>
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/QPDF.hh>

View File

@ -14,9 +14,9 @@
#include <qpdf/QPDFPageDocumentHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <cstdlib>
#include <iostream>
#include <memory>
#include <cstdlib>
static char const* whoami = nullptr;

View File

@ -200,8 +200,7 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider
public:
StreamReplacer(QPDF* pdf);
~StreamReplacer() override = default;
void
provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
void registerStream(
QPDFObjectHandle stream,

View File

@ -4,9 +4,9 @@
#include <qpdf/QPDFPageObjectHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <iostream>
static char const* whoami = nullptr;

View File

@ -6,9 +6,9 @@
//
#include <algorithm>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <cstdlib>
#include <qpdf/QPDF.hh>
#include <qpdf/QPDFObjectHandle.hh>

View File

@ -5,9 +5,9 @@
#include <qpdf/QPDFPageObjectHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <iostream>
static char const* whoami = nullptr;
@ -34,8 +34,7 @@ class ImageInverter: public QPDFObjectHandle::StreamDataProvider
{
public:
~ImageInverter() override = default;
void
provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override;
void registerImage(
QPDFObjectHandle image,

View File

@ -5,10 +5,10 @@
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
static char const* version = "1.1";
static char const* whoami = nullptr;

View File

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

View File

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

View File

@ -1,5 +1,5 @@
#include <iostream>
#include <cstdlib>
#include <iostream>
#include <qpdf/QIntC.hh>
#include <qpdf/QPDF.hh>

View File

@ -3,8 +3,8 @@
#include <qpdf/QPDFPageDocumentHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <iostream>
static char const* whoami = nullptr;

View File

@ -10,9 +10,9 @@
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <string>
static bool static_id = false;

View File

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

View File

@ -26,8 +26,8 @@
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
#include <qpdf/Types.h>
#include <memory>
#include <cstdio>
#include <memory>
#include <string>
// Remember to use QPDF_DLL_CLASS on anything derived from InputSource

View File

@ -25,12 +25,12 @@
#include <qpdf/DLL.h>
#include <qpdf/Types.h>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <cstdio>
#include <string>
#include <string_view>
#include <vector>
@ -113,8 +113,8 @@ class QPDF
// your own method of retrieving a PDF file, you can subclass
// InputSource and use this method.
QPDF_DLL
void
processInputSource(std::shared_ptr<InputSource>, char const* password = nullptr);
void processInputSource(
std::shared_ptr<InputSource>, char const* password = nullptr);
// Create a PDF from an input source that contains JSON as written
// by writeJSON (or qpdf --json-output, version 2 or higher). The

View File

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

View File

@ -319,8 +319,8 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
// contents, as happens with addContentTokenFilter. See
// examples/pdf-count-strings.cc for an example.
QPDF_DLL
void
filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
void filterContents(
QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr);
// Old name -- calls filterContents()
QPDF_DLL

View File

@ -27,8 +27,8 @@
#include <qpdf/InputSource.hh>
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
#include <memory>
#include <cstdio>
#include <memory>
#include <string>
class QPDFTokenizer

View File

@ -29,12 +29,12 @@
#include <qpdf/DLL.h>
#include <qpdf/Types.h>
#include <cstdio>
#include <functional>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <cstdio>
#include <string>
#include <string_view>
#include <vector>

View File

@ -25,14 +25,14 @@
#include <qpdf/DLL.h>
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
#include <qpdf/Types.h>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <list>
#include <memory>
#include <stdexcept>
#include <cstdio>
#include <string>
#include <ctime>
#include <vector>
class RandomDataProvider;

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
#include <qpdf/Pl_Buffer.hh>
#include <algorithm>
#include <stdexcept>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),

View File

@ -24,8 +24,7 @@ namespace
static void
error_handler(j_common_ptr cinfo)
{
auto* jerr =
reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
char buf[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo, buf);
jerr->msg = buf;
@ -261,8 +260,7 @@ jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer)
void
Pl_DCT::compress(void* cinfo_p, Buffer* b)
{
auto* cinfo =
reinterpret_cast<jpeg_compress_struct*>(cinfo_p);
auto* cinfo = reinterpret_cast<jpeg_compress_struct*>(cinfo_p);
#if ( \
(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || \
@ -316,8 +314,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b)
void
Pl_DCT::decompress(void* cinfo_p, Buffer* b)
{
auto* cinfo =
reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
auto* cinfo = reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
#if ( \
(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || \

View File

@ -3,8 +3,8 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <stdexcept>
#include <cstring>
#include <stdexcept>
Pl_LZWDecoder::Pl_LZWDecoder(
char const* identifier, Pipeline* next, bool early_code_change) :

View File

@ -4,8 +4,8 @@
#include <qpdf/QUtil.hh>
#include <climits>
#include <stdexcept>
#include <cstring>
#include <stdexcept>
static int
abs_diff(int a, int b)

View File

@ -6,8 +6,8 @@
#include <qpdf/QUtil.hh>
#include <climits>
#include <stdexcept>
#include <cstring>
#include <stdexcept>
#include <vector>
Pl_TIFFPredictor::Pl_TIFFPredictor(

View File

@ -4,13 +4,13 @@
#include <algorithm>
#include <atomic>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <map>
#include <memory.h>
#include <regex>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <qpdf/BufferInputSource.hh>
@ -2528,9 +2528,7 @@ QPDF::getCompressibleObjGens()
if (obj.isStream()) {
QPDFObjectHandle dict = obj.getDict();
std::set<std::string> keys = dict.getKeys();
for (auto iter = keys.rbegin();
iter != keys.rend();
++iter) {
for (auto iter = keys.rbegin(); iter != keys.rend(); ++iter) {
std::string const& key = *iter;
QPDFObjectHandle value = dict.getKey(key);
if (key == "/Length") {
@ -2544,9 +2542,7 @@ QPDF::getCompressibleObjGens()
}
} else if (obj.isDictionary()) {
std::set<std::string> keys = obj.getKeys();
for (auto iter = keys.rbegin();
iter != keys.rend();
++iter) {
for (auto iter = keys.rbegin(); iter != keys.rend(); ++iter) {
queue.push_front(obj.getKey(*iter));
}
} else if (obj.isArray()) {

View File

@ -1,9 +1,9 @@
#include <qpdf/QPDFJob.hh>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <fcntl.h>
#include <iostream>
#include <memory>

View File

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

View File

@ -29,11 +29,11 @@
#include <qpdf/QUtil.hh>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <climits>
#include <stdexcept>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
using namespace std::literals;

View File

@ -10,9 +10,9 @@
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <stdexcept>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
static inline bool
is_delimiter(char ch)

View File

@ -23,8 +23,8 @@
#include <qpdf/RC4.hh>
#include <algorithm>
#include <stdexcept>
#include <cstdlib>
#include <stdexcept>
QPDFWriter::ProgressReporter::~ProgressReporter()
{
@ -997,8 +997,7 @@ void
QPDFWriter::activatePipelineStack(PipelinePopper& pp)
{
std::string stack_id("stack " + std::to_string(this->m->next_stack_id));
auto* c =
new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back());
auto* c = new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back());
++this->m->next_stack_id;
this->m->pipeline_stack.push_back(c);
this->m->pipeline = c;

View File

@ -246,8 +246,7 @@ class QPDF::JSONReactor: public JSON::Reactor
void arrayStart() override;
void containerEnd(JSON const& value) override;
void topLevelScalar() override;
bool
dictionaryItem(std::string const& key, JSON const& value) override;
bool dictionaryItem(std::string const& key, JSON const& value) override;
bool arrayItem(JSON const& value) override;
bool anyErrors() const;

View File

@ -1,9 +1,9 @@
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <cstdio>
#include <map>
#include <set>
#include <cstdio>
static bool
tc_active(char const* const scope)

View File

@ -11,6 +11,9 @@
#include <cctype>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <fstream>
#include <iomanip>
@ -21,9 +24,6 @@
#include <set>
#include <sstream>
#include <stdexcept>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#ifndef QPDF_NO_WCHAR_T
# include <cwchar>
#endif

View File

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

View File

@ -3,10 +3,10 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
static void
usage()

View File

@ -1,8 +1,8 @@
#include <qpdf/Pl_ASCII85Decoder.hh>
#include <qpdf/Pl_StdioFile.hh>
#include <iostream>
#include <cstdlib>
#include <iostream>
int
main()

View File

@ -3,8 +3,8 @@
#include <qpdf/Pl_Buffer.hh>
#include <qpdf/QIntC.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <iostream>
// See comments in bits_functions.hh
#define BITS_TESTING 1

View File

@ -4,10 +4,10 @@
#include <qpdf/Pl_Count.hh>
#include <qpdf/Pl_Discard.hh>
#include <qpdf/QUtil.hh>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stdexcept>
#include <cstdlib>
static unsigned char*
uc(char const* s)

View File

@ -1,8 +1,8 @@
#include <qpdf/ClosedFileInputSource.hh>
#include <qpdf/FileInputSource.hh>
#include <iostream>
#include <cstdio>
#include <iostream>
void
check(std::string const& what, bool result)

View File

@ -2,10 +2,10 @@
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
static void
usage()

View File

@ -2,9 +2,9 @@
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iostream>
int
main(int argc, char* argv[])

View File

@ -4,8 +4,8 @@
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <iostream>
void
run(char const* filename)

View File

@ -1,8 +1,8 @@
#include <qpdf/Pl_ASCIIHexDecoder.hh>
#include <qpdf/Pl_StdioFile.hh>
#include <iostream>
#include <cstdlib>
#include <iostream>
int
main()

View File

@ -15,8 +15,7 @@ namespace
void arrayStart() override;
void containerEnd(JSON const& value) override;
void topLevelScalar() override;
bool
dictionaryItem(std::string const& key, JSON const& value) override;
bool dictionaryItem(std::string const& key, JSON const& value) override;
bool arrayItem(JSON const& value) override;
private:

View File

@ -2,9 +2,9 @@
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <iostream>
int
main(int argc, char* argv[])

View File

@ -2,8 +2,8 @@
#include <qpdf/Pl_Discard.hh>
#include <qpdf/Pl_MD5.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <iostream>
static void
test_string(char const* str)

View File

@ -6,9 +6,9 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <iostream>
void
run(char const* filename,

View File

@ -69,11 +69,11 @@ try_range_check_subtract_real(
int
main()
{
uint32_t u1 = 3141592653U; // Too big for signed type
int32_t i1 = -1153374643; // Same bit pattern as u1
uint64_t ul1 = 1099511627776LL; // Too big for 32-bit
uint64_t ul2 = 12345; // Fits into 32-bit
int32_t i2 = 81; // Fits in char and uchar
uint32_t u1 = 3141592653U; // Too big for signed type
int32_t i1 = -1153374643; // Same bit pattern as u1
uint64_t ul1 = 1099511627776LL; // Too big for 32-bit
uint64_t ul2 = 12345; // Fits into 32-bit
int32_t i2 = 81; // Fits in char and uchar
auto c1 = static_cast<signed char>('\xf7'); // Signed value when char
char c2 = 'W'; // char; may be signed or unsigned

View File

@ -3,11 +3,11 @@
#include <qpdf/Pl_Buffer.hh>
#include <qpdf/QPDFSystemError.hh>
#include <qpdf/QUtil.hh>
#include <fstream>
#include <iostream>
#include <climits>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#ifdef _WIN32
# include <io.h>

View File

@ -5,10 +5,10 @@
#include <qpdf/QIntC.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
static void
other_tests()

View File

@ -2,10 +2,10 @@
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
int
main(int argc, char* argv[])

View File

@ -1,7 +1,7 @@
#include <qpdf/Pl_SHA2.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstring>
#include <iostream>
static void
test(

View File

@ -4,10 +4,10 @@
#include <qpdf/QPDFPageDocumentHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
static char const* whoami = nullptr;

View File

@ -26,13 +26,13 @@
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <climits>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <sstream>
#define QPDF_OBJECT_NOWARN
#include <qpdf/QPDFObject.hh>

View File

@ -12,9 +12,9 @@
#include <qpdf/QPDFPageDocumentHelper.hh>
#include <qpdf/QPDFWriter.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <iostream>
// Run "test_large_file write small a.pdf" to get a PDF file that you
// can look at in a reader.

View File

@ -1,8 +1,8 @@
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <iostream>
static char const* whoami = nullptr;

View File

@ -1,8 +1,8 @@
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <iostream>
static char const* whoami = nullptr;

View File

@ -6,10 +6,10 @@
#include <qpdf/QPDFPageDocumentHelper.hh>
#include <qpdf/QPDFTokenizer.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
static char const* whoami = nullptr;
@ -203,8 +203,7 @@ process(char const* filename, bool include_ignorable, size_t max_len)
Pl_Buffer plb("buffer");
page.pipeContents(&plb);
auto content_data = plb.getBufferSharedPointer();
auto* bis =
new BufferInputSource("content data", content_data.get());
auto* bis = new BufferInputSource("content data", content_data.get());
is = std::shared_ptr<InputSource>(bis);
dump_tokens(
is,
@ -220,8 +219,7 @@ process(char const* filename, bool include_ignorable, size_t max_len)
if (obj.isStream() && obj.getDict().getKey("/Type").isName() &&
obj.getDict().getKey("/Type").getName() == "/ObjStm") {
std::shared_ptr<Buffer> b = obj.getStreamData(qpdf_dl_specialized);
auto* bis =
new BufferInputSource("object stream data", b.get());
auto* bis = new BufferInputSource("object stream data", b.get());
is = std::shared_ptr<InputSource>(bis);
dump_tokens(
is,

View File

@ -5,9 +5,9 @@
# include <windows.h>
#endif
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iostream>
static void
do_copy(FILE* in, FILE* out)

View File

@ -3,11 +3,11 @@
#include <qpdf/QPDF.hh>
#include <qpdf/QUtil.hh>
#include <fcntl.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <iostream>
static char const* whoami = nullptr;