aboutsummaryrefslogtreecommitdiffstats
path: root/libtests
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2023-05-20 14:24:10 +0200
committerm-holger <m-holger@kubitscheck.org>2023-05-20 16:41:40 +0200
commit41ec7eda54e2263eeb1aee4c3a0616c9c2777fb7 (patch)
treecb151a0c0d9eaf79f3f075879751cc89f98d6f4e /libtests
parentd0682f0f609e979ba085d93a1a0d8e0559f739bb (diff)
downloadqpdf-41ec7eda54e2263eeb1aee4c3a0616c9c2777fb7.tar.zst
Use auto when initialializing with new
Diffstat (limited to 'libtests')
-rw-r--r--libtests/aes.cc6
-rw-r--r--libtests/bits.cc2
-rw-r--r--libtests/flate.cc2
-rw-r--r--libtests/pointer_holder.cc4
-rw-r--r--libtests/rc4.cc6
5 files changed, 10 insertions, 10 deletions
diff --git a/libtests/aes.cc b/libtests/aes.cc
index 5ae8152a..a981fc22 100644
--- a/libtests/aes.cc
+++ b/libtests/aes.cc
@@ -74,7 +74,7 @@ main(int argc, char* argv[])
FILE* infile = QUtil::safe_fopen(infilename, "rb");
FILE* outfile = QUtil::safe_fopen(outfilename, "wb");
- unsigned char* key = new unsigned char[keylen];
+ auto* key = new unsigned char[keylen];
for (unsigned int i = 0; i < strlen(hexkey); i += 2) {
char t[3];
t[0] = hexkey[i];
@@ -85,8 +85,8 @@ main(int argc, char* argv[])
key[i / 2] = static_cast<unsigned char>(val);
}
- Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile);
- Pl_AES_PDF* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen);
+ auto* out = new Pl_StdioFile("stdout", outfile);
+ auto* aes = new Pl_AES_PDF("aes_128_cbc", out, encrypt, key, keylen);
delete[] key;
key = nullptr;
if (!cbc_mode) {
diff --git a/libtests/bits.cc b/libtests/bits.cc
index e63ebdd3..af715da8 100644
--- a/libtests/bits.cc
+++ b/libtests/bits.cc
@@ -141,7 +141,7 @@ test()
unsigned char ch = 0;
bit_offset = 7;
- Pl_Buffer* bp = new Pl_Buffer("buffer");
+ auto* bp = new Pl_Buffer("buffer");
test_write_bits(ch, bit_offset, 30UL, 5, bp);
test_write_bits(ch, bit_offset, 10UL, 4, bp);
diff --git a/libtests/flate.cc b/libtests/flate.cc
index 93c41f85..9b64ca67 100644
--- a/libtests/flate.cc
+++ b/libtests/flate.cc
@@ -28,7 +28,7 @@ run(char const* filename)
Pipeline* inf2 = new Pl_Flate("inf2", out2, Pl_Flate::a_inflate);
// Count bytes written to o3
- Pl_Count* count3 = new Pl_Count("count3", out3);
+ auto* count3 = new Pl_Count("count3", out3);
// Do both simultaneously
Pipeline* inf3 = new Pl_Flate("inf3", count3, Pl_Flate::a_inflate);
diff --git a/libtests/pointer_holder.cc b/libtests/pointer_holder.cc
index e5a58d17..4b9d43cb 100644
--- a/libtests/pointer_holder.cc
+++ b/libtests/pointer_holder.cc
@@ -72,7 +72,7 @@ test_ph()
ObjectHolder oh0;
{
std::cout << "hello" << std::endl;
- Object* o1 = new Object;
+ auto* o1 = new Object;
ObjectHolder oh1(o1);
std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl;
ObjectHolder oh2(oh1);
@@ -95,7 +95,7 @@ test_ph()
}
ol1.push_back(oh3);
ol1.push_back(oh3);
- Object* o3 = new Object;
+ auto* o3 = new Object;
oh0 = o3;
PointerHolder<Object const> oh6(new Object());
oh6->hello();
diff --git a/libtests/rc4.cc b/libtests/rc4.cc
index ca4af91d..300c6201 100644
--- a/libtests/rc4.cc
+++ b/libtests/rc4.cc
@@ -41,7 +41,7 @@ main(int argc, char* argv[])
char* outfilename = argv[3];
unsigned int hexkeylen = QIntC::to_uint(strlen(hexkey));
unsigned int keylen = hexkeylen / 2;
- unsigned char* key = new unsigned char[keylen + 1];
+ auto* key = new unsigned char[keylen + 1];
key[keylen] = '\0';
FILE* infile = QUtil::safe_fopen(infilename, "rb");
@@ -56,9 +56,9 @@ main(int argc, char* argv[])
}
FILE* outfile = QUtil::safe_fopen(outfilename, "wb");
- Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile);
+ auto* out = new Pl_StdioFile("stdout", outfile);
// Use a small buffer size (64) for testing
- Pl_RC4* rc4 = new Pl_RC4("rc4", out, key, QIntC::to_int(keylen), 64U);
+ auto* rc4 = new Pl_RC4("rc4", out, key, QIntC::to_int(keylen), 64U);
delete[] key;
// 64 < buffer size < 512, buffer_size is not a power of 2 for testing