Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2538)

Unified Diff: core/fxcodec/codec/fx_codec_fax.cpp

Issue 2572843002: Return unique_ptr<>s from fxcodec/ (Closed)
Patch Set: std::move it Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/fxcodec/codec/fx_codec_fax.cpp
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp
index 5102c778a4adb5da16edab105541850a13b543b2..62ad38e19fe05d8f65d494451cf8bcaa7d004037 100644
--- a/core/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/fxcodec/codec/fx_codec_fax.cpp
@@ -5,10 +5,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include <algorithm>
+#include <memory>
#include <vector>
#include "core/fxcodec/codec/codec_int.h"
#include "core/fxcodec/fx_codec.h"
+#include "third_party/base/ptr_util.h"
namespace {
@@ -580,16 +582,17 @@ void FaxG4Decode(const uint8_t* src_buf,
*pbitpos = bitpos;
}
-CCodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf,
- uint32_t src_size,
- int width,
- int height,
- int K,
- bool EndOfLine,
- bool EncodedByteAlign,
- bool BlackIs1,
- int Columns,
- int Rows) {
+std::unique_ptr<CCodec_ScanlineDecoder> CCodec_FaxModule::CreateDecoder(
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int K,
+ bool EndOfLine,
+ bool EncodedByteAlign,
+ bool BlackIs1,
+ int Columns,
+ int Rows) {
int actual_width = Columns ? Columns : width;
int actual_height = Rows ? Rows : height;
@@ -602,6 +605,7 @@ CCodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf,
return nullptr;
uint32_t pitch = (static_cast<uint32_t>(actual_width) + 31) / 32 * 4;
- return new CCodec_FaxDecoder(src_buf, src_size, actual_width, actual_height,
- pitch, K, EndOfLine, EncodedByteAlign, BlackIs1);
+ return pdfium::MakeUnique<CCodec_FaxDecoder>(
+ src_buf, src_size, actual_width, actual_height, pitch, K, EndOfLine,
+ EncodedByteAlign, BlackIs1);
}

Powered by Google App Engine
This is Rietveld 408576698