summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/codec/fx_codec.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index 77dd363c9d..a0356929a5 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -7,6 +7,7 @@
#include "core/fxcodec/include/fx_codec.h"
#include <cmath>
+#include <memory>
#include <utility>
#include "core/fxcodec/codec/codec_int.h"
@@ -397,18 +398,20 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) {
count -= used_bytes;
m_Operator = 257 - count;
}
-ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(
+
+CCodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
int height,
int nComps,
int bpc) {
- CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder;
+ std::unique_ptr<CCodec_RLScanlineDecoder> pRLScanlineDecoder(
+ new CCodec_RLScanlineDecoder);
if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps,
bpc)) {
- delete pRLScanlineDecoder;
- return NULL;
+ return nullptr;
}
- return pRLScanlineDecoder;
+
+ return pRLScanlineDecoder.release();
}