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

Reformat code

This commit is contained in:
Jay Berkenbilt 2022-06-25 08:29:07 -04:00
parent 7836e19747
commit 6c4537885e
5 changed files with 19 additions and 18 deletions

View File

@ -88,8 +88,7 @@ main(int argc, char* argv[])
l, qpdf_log_dest_custom, save_to_file, (void*)outfile, 0);
qpdflogger_cleanup(&l);
j = qpdfjob_init();
status = (qpdfjob_initialize_from_argv(j, j_argv) ||
qpdfjob_run(j));
status = (qpdfjob_initialize_from_argv(j, j_argv) || qpdfjob_run(j));
qpdfjob_cleanup(&j);
free(attachment_arg);
fclose(outfile);

View File

@ -465,7 +465,8 @@ QPDFJob::setOutputStreams(std::ostream* out, std::ostream* err)
}
void
QPDFJob::registerProgressReporter(std::function<void(int)> handler) {
QPDFJob::registerProgressReporter(std::function<void(int)> handler)
{
this->m->progress_handler = handler;
}
@ -1239,8 +1240,8 @@ QPDFJob::doJSONPageLabels(Pipeline* p, bool& first, QPDF& pdf)
{
JSON j_labels = JSON::makeArray();
QPDFPageLabelDocumentHelper pldh(pdf);
long long npages = QIntC::to_longlong(
QPDFPageDocumentHelper(pdf).getAllPages().size());
long long npages =
QIntC::to_longlong(QPDFPageDocumentHelper(pdf).getAllPages().size());
if (pldh.hasPageLabels()) {
std::vector<QPDFObjectHandle> labels;
pldh.getLabelsForPageRange(0, npages - 1, 0, labels);

View File

@ -85,7 +85,8 @@ qpdfjob_run(qpdfjob_handle j)
});
}
static int run_with_handle(std::function<int(qpdfjob_handle)> fn)
static int
run_with_handle(std::function<int(qpdfjob_handle)> fn)
{
auto j = qpdfjob_init();
int status = fn(j);
@ -96,7 +97,8 @@ static int run_with_handle(std::function<int(qpdfjob_handle)> fn)
return status;
}
int qpdfjob_run_from_argv(char const* const argv[])
int
qpdfjob_run_from_argv(char const* const argv[])
{
return run_with_handle([argv](qpdfjob_handle j) {
return qpdfjob_initialize_from_argv(j, argv);
@ -113,7 +115,8 @@ qpdfjob_run_from_wide_argv(wchar_t const* const argv[])
}
#endif /* QPDF_NO_WCHAR_T */
int qpdfjob_run_from_json(char const* json)
int
qpdfjob_run_from_json(char const* json)
{
return run_with_handle([json](qpdfjob_handle j) {
return qpdfjob_initialize_from_json(j, json);

View File

@ -1,15 +1,14 @@
#include <qpdf/assert_test.h>
#include <qpdf/Pl_Base64.hh>
#include <qpdf/Pl_Function.hh>
#include <qpdf/Pl_String.hh>
#include <qpdf/Pl_Base64.hh>
#include <iostream>
int
main(int argc, char* argv[])
{
Pl_Function p1(
"p1", nullptr, [](unsigned char const* data, size_t len) {
Pl_Function p1("p1", nullptr, [](unsigned char const* data, size_t len) {
std::cout << "p1: " << len << ": " << data << std::endl;
});
p1.write(reinterpret_cast<unsigned char const*>("potato"), 6);
@ -17,8 +16,7 @@ main(int argc, char* argv[])
std::string s;
Pl_String ps("string", nullptr, s);
Pl_Base64 b("base64", &ps, Pl_Base64::a_encode);
Pl_Function p2(
"p2", &b, [](unsigned char const* data, size_t len) {
Pl_Function p2("p2", &b, [](unsigned char const* data, size_t len) {
std::cout << "p2: " << len << ": " << data << std::endl;
});
p2.write(reinterpret_cast<unsigned char const*>("salad"), 5);