From 41ec7eda54e2263eeb1aee4c3a0616c9c2777fb7 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 20 May 2023 13:24:10 +0100 Subject: Use auto when initialializing with new --- libqpdf/Pl_Buffer.cc | 2 +- libqpdf/QPDF.cc | 4 ++-- libqpdf/QPDFWriter.cc | 4 ++-- libqpdf/QPDF_Array.cc | 2 +- libqpdf/qpdf-c.cc | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'libqpdf') diff --git a/libqpdf/Pl_Buffer.cc b/libqpdf/Pl_Buffer.cc index d942465d..ff200643 100644 --- a/libqpdf/Pl_Buffer.cc +++ b/libqpdf/Pl_Buffer.cc @@ -45,7 +45,7 @@ Pl_Buffer::getBuffer() } auto size = this->m->data.length(); - Buffer* b = new Buffer(size); + auto* b = new Buffer(size); if (size > 0) { unsigned char* p = b->getBuffer(); memcpy(p, this->m->data.data(), size); diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index bc88b5d6..3a4712e0 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -264,7 +264,7 @@ QPDF::create() void QPDF::processFile(char const* filename, char const* password) { - FileInputSource* fi = new FileInputSource(filename); + auto* fi = new FileInputSource(filename); processInputSource(std::shared_ptr(fi), password); } @@ -272,7 +272,7 @@ void QPDF::processFile( 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(fi), password); } diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 56b4e1ef..a5a54cc7 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -997,7 +997,7 @@ void QPDFWriter::activatePipelineStack(PipelinePopper& pp) { 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()); ++this->m->next_stack_id; this->m->pipeline_stack.push_back(c); @@ -1030,7 +1030,7 @@ QPDFWriter::PipelinePopper::~PipelinePopper() qw->m->md5_pipeline = nullptr; } qw->m->pipeline_stack.pop_back(); - Pl_Buffer* buf = dynamic_cast(p); + auto* buf = dynamic_cast(p); if (bp && buf) { *bp = buf->getBufferSharedPointer(); } diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc index 3bd139b1..d0228361 100644 --- a/libqpdf/QPDF_Array.cc +++ b/libqpdf/QPDF_Array.cc @@ -83,7 +83,7 @@ QPDF_Array::copy(bool shallow) return do_create(new QPDF_Array(*this)); } else { if (sparse) { - QPDF_Array* result = new QPDF_Array(); + auto* result = new QPDF_Array(); result->sp_size = sp_size; for (auto const& element: sp_elements) { auto const& obj = element.second; diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc index e7df8ac3..8f36195a 100644 --- a/libqpdf/qpdf-c.cc +++ b/libqpdf/qpdf-c.cc @@ -106,7 +106,7 @@ qpdf_data 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(); return qpdf; } -- cgit v1.2.3-70-g09d2