mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Reformat code
This commit is contained in:
parent
7836e19747
commit
6c4537885e
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -1552,7 +1552,7 @@ QPDFObjectHandle::getObjGen() const
|
||||
std::string
|
||||
QPDFObjectHandle::getObjGenAsStr() const
|
||||
{
|
||||
return QUtil::int_to_string(this->objid) + " " +
|
||||
return QUtil::int_to_string(this->objid) + " " +
|
||||
QUtil::int_to_string(this->generation);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -1,26 +1,24 @@
|
||||
#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) {
|
||||
std::cout << "p1: " << len << ": " << data << std::endl;
|
||||
});
|
||||
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);
|
||||
|
||||
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) {
|
||||
std::cout << "p2: " << len << ": " << data << std::endl;
|
||||
});
|
||||
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);
|
||||
p2.finish();
|
||||
assert(s == "c2FsYWQ=");
|
||||
|
Loading…
Reference in New Issue
Block a user