summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/pdf-create.cc48
-rw-r--r--libqpdf/JSON.cc4
-rw-r--r--libqpdf/NNTree.cc4
-rw-r--r--libqpdf/QPDF.cc2
-rw-r--r--libqpdf/QPDFAcroFormDocumentHelper.cc6
-rw-r--r--libqpdf/QPDFJob.cc10
-rw-r--r--libqpdf/QPDFJob_config.cc2
-rw-r--r--libqpdf/QPDFPageDocumentHelper.cc2
-rw-r--r--libqpdf/QPDFPageObjectHelper.cc2
-rw-r--r--libqpdf/QPDFParser.cc4
-rw-r--r--libqpdf/QPDF_Array.cc2
-rw-r--r--libqpdf/QPDF_linearization.cc6
-rw-r--r--libqpdf/QUtil.cc2
-rw-r--r--libqpdf/qpdf-c.cc4
14 files changed, 48 insertions, 50 deletions
diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc
index c793b5f8..7b44fb7f 100644
--- a/examples/pdf-create.cc
+++ b/examples/pdf-create.cc
@@ -50,28 +50,28 @@ ImageProvider::ImageProvider(std::string const& color_space, std::string const&
{
if (color_space == "/DeviceCMYK") {
j_color_space = JCS_CMYK;
- stripes.push_back(std::string("\xff\x00\x00\x00", 4));
- stripes.push_back(std::string("\x00\xff\x00\x00", 4));
- stripes.push_back(std::string("\x00\x00\xff\x00", 4));
- stripes.push_back(std::string("\xff\x00\xff\x00", 4));
- stripes.push_back(std::string("\xff\xff\x00\x00", 4));
- stripes.push_back(std::string("\x00\x00\x00\xff", 4));
+ stripes.emplace_back("\xff\x00\x00\x00", 4);
+ stripes.emplace_back("\x00\xff\x00\x00", 4);
+ stripes.emplace_back("\x00\x00\xff\x00", 4);
+ stripes.emplace_back("\xff\x00\xff\x00", 4);
+ stripes.emplace_back("\xff\xff\x00\x00", 4);
+ stripes.emplace_back("\x00\x00\x00\xff", 4);
} else if (color_space == "/DeviceRGB") {
j_color_space = JCS_RGB;
- stripes.push_back(std::string("\xff\x00\x00", 3));
- stripes.push_back(std::string("\x00\xff\x00", 3));
- stripes.push_back(std::string("\x00\x00\xff", 3));
- stripes.push_back(std::string("\xff\x00\xff", 3));
- stripes.push_back(std::string("\xff\xff\x00", 3));
- stripes.push_back(std::string("\x00\x00\x00", 3));
+ stripes.emplace_back("\xff\x00\x00", 3);
+ stripes.emplace_back("\x00\xff\x00", 3);
+ stripes.emplace_back("\x00\x00\xff", 3);
+ stripes.emplace_back("\xff\x00\xff", 3);
+ stripes.emplace_back("\xff\xff\x00", 3);
+ stripes.emplace_back("\x00\x00\x00", 3);
} else if (color_space == "/DeviceGray") {
j_color_space = JCS_GRAYSCALE;
- stripes.push_back(std::string("\xee", 1));
- stripes.push_back(std::string("\xcc", 1));
- stripes.push_back(std::string("\x99", 1));
- stripes.push_back(std::string("\x66", 1));
- stripes.push_back(std::string("\x33", 1));
- stripes.push_back(std::string("\x00", 1));
+ stripes.emplace_back("\xee", 1);
+ stripes.emplace_back("\xcc", 1);
+ stripes.emplace_back("\x99", 1);
+ stripes.emplace_back("\x66", 1);
+ stripes.emplace_back("\x33", 1);
+ stripes.emplace_back("\x00", 1);
}
}
@@ -335,13 +335,13 @@ create_pdf(char const* filename)
">>"_qpdf);
std::vector<std::string> color_spaces;
- color_spaces.push_back("/DeviceCMYK");
- color_spaces.push_back("/DeviceRGB");
- color_spaces.push_back("/DeviceGray");
+ color_spaces.emplace_back("/DeviceCMYK");
+ color_spaces.emplace_back("/DeviceRGB");
+ color_spaces.emplace_back("/DeviceGray");
std::vector<std::string> filters;
- filters.push_back("null");
- filters.push_back("/DCTDecode");
- filters.push_back("/RunLengthDecode");
+ filters.emplace_back("null");
+ filters.emplace_back("/DCTDecode");
+ filters.emplace_back("/RunLengthDecode");
QPDFPageDocumentHelper dh(pdf);
for (auto const& color_space: color_spaces) {
for (auto const& filter: filters) {
diff --git a/libqpdf/JSON.cc b/libqpdf/JSON.cc
index 27baac03..9e90f61d 100644
--- a/libqpdf/JSON.cc
+++ b/libqpdf/JSON.cc
@@ -1282,7 +1282,7 @@ JSONParser::handleToken()
case ps_top:
if (!(item.isDictionary() || item.isArray())) {
- stack.push_back({ps_done, item});
+ stack.emplace_back(ps_done, item);
parser_state = ps_done;
return;
}
@@ -1311,7 +1311,7 @@ JSONParser::handleToken()
}
if (item.isDictionary() || item.isArray()) {
- stack.push_back({parser_state, item});
+ stack.emplace_back(parser_state, item);
// Calling container start method is postponed until after adding the containers to their
// parent containers, if any. This makes it much easier to keep track of the current nesting
// level.
diff --git a/libqpdf/NNTree.cc b/libqpdf/NNTree.cc
index 9d0cf9a9..02881e99 100644
--- a/libqpdf/NNTree.cc
+++ b/libqpdf/NNTree.cc
@@ -319,7 +319,7 @@ NNTreeIterator::split(QPDFObjectHandle to_split, std::list<PathElement>::iterato
auto next = this->path.begin();
next->node = first_node;
}
- this->path.push_front(PathElement(to_split, 0));
+ this->path.emplace_front(to_split, 0);
parent = this->path.begin();
to_split = first_node;
}
@@ -578,7 +578,7 @@ NNTreeIterator::setItemNumber(QPDFObjectHandle const& node, int n)
void
NNTreeIterator::addPathElement(QPDFObjectHandle const& node, int kid_number)
{
- this->path.push_back(PathElement(node, kid_number));
+ this->path.emplace_back(node, kid_number);
}
bool
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 1707720f..460148b3 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -840,7 +840,7 @@ QPDF::read_xrefTable(qpdf_offset_t xref_offset)
}
if (type == 'f') {
// Save deleted items until after we've checked the XRefStm, if any.
- deleted_items.push_back(QPDFObjGen(toI(i), f2));
+ deleted_items.emplace_back(toI(i), f2);
} else {
insertXrefEntry(toI(i), 1, f1, f2);
}
diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc
index aca4bf1f..aefe8d6b 100644
--- a/libqpdf/QPDFAcroFormDocumentHelper.cc
+++ b/libqpdf/QPDFAcroFormDocumentHelper.cc
@@ -165,7 +165,7 @@ QPDFAcroFormDocumentHelper::getFormFields()
analyze();
std::vector<QPDFFormFieldObjectHelper> result;
for (auto const& iter: m->field_to_annotations) {
- result.push_back(this->qpdf.getObject(iter.first));
+ result.emplace_back(this->qpdf.getObject(iter.first));
}
return result;
}
@@ -279,7 +279,7 @@ QPDFAcroFormDocumentHelper::analyze()
annot.warnIfPossible("this widget annotation is not"
" reachable from /AcroForm in the document catalog");
m->annotation_to_field[og] = QPDFFormFieldObjectHelper(annot);
- m->field_to_annotations[og].push_back(QPDFAnnotationObjectHelper(annot));
+ m->field_to_annotations[og].emplace_back(annot);
}
}
}
@@ -342,7 +342,7 @@ QPDFAcroFormDocumentHelper::traverseField(
if (is_annotation) {
QPDFObjectHandle our_field = (is_field ? field : parent);
- m->field_to_annotations[our_field.getObjGen()].push_back(QPDFAnnotationObjectHelper(field));
+ m->field_to_annotations[our_field.getObjGen()].emplace_back(field);
m->annotation_to_field[og] = QPDFFormFieldObjectHelper(our_field);
}
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index 0f480723..c33c4b70 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -2376,9 +2376,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea
// Read original pages from the PDF, and parse the page range associated with this
// occurrence of the file.
- parsed_specs.push_back(
- // line-break
- QPDFPageData(page_spec.filename, page_spec_qpdfs[page_spec.filename], page_spec.range));
+ parsed_specs.emplace_back(
+ page_spec.filename, page_spec_qpdfs[page_spec.filename], page_spec.range);
}
std::map<unsigned long long, bool> remove_unreferenced;
@@ -2427,9 +2426,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea
for (size_t j = 0; j < m->collate; ++j) {
if (cur_page + j < page_data.selected_pages.size()) {
got_pages = true;
- new_parsed_specs.push_back(
- // line-break
- QPDFPageData(page_data, page_data.selected_pages.at(cur_page + j)));
+ new_parsed_specs.emplace_back(
+ page_data, page_data.selected_pages.at(cur_page + j));
}
}
}
diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc
index e847bcd4..834de9ab 100644
--- a/libqpdf/QPDFJob_config.cc
+++ b/libqpdf/QPDFJob_config.cc
@@ -942,7 +942,7 @@ QPDFJob::PagesConfig*
QPDFJob::PagesConfig::pageSpec(
std::string const& filename, std::string const& range, char const* password)
{
- this->config->o.m->page_specs.push_back(QPDFJob::PageSpec(filename, password, range));
+ this->config->o.m->page_specs.emplace_back(filename, password, range);
return this;
}
diff --git a/libqpdf/QPDFPageDocumentHelper.cc b/libqpdf/QPDFPageDocumentHelper.cc
index 3811d7dd..c9c2cf52 100644
--- a/libqpdf/QPDFPageDocumentHelper.cc
+++ b/libqpdf/QPDFPageDocumentHelper.cc
@@ -14,7 +14,7 @@ QPDFPageDocumentHelper::getAllPages()
{
std::vector<QPDFPageObjectHelper> pages;
for (auto const& iter: this->qpdf.getAllPages()) {
- pages.push_back(QPDFPageObjectHelper(iter));
+ pages.emplace_back(iter);
}
return pages;
}
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc
index 65955e8b..44ffd2cf 100644
--- a/libqpdf/QPDFPageObjectHelper.cc
+++ b/libqpdf/QPDFPageObjectHelper.cc
@@ -451,7 +451,7 @@ QPDFPageObjectHelper::getAnnotations(std::string const& only_subtype)
for (int i = 0; i < nannots; ++i) {
QPDFObjectHandle annot = annots.getArrayItem(i);
if (annot.isDictionaryOfType("", only_subtype)) {
- result.push_back(QPDFAnnotationObjectHelper(annot));
+ result.emplace_back(annot);
}
}
}
diff --git a/libqpdf/QPDFParser.cc b/libqpdf/QPDFParser.cc
index 48227e55..6dcbddb5 100644
--- a/libqpdf/QPDFParser.cc
+++ b/libqpdf/QPDFParser.cc
@@ -55,7 +55,7 @@ QPDFParser::parse(bool& empty, bool content_stream)
bool set_offset = false;
std::vector<StackFrame> stack;
- stack.push_back(StackFrame(input));
+ stack.emplace_back(input);
std::vector<parser_state_e> state_stack;
state_stack.push_back(st_top);
qpdf_offset_t offset;
@@ -141,7 +141,7 @@ QPDFParser::parse(bool& empty, bool content_stream)
(tokenizer.getType() == QPDFTokenizer::tt_array_open) ? st_array
: st_dictionary);
b_contents = false;
- stack.push_back(StackFrame(input));
+ stack.emplace_back(input);
}
break;
diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc
index 1b78e078..b5b182af 100644
--- a/libqpdf/QPDF_Array.cc
+++ b/libqpdf/QPDF_Array.cc
@@ -201,7 +201,7 @@ QPDF_Array::getAsVector() const
v.reserve(size_t(size()));
for (auto const& item: sp_elements) {
v.resize(size_t(item.first), null_oh);
- v.push_back(item.second);
+ v.emplace_back(item.second);
}
v.resize(size_t(size()), null_oh);
return v;
diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc
index faebf5b6..fe25c6d9 100644
--- a/libqpdf/QPDF_linearization.cc
+++ b/libqpdf/QPDF_linearization.cc
@@ -1367,7 +1367,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
for (auto& oh: m->part6) {
int obj = oh.getObjectID();
obj_to_index[obj] = toI(shared.size());
- shared.push_back(CHSharedObjectEntry(obj));
+ shared.emplace_back(obj);
}
QTC::TC("qpdf", "QPDF lin part 8 empty", m->part8.empty() ? 1 : 0);
if (!m->part8.empty()) {
@@ -1375,7 +1375,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
for (auto& oh: m->part8) {
int obj = oh.getObjectID();
obj_to_index[obj] = toI(shared.size());
- shared.push_back(CHSharedObjectEntry(obj));
+ shared.emplace_back(obj);
}
}
if (static_cast<size_t>(m->c_shared_object_data.nshared_total) !=
@@ -1585,7 +1585,7 @@ QPDF::calculateHSharedObject(
int length = outputLengthNextN(csoe.at(i).object, 1, lengths, obj_renumber);
min_length = std::min(min_length, length);
max_length = std::max(max_length, length);
- soe.push_back(HSharedObjectEntry());
+ soe.emplace_back();
soe.at(i).delta_group_length = length;
}
if (soe.size() != toS(cso.nshared_total)) {
diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc
index 46347a90..09f99529 100644
--- a/libqpdf/QUtil.cc
+++ b/libqpdf/QUtil.cc
@@ -1246,7 +1246,7 @@ QUtil::read_lines_from_file(
char c;
while (next_char(c)) {
if (buf == nullptr) {
- lines.push_back("");
+ lines.emplace_back("");
buf = &(lines.back());
buf->reserve(80);
}
diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc
index fe2a608e..1f7b85cb 100644
--- a/libqpdf/qpdf-c.cc
+++ b/libqpdf/qpdf-c.cc
@@ -813,13 +813,13 @@ trap_oh_errors(qpdf_data qpdf, std::function<RET()> fallback, std::function<RET(
if (!qpdf->silence_errors) {
QTC::TC("qpdf", "qpdf-c warn about oh error", qpdf->oh_error_occurred ? 0 : 1);
if (!qpdf->oh_error_occurred) {
- qpdf->warnings.push_back(QPDFExc(
+ qpdf->warnings.emplace_back(
qpdf_e_internal,
qpdf->qpdf->getFilename(),
"",
0,
"C API function caught an exception that it isn't returning; please point the "
- "application developer to ERROR HANDLING in qpdf-c.h"));
+ "application developer to ERROR HANDLING in qpdf-c.h");
qpdf->oh_error_occurred = true;
}
*QPDFLogger::defaultLogger()->getError() << qpdf->error->what() << "\n";