summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/chdcodec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/chdcodec.cpp')
-rw-r--r--src/lib/util/chdcodec.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp
index 71763163a87..3f76af302bd 100644
--- a/src/lib/util/chdcodec.cpp
+++ b/src/lib/util/chdcodec.cpp
@@ -8,7 +8,7 @@
***************************************************************************/
-#include <assert.h>
+#include <cassert>
#include "chd.h"
#include "hashing.h"
@@ -124,7 +124,7 @@ class chd_lzma_compressor : public chd_compressor
public:
// construction/destruction
chd_lzma_compressor(chd_file &chd, uint32_t hunkbytes, bool lossy);
- ~chd_lzma_compressor();
+ ~chd_lzma_compressor() = default;
// core functionality
virtual uint32_t compress(const uint8_t *src, uint32_t srclen, uint8_t *dest) override;
@@ -497,15 +497,6 @@ chd_codec::chd_codec(chd_file &chd, uint32_t hunkbytes, bool lossy)
//-------------------------------------------------
-// ~chd_codec - destructor
-//-------------------------------------------------
-
-chd_codec::~chd_codec()
-{
-}
-
-
-//-------------------------------------------------
// configure - configuration
//-------------------------------------------------
@@ -760,7 +751,7 @@ void chd_zlib_allocator::install(z_stream &stream)
voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
{
- chd_zlib_allocator *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
+ auto *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
// compute the size, rounding to the nearest 1k
size = (size * items + 0x3ff) & ~0x3ff;
@@ -778,7 +769,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
}
// alloc a new one and put it into the list
- uint32_t *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
+ auto *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
for (int scan = 0; scan < MAX_ZLIB_ALLOCS; scan++)
if (codec->m_allocptr[scan] == nullptr)
{
@@ -799,7 +790,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
void chd_zlib_allocator::fast_free(voidpf opaque, voidpf address)
{
- chd_zlib_allocator *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
+ auto *codec = reinterpret_cast<chd_zlib_allocator *>(opaque);
// find the hunk
uint32_t *ptr = reinterpret_cast<uint32_t *>(address) - 1;
@@ -980,7 +971,7 @@ chd_lzma_allocator::~chd_lzma_allocator()
void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
{
- chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p);
+ auto *codec = reinterpret_cast<chd_lzma_allocator *>(p);
// compute the size, rounding to the nearest 1k
size = (size + 0x3ff) & ~0x3ff;
@@ -998,7 +989,7 @@ void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
}
// alloc a new one and put it into the list
- uint32_t *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
+ auto *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]);
for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++)
if (codec->m_allocptr[scan] == nullptr)
{
@@ -1022,7 +1013,7 @@ void chd_lzma_allocator::fast_free(void *p, void *address)
if (address == nullptr)
return;
- chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p);
+ auto *codec = reinterpret_cast<chd_lzma_allocator *>(p);
// find the hunk
uint32_t *ptr = reinterpret_cast<uint32_t *>(address) - 1;
@@ -1054,15 +1045,6 @@ chd_lzma_compressor::chd_lzma_compressor(chd_file &chd, uint32_t hunkbytes, bool
//-------------------------------------------------
-// ~chd_lzma_compressor - destructor
-//-------------------------------------------------
-
-chd_lzma_compressor::~chd_lzma_compressor()
-{
-}
-
-
-//-------------------------------------------------
// compress - compress data using the LZMA codec
//-------------------------------------------------