Convert pdfium::MakeUnique<> to std::make_unique<> in fxcodec
Use C++14 features.
-- ensure <memory> included in .cpp or corresponding .h file
-- remove ptr_util.h include unless WrapUnique() (2 cases).
Change-Id: I7c022bab5f06f84ed21486b6ccaf58908b381518
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70010
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcodec/basic/basicmodule.cpp b/core/fxcodec/basic/basicmodule.cpp
index d495454..0ba2a12 100644
--- a/core/fxcodec/basic/basicmodule.cpp
+++ b/core/fxcodec/basic/basicmodule.cpp
@@ -9,7 +9,6 @@
#include "core/fxcodec/scanlinedecoder.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "third_party/base/ptr_util.h"
namespace fxcodec {
@@ -204,7 +203,7 @@
int height,
int nComps,
int bpc) {
- auto pDecoder = pdfium::MakeUnique<RLScanlineDecoder>();
+ auto pDecoder = std::make_unique<RLScanlineDecoder>();
if (!pDecoder->Create(src_buf, width, height, nComps, bpc))
return nullptr;
diff --git a/core/fxcodec/bmp/bmp_decoder.cpp b/core/fxcodec/bmp/bmp_decoder.cpp
index 64cac78..4417626 100644
--- a/core/fxcodec/bmp/bmp_decoder.cpp
+++ b/core/fxcodec/bmp/bmp_decoder.cpp
@@ -13,14 +13,13 @@
#include "core/fxcodec/fx_codec.h"
#include "core/fxcodec/fx_codec_def.h"
#include "core/fxge/fx_dib.h"
-#include "third_party/base/ptr_util.h"
namespace fxcodec {
// static
std::unique_ptr<ProgressiveDecoderIface::Context> BmpDecoder::StartDecode(
Delegate* pDelegate) {
- return pdfium::MakeUnique<CFX_BmpContext>(pDelegate);
+ return std::make_unique<CFX_BmpContext>(pDelegate);
}
// static
diff --git a/core/fxcodec/fax/faxmodule.cpp b/core/fxcodec/fax/faxmodule.cpp
index 22ba764..6bb89be 100644
--- a/core/fxcodec/fax/faxmodule.cpp
+++ b/core/fxcodec/fax/faxmodule.cpp
@@ -17,7 +17,6 @@
#include "core/fxcrt/cfx_binarybuf.h"
#include "core/fxcrt/fx_memory_wrappers.h"
#include "third_party/base/logging.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
namespace fxcodec {
@@ -596,9 +595,8 @@
return nullptr;
}
- return pdfium::MakeUnique<FaxDecoder>(src_span, actual_width, actual_height,
- K, EndOfLine, EncodedByteAlign,
- BlackIs1);
+ return std::make_unique<FaxDecoder>(src_span, actual_width, actual_height, K,
+ EndOfLine, EncodedByteAlign, BlackIs1);
}
// static
diff --git a/core/fxcodec/flate/flatemodule.cpp b/core/fxcodec/flate/flatemodule.cpp
index 9663df3..279b6e5 100644
--- a/core/fxcodec/flate/flatemodule.cpp
+++ b/core/fxcodec/flate/flatemodule.cpp
@@ -17,7 +17,6 @@
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_memory_wrappers.h"
#include "third_party/base/numerics/safe_conversions.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/span.h"
#if defined(USE_SYSTEM_ZLIB)
@@ -793,10 +792,10 @@
int Columns) {
PredictorType predictor_type = GetPredictor(predictor);
if (predictor_type == PredictorType::kNone) {
- return pdfium::MakeUnique<FlateScanlineDecoder>(src_span, width, height,
- nComps, bpc);
+ return std::make_unique<FlateScanlineDecoder>(src_span, width, height,
+ nComps, bpc);
}
- return pdfium::MakeUnique<FlatePredictorScanlineDecoder>(
+ return std::make_unique<FlatePredictorScanlineDecoder>(
src_span, width, height, nComps, bpc, predictor_type, Colors,
BitsPerComponent, Columns);
}
@@ -818,7 +817,7 @@
PredictorType predictor_type = GetPredictor(predictor);
if (bLZW) {
- auto decoder = pdfium::MakeUnique<CLZWDecoder>(src_span, bEarlyChange);
+ auto decoder = std::make_unique<CLZWDecoder>(src_span, bEarlyChange);
if (!decoder->Decode())
return FX_INVALID_OFFSET;
diff --git a/core/fxcodec/gif/cfx_gifcontext.cpp b/core/fxcodec/gif/cfx_gifcontext.cpp
index c946747..d78f47a 100644
--- a/core/fxcodec/gif/cfx_gifcontext.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext.cpp
@@ -10,7 +10,6 @@
#include <utility>
#include "core/fxcodec/cfx_codec_memory.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
namespace fxcodec {
@@ -438,7 +437,7 @@
if (!graphic_control_extension_.get())
graphic_control_extension_ =
- pdfium::MakeUnique<CFX_GifGraphicControlExtension>();
+ std::make_unique<CFX_GifGraphicControlExtension>();
graphic_control_extension_->block_size = gif_gce.block_size;
graphic_control_extension_->gce_flags = gif_gce.gce_flags;
graphic_control_extension_->delay_time =
@@ -469,7 +468,7 @@
if (!ReadAllOrNone(reinterpret_cast<uint8_t*>(&img_info), sizeof(img_info)))
return CFX_GifDecodeStatus::Unfinished;
- auto gif_image = pdfium::MakeUnique<CFX_GifImage>();
+ auto gif_image = std::make_unique<CFX_GifImage>();
gif_image->image_info.left =
FXWORD_GET_LSBFIRST(reinterpret_cast<uint8_t*>(&img_info.left));
gif_image->image_info.top =
diff --git a/core/fxcodec/gif/gif_decoder.cpp b/core/fxcodec/gif/gif_decoder.cpp
index 00831ca..24a7b37 100644
--- a/core/fxcodec/gif/gif_decoder.cpp
+++ b/core/fxcodec/gif/gif_decoder.cpp
@@ -10,14 +10,13 @@
#include "core/fxcodec/fx_codec.h"
#include "core/fxcodec/gif/cfx_gifcontext.h"
#include "core/fxge/fx_dib.h"
-#include "third_party/base/ptr_util.h"
namespace fxcodec {
// static
std::unique_ptr<ProgressiveDecoderIface::Context> GifDecoder::StartDecode(
Delegate* pDelegate) {
- return pdfium::MakeUnique<CFX_GifContext>(pDelegate);
+ return std::make_unique<CFX_GifContext>(pDelegate);
}
// static
diff --git a/core/fxcodec/icc/iccmodule.cpp b/core/fxcodec/icc/iccmodule.cpp
index 87654c5..1a062ad 100644
--- a/core/fxcodec/icc/iccmodule.cpp
+++ b/core/fxcodec/icc/iccmodule.cpp
@@ -11,7 +11,6 @@
#include <vector>
#include "core/fxcrt/fx_memory_wrappers.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
namespace fxcodec {
@@ -105,8 +104,7 @@
if (!hTransform)
return nullptr;
- return pdfium::MakeUnique<CLcmsCmm>(hTransform, nSrcComponents, bLab,
- bNormal);
+ return std::make_unique<CLcmsCmm>(hTransform, nSrcComponents, bLab, bNormal);
}
// static
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index cfdeec4..d1afaf6 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -70,7 +70,7 @@
uint32_t dwObjNum,
std::list<CJBig2_CachePair>* pSymbolDictCache,
bool bIsGlobal)
- : m_pStream(pdfium::MakeUnique<CJBig2_BitStream>(pSrcSpan, dwObjNum)),
+ : m_pStream(std::make_unique<CJBig2_BitStream>(pSrcSpan, dwObjNum)),
m_HuffmanTables(CJBig2_HuffmanTable::kNumHuffmanTables),
m_bIsGlobal(bIsGlobal),
m_pSymbolDictCache(pSymbolDictCache) {}
@@ -84,7 +84,7 @@
while (m_pStream->getByteLeft() >= JBIG2_MIN_SEGMENT_SIZE) {
JBig2_Result nRet;
if (!m_pSegment) {
- m_pSegment = pdfium::MakeUnique<CJBig2_Segment>();
+ m_pSegment = std::make_unique<CJBig2_Segment>();
nRet = ParseSegmentHeader(m_pSegment.get());
if (nRet != JBig2_Result::kSuccess) {
m_pSegment.reset();
@@ -139,7 +139,7 @@
}
}
m_PauseStep = 0;
- m_pPage = pdfium::MakeUnique<CJBig2_Image>(width, height, stride, pBuf);
+ m_pPage = std::make_unique<CJBig2_Image>(width, height, stride, pBuf);
m_bBufSpecified = true;
if (pPause && pPause->NeedToPauseNow()) {
m_PauseStep = 1;
@@ -319,7 +319,7 @@
return ParseGenericRefinementRegion(pSegment);
case 48: {
uint16_t wTemp;
- auto pPageInfo = pdfium::MakeUnique<JBig2PageInfo>();
+ auto pPageInfo = std::make_unique<JBig2PageInfo>();
if (m_pStream->readInteger(&pPageInfo->m_dwWidth) != 0 ||
m_pStream->readInteger(&pPageInfo->m_dwHeight) != 0 ||
m_pStream->readInteger(&pPageInfo->m_dwResolutionX) != 0 ||
@@ -337,8 +337,7 @@
if (!m_bBufSpecified) {
uint32_t height =
bMaxHeight ? pPageInfo->m_wMaxStripeSize : pPageInfo->m_dwHeight;
- m_pPage =
- pdfium::MakeUnique<CJBig2_Image>(pPageInfo->m_dwWidth, height);
+ m_pPage = std::make_unique<CJBig2_Image>(pPageInfo->m_dwWidth, height);
}
if (!m_pPage->data()) {
@@ -378,7 +377,7 @@
if (m_pStream->readShortInteger(&wFlags) != 0)
return JBig2_Result::kFailure;
- auto pSymbolDictDecoder = pdfium::MakeUnique<CJBig2_SDDProc>();
+ auto pSymbolDictDecoder = std::make_unique<CJBig2_SDDProc>();
pSymbolDictDecoder->SDHUFF = wFlags & 0x0001;
pSymbolDictDecoder->SDREFAGG = (wFlags >> 1) & 0x0001;
pSymbolDictDecoder->SDTEMPLATE = (wFlags >> 10) & 0x0003;
@@ -535,7 +534,7 @@
if (!cache_hit) {
if (bUseGbContext) {
auto pArithDecoder =
- pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
+ std::make_unique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_SymbolDict = pSymbolDictDecoder->DecodeArith(
pArithDecoder.get(), &gbContext, &grContext);
if (!pSegment->m_SymbolDict)
@@ -580,7 +579,7 @@
if (!CJBig2_Image::IsValidImageSize(ri.width, ri.height))
return JBig2_Result::kFailure;
- auto pTRD = pdfium::MakeUnique<CJBig2_TRDProc>();
+ auto pTRD = std::make_unique<CJBig2_TRDProc>();
pTRD->SBW = ri.width;
pTRD->SBH = ri.height;
pTRD->SBHUFF = wFlags & 0x0001;
@@ -779,8 +778,7 @@
grContext.reset(FX_Alloc(JBig2ArithCtx, size));
}
if (pTRD->SBHUFF == 0) {
- auto pArithDecoder =
- pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
+ auto pArithDecoder = std::make_unique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_nResultType = JBIG2_IMAGE_POINTER;
pSegment->m_Image =
pTRD->DecodeArith(pArithDecoder.get(), grContext.get(), nullptr);
@@ -813,7 +811,7 @@
JBig2_Result CJBig2_Context::ParsePatternDict(CJBig2_Segment* pSegment,
PauseIndicatorIface* pPause) {
uint8_t cFlags;
- auto pPDD = pdfium::MakeUnique<CJBig2_PDDProc>();
+ auto pPDD = std::make_unique<CJBig2_PDDProc>();
if (m_pStream->read1Byte(&cFlags) != 0 ||
m_pStream->read1Byte(&pPDD->HDPW) != 0 ||
m_pStream->read1Byte(&pPDD->HDPH) != 0 ||
@@ -830,8 +828,7 @@
const size_t size = GetHuffContextSize(pPDD->HDTEMPLATE);
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext(
FX_Alloc(JBig2ArithCtx, size));
- auto pArithDecoder =
- pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
+ auto pArithDecoder = std::make_unique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_PatternDict =
pPDD->DecodeArith(pArithDecoder.get(), gbContext.get(), pPause);
if (!pSegment->m_PatternDict)
@@ -852,7 +849,7 @@
PauseIndicatorIface* pPause) {
uint8_t cFlags;
JBig2RegionInfo ri;
- auto pHRD = pdfium::MakeUnique<CJBig2_HTRDProc>();
+ auto pHRD = std::make_unique<CJBig2_HTRDProc>();
if (ParseRegionInfo(&ri) != JBig2_Result::kSuccess ||
m_pStream->read1Byte(&cFlags) != 0 ||
m_pStream->readInteger(&pHRD->HGW) != 0 ||
@@ -898,8 +895,7 @@
const size_t size = GetHuffContextSize(pHRD->HTEMPLATE);
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext(
FX_Alloc(JBig2ArithCtx, size));
- auto pArithDecoder =
- pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
+ auto pArithDecoder = std::make_unique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_Image =
pHRD->DecodeArith(pArithDecoder.get(), gbContext.get(), pPause);
if (!pSegment->m_Image)
@@ -931,7 +927,7 @@
JBig2_Result CJBig2_Context::ParseGenericRegion(CJBig2_Segment* pSegment,
PauseIndicatorIface* pPause) {
if (!m_pGRD) {
- auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
+ auto pGRD = std::make_unique<CJBig2_GRDProc>();
uint8_t cFlags;
if (ParseRegionInfo(&m_ri) != JBig2_Result::kSuccess ||
m_pStream->read1Byte(&cFlags) != 0) {
@@ -967,8 +963,7 @@
bool bStart = !m_pArithDecoder;
if (bStart) {
- m_pArithDecoder =
- pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
+ m_pArithDecoder = std::make_unique<CJBig2_ArithDecoder>(m_pStream.get());
}
{
// |state.gbContext| can't exist when m_gbContext.clear() called below.
@@ -1044,7 +1039,7 @@
if (!CJBig2_Image::IsValidImageSize(ri.width, ri.height))
return JBig2_Result::kFailure;
- auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
+ auto pGRRD = std::make_unique<CJBig2_GRRDProc>();
pGRRD->GRW = ri.width;
pGRRD->GRH = ri.height;
pGRRD->GRTEMPLATE = !!(cFlags & 0x01);
@@ -1080,7 +1075,7 @@
const size_t size = GetRefAggContextSize(pGRRD->GRTEMPLATE);
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> grContext(
FX_Alloc(JBig2ArithCtx, size));
- auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
+ auto pArithDecoder = std::make_unique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_nResultType = JBIG2_IMAGE_POINTER;
pSegment->m_Image = pGRRD->Decode(pArithDecoder.get(), grContext.get());
if (!pSegment->m_Image)
@@ -1106,7 +1101,7 @@
JBig2_Result CJBig2_Context::ParseTable(CJBig2_Segment* pSegment) {
pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER;
pSegment->m_HuffmanTable.reset();
- auto pHuff = pdfium::MakeUnique<CJBig2_HuffmanTable>(m_pStream.get());
+ auto pHuff = std::make_unique<CJBig2_HuffmanTable>(m_pStream.get());
if (!pHuff->IsOK())
return JBig2_Result::kFailure;
@@ -1203,7 +1198,7 @@
ASSERT(idx > 0);
ASSERT(idx < CJBig2_HuffmanTable::kNumHuffmanTables);
if (!m_HuffmanTables[idx].get())
- m_HuffmanTables[idx] = pdfium::MakeUnique<CJBig2_HuffmanTable>(idx);
+ m_HuffmanTables[idx] = std::make_unique<CJBig2_HuffmanTable>(idx);
return m_HuffmanTables[idx].get();
}
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
index df6e207..4299e8e 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
@@ -15,7 +15,6 @@
#include "core/fxcodec/jbig2/JBig2_BitStream.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
#include "core/fxcrt/pauseindicator_iface.h"
-#include "third_party/base/ptr_util.h"
namespace {
@@ -63,7 +62,7 @@
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
if (!CJBig2_Image::IsValidImageSize(GBW, GBH))
- return pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
+ return std::make_unique<CJBig2_Image>(GBW, GBH);
switch (GBTEMPLATE) {
case 0:
@@ -89,7 +88,7 @@
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext,
int OPT) {
- auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
+ auto GBREG = std::make_unique<CJBig2_Image>(GBW, GBH);
if (!GBREG->data())
return nullptr;
@@ -195,7 +194,7 @@
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext,
int UNOPT) {
- auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
+ auto GBREG = std::make_unique<CJBig2_Image>(GBW, GBH);
if (!GBREG->data())
return nullptr;
@@ -256,7 +255,7 @@
std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate3Opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
- auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
+ auto GBREG = std::make_unique<CJBig2_Image>(GBW, GBH);
if (!GBREG->data())
return nullptr;
@@ -341,7 +340,7 @@
std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate3Unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
- auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
+ auto GBREG = std::make_unique<CJBig2_Image>(GBW, GBH);
if (!GBREG->data())
return nullptr;
@@ -393,7 +392,7 @@
m_ProssiveStatus = FXCODEC_STATUS_DECODE_READY;
std::unique_ptr<CJBig2_Image>* pImage = pState->pImage;
if (!*pImage)
- *pImage = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
+ *pImage = std::make_unique<CJBig2_Image>(GBW, GBH);
if (!(*pImage)->data()) {
*pImage = nullptr;
m_ProssiveStatus = FXCODEC_STATUS_ERROR;
@@ -451,7 +450,7 @@
FXCODEC_STATUS CJBig2_GRDProc::StartDecodeMMR(
std::unique_ptr<CJBig2_Image>* pImage,
CJBig2_BitStream* pStream) {
- auto image = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
+ auto image = std::make_unique<CJBig2_Image>(GBW, GBH);
if (!image->data()) {
*pImage = nullptr;
m_ProssiveStatus = FXCODEC_STATUS_ERROR;
diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
index e673776..d1172ae 100644
--- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
@@ -11,7 +11,6 @@
#include "core/fxcodec/jbig2/JBig2_ArithDecoder.h"
#include "core/fxcodec/jbig2/JBig2_BitStream.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
-#include "third_party/base/ptr_util.h"
CJBig2_GRRDProc::CJBig2_GRRDProc() = default;
@@ -21,7 +20,7 @@
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
if (!CJBig2_Image::IsValidImageSize(GRW, GRH))
- return pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
+ return std::make_unique<CJBig2_Image>(GRW, GRH);
if (!GRTEMPLATE) {
if ((GRAT[0] == -1) && (GRAT[1] == -1) && (GRAT[2] == -1) &&
@@ -41,7 +40,7 @@
std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
- auto GRREG = pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
+ auto GRREG = std::make_unique<CJBig2_Image>(GRW, GRH);
if (!GRREG->data())
return nullptr;
@@ -149,7 +148,7 @@
int32_t iGRW = static_cast<int32_t>(GRW);
int32_t iGRH = static_cast<int32_t>(GRH);
- auto GRREG = pdfium::MakeUnique<CJBig2_Image>(iGRW, iGRH);
+ auto GRREG = std::make_unique<CJBig2_Image>(iGRW, iGRH);
if (!GRREG->data())
return nullptr;
@@ -282,7 +281,7 @@
std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
- auto GRREG = pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
+ auto GRREG = std::make_unique<CJBig2_Image>(GRW, GRH);
if (!GRREG->data())
return nullptr;
@@ -396,7 +395,7 @@
int32_t iGRW = static_cast<int32_t>(GRW);
int32_t iGRH = static_cast<int32_t>(GRH);
- auto GRREG = pdfium::MakeUnique<CJBig2_Image>(iGRW, iGRH);
+ auto GRREG = std::make_unique<CJBig2_Image>(iGRW, iGRH);
if (!GRREG->data())
return nullptr;
diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
index 59fbd89..6eaed7d 100644
--- a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
@@ -12,7 +12,6 @@
#include "core/fxcodec/jbig2/JBig2_BitStream.h"
#include "core/fxcodec/jbig2/JBig2_GrdProc.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
-#include "third_party/base/ptr_util.h"
std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeArith(
CJBig2_ArithDecoder* pArithDecoder,
@@ -20,7 +19,7 @@
PauseIndicatorIface* pPause) {
std::unique_ptr<CJBig2_Image> HSKIP;
if (HENABLESKIP == 1) {
- HSKIP = pdfium::MakeUnique<CJBig2_Image>(HGW, HGH);
+ HSKIP = std::make_unique<CJBig2_Image>(HGW, HGH);
for (uint32_t mg = 0; mg < HGH; ++mg) {
for (uint32_t ng = 0; ng < HGW; ++ng) {
int32_t x = (HGX + mg * HRY + ng * HRX) >> 8;
@@ -116,7 +115,7 @@
std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeImage(
const std::vector<std::unique_ptr<CJBig2_Image>>& GSPLANES) {
- auto HTREG = pdfium::MakeUnique<CJBig2_Image>(HBW, HBH);
+ auto HTREG = std::make_unique<CJBig2_Image>(HBW, HBH);
if (!HTREG->data())
return nullptr;
diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp
index 76705ed..58fe4fb 100644
--- a/core/fxcodec/jbig2/JBig2_Image.cpp
+++ b/core/fxcodec/jbig2/JBig2_Image.cpp
@@ -15,7 +15,6 @@
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "third_party/base/ptr_util.h"
#define JBIG2_GETDWORD(buf) \
((static_cast<uint32_t>((buf)[0]) << 24) | \
@@ -192,7 +191,7 @@
int32_t y,
int32_t w,
int32_t h) {
- auto pImage = pdfium::MakeUnique<CJBig2_Image>(w, h);
+ auto pImage = std::make_unique<CJBig2_Image>(w, h);
if (!pImage->data() || !m_pData)
return pImage;
diff --git a/core/fxcodec/jbig2/JBig2_Image_unittest.cpp b/core/fxcodec/jbig2/JBig2_Image_unittest.cpp
index 13e6eb5..99017d4 100644
--- a/core/fxcodec/jbig2/JBig2_Image_unittest.cpp
+++ b/core/fxcodec/jbig2/JBig2_Image_unittest.cpp
@@ -4,11 +4,11 @@
// TODO(tsepez) this requires a lot more testing.
+#include "core/fxcodec/jbig2/JBig2_Image.h"
+
#include <stdint.h>
-#include "core/fxcodec/jbig2/JBig2_Image.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/ptr_util.h"
namespace {
@@ -162,7 +162,7 @@
}
TEST(fxcodec, JBig2EmptyImage) {
- auto empty = pdfium::MakeUnique<CJBig2_Image>(0, 0);
+ auto empty = std::make_unique<CJBig2_Image>(0, 0);
// Empty subimage.
auto sub1 = empty->SubImage(0, 0, 0, 0);
@@ -229,24 +229,24 @@
};
// Image size a nice clean power of two.
- auto img32 = pdfium::MakeUnique<CJBig2_Image>(
+ auto img32 = std::make_unique<CJBig2_Image>(
32, 5, 8, reinterpret_cast<uint8_t*>(pattern));
// Image size not a nice clean value.
- auto img37 = pdfium::MakeUnique<CJBig2_Image>(
+ auto img37 = std::make_unique<CJBig2_Image>(
37, 5, 8, reinterpret_cast<uint8_t*>(pattern));
// Expected results to check against.
- auto expected20 = pdfium::MakeUnique<CJBig2_Image>(
+ auto expected20 = std::make_unique<CJBig2_Image>(
30, 5, 8, reinterpret_cast<uint8_t*>(pattern20));
- auto expected22 = pdfium::MakeUnique<CJBig2_Image>(
+ auto expected22 = std::make_unique<CJBig2_Image>(
30, 5, 8, reinterpret_cast<uint8_t*>(pattern22));
- auto expected161 = pdfium::MakeUnique<CJBig2_Image>(
+ auto expected161 = std::make_unique<CJBig2_Image>(
25, 5, 8, reinterpret_cast<uint8_t*>(pattern161));
- auto expected_zeros = pdfium::MakeUnique<CJBig2_Image>(32, 5);
+ auto expected_zeros = std::make_unique<CJBig2_Image>(32, 5);
// Empty subimage.
auto sub = img32->SubImage(0, 0, 0, 0);
@@ -328,10 +328,10 @@
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
};
- auto img = pdfium::MakeUnique<CJBig2_Image>(
+ auto img = std::make_unique<CJBig2_Image>(
37, 3, 8, reinterpret_cast<uint8_t*>(pattern));
- auto expected = pdfium::MakeUnique<CJBig2_Image>(
+ auto expected = std::make_unique<CJBig2_Image>(
37, 3, 8, reinterpret_cast<uint8_t*>(expected_pattern));
// Shuffle.
diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp
index 9d274f9..f88c117 100644
--- a/core/fxcodec/jbig2/JBig2_PddProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp
@@ -11,7 +11,6 @@
#include "core/fxcodec/jbig2/JBig2_GrdProc.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
#include "core/fxcodec/jbig2/JBig2_PatternDict.h"
-#include "third_party/base/ptr_util.h"
std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::DecodeArith(
CJBig2_ArithDecoder* pArithDecoder,
@@ -49,7 +48,7 @@
if (!BHDC)
return nullptr;
- auto pDict = pdfium::MakeUnique<CJBig2_PatternDict>(GRAYMAX + 1);
+ auto pDict = std::make_unique<CJBig2_PatternDict>(GRAYMAX + 1);
for (uint32_t GRAY = 0; GRAY <= GRAYMAX; ++GRAY)
pDict->HDPATS[GRAY] = BHDC->SubImage(HDPW * GRAY, 0, HDPW, HDPH);
return pDict;
@@ -66,7 +65,7 @@
if (!BHDC)
return nullptr;
- auto pDict = pdfium::MakeUnique<CJBig2_PatternDict>(GRAYMAX + 1);
+ auto pDict = std::make_unique<CJBig2_PatternDict>(GRAYMAX + 1);
for (uint32_t GRAY = 0; GRAY <= GRAYMAX; ++GRAY)
pDict->HDPATS[GRAY] = BHDC->SubImage(HDPW * GRAY, 0, HDPW, HDPH);
return pDict;
@@ -78,7 +77,7 @@
if (width > JBIG2_MAX_IMAGE_SIZE || height > JBIG2_MAX_IMAGE_SIZE)
return nullptr;
- auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
+ auto pGRD = std::make_unique<CJBig2_GRDProc>();
pGRD->MMR = HDMMR;
pGRD->GBW = width;
pGRD->GBH = height;
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp
index 6fd1226..63ea40d 100644
--- a/core/fxcodec/jbig2/JBig2_SddProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp
@@ -21,7 +21,6 @@
#include "core/fxcodec/jbig2/JBig2_SymbolDict.h"
#include "core/fxcodec/jbig2/JBig2_TrdProc.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "third_party/base/ptr_util.h"
CJBig2_SDDProc::CJBig2_SDDProc() = default;
@@ -50,24 +49,24 @@
std::vector<CJBig2_Image*> SBSYMS;
std::unique_ptr<CJBig2_ArithIaidDecoder> IAID;
std::unique_ptr<CJBig2_SymbolDict> pDict;
- auto IADH = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IADW = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IAAI = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IARDX = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IARDY = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IAEX = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IADT = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IAFS = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IADS = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IAIT = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IARI = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IARDW = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- auto IARDH = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IADH = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IADW = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IAAI = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IARDX = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IARDY = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IAEX = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IADT = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IAFS = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IADS = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IAIT = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IARI = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IARDW = std::make_unique<CJBig2_ArithIntDecoder>();
+ auto IARDH = std::make_unique<CJBig2_ArithIntDecoder>();
nTmp = 0;
while ((uint32_t)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) {
nTmp++;
}
- IAID = pdfium::MakeUnique<CJBig2_ArithIaidDecoder>((uint8_t)nTmp);
+ IAID = std::make_unique<CJBig2_ArithIaidDecoder>((uint8_t)nTmp);
SDNEWSYMS.resize(SDNUMNEWSYMS);
HCHEIGHT = 0;
@@ -100,7 +99,7 @@
}
TOTWIDTH = TOTWIDTH + SYMWIDTH;
if (SDREFAGG == 0) {
- auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
+ auto pGRD = std::make_unique<CJBig2_GRDProc>();
pGRD->MMR = 0;
pGRD->GBW = SYMWIDTH;
pGRD->GBH = HCHEIGHT;
@@ -122,15 +121,15 @@
IAAI->Decode(pArithDecoder, (int*)&REFAGGNINST);
if (REFAGGNINST > 1) {
// Huffman tables must not outlive |pDecoder|.
- auto SBHUFFFS = pdfium::MakeUnique<CJBig2_HuffmanTable>(6);
- auto SBHUFFDS = pdfium::MakeUnique<CJBig2_HuffmanTable>(8);
- auto SBHUFFDT = pdfium::MakeUnique<CJBig2_HuffmanTable>(11);
- auto SBHUFFRDW = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRDH = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRDX = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRDY = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRSIZE = pdfium::MakeUnique<CJBig2_HuffmanTable>(1);
- auto pDecoder = pdfium::MakeUnique<CJBig2_TRDProc>();
+ auto SBHUFFFS = std::make_unique<CJBig2_HuffmanTable>(6);
+ auto SBHUFFDS = std::make_unique<CJBig2_HuffmanTable>(8);
+ auto SBHUFFDT = std::make_unique<CJBig2_HuffmanTable>(11);
+ auto SBHUFFRDW = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRDH = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRDX = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRDY = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRSIZE = std::make_unique<CJBig2_HuffmanTable>(1);
+ auto pDecoder = std::make_unique<CJBig2_TRDProc>();
pDecoder->SBHUFF = SDHUFF;
pDecoder->SBREFINE = 1;
pDecoder->SBW = SYMWIDTH;
@@ -198,7 +197,7 @@
if (!SBSYMS[IDI])
return nullptr;
- auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
+ auto pGRRD = std::make_unique<CJBig2_GRRDProc>();
pGRRD->GRW = SYMWIDTH;
pGRRD->GRH = HCHEIGHT;
pGRRD->GRTEMPLATE = SDRTEMPLATE;
@@ -241,15 +240,14 @@
if (num_ex_syms > SDNUMEXSYMS)
return nullptr;
- pDict = pdfium::MakeUnique<CJBig2_SymbolDict>();
+ pDict = std::make_unique<CJBig2_SymbolDict>();
J = 0;
for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) {
if (!EXFLAGS[I] || J >= SDNUMEXSYMS)
continue;
if (I < SDNUMINSYMS) {
- pDict->AddImage(SDINSYMS[I]
- ? pdfium::MakeUnique<CJBig2_Image>(*SDINSYMS[I])
- : nullptr);
+ pDict->AddImage(SDINSYMS[I] ? std::make_unique<CJBig2_Image>(*SDINSYMS[I])
+ : nullptr);
} else {
pDict->AddImage(std::move(SDNEWSYMS[I - SDNUMINSYMS]));
}
@@ -283,11 +281,11 @@
uint32_t num_ex_syms;
// Pointers are not owned
std::vector<CJBig2_Image*> SBSYMS;
- auto pHuffmanDecoder = pdfium::MakeUnique<CJBig2_HuffmanDecoder>(pStream);
+ auto pHuffmanDecoder = std::make_unique<CJBig2_HuffmanDecoder>(pStream);
SDNEWSYMS.resize(SDNUMNEWSYMS);
if (SDREFAGG == 0)
SDNEWSYMWIDTHS.resize(SDNUMNEWSYMS);
- auto pDict = pdfium::MakeUnique<CJBig2_SymbolDict>();
+ auto pDict = std::make_unique<CJBig2_SymbolDict>();
std::unique_ptr<CJBig2_HuffmanTable> pTable;
HCHEIGHT = 0;
@@ -331,15 +329,15 @@
BS = nullptr;
if (REFAGGNINST > 1) {
// Huffman tables must outlive |pDecoder|.
- auto SBHUFFFS = pdfium::MakeUnique<CJBig2_HuffmanTable>(6);
- auto SBHUFFDS = pdfium::MakeUnique<CJBig2_HuffmanTable>(8);
- auto SBHUFFDT = pdfium::MakeUnique<CJBig2_HuffmanTable>(11);
- auto SBHUFFRDW = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRDH = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRDX = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRDY = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRSIZE = pdfium::MakeUnique<CJBig2_HuffmanTable>(1);
- auto pDecoder = pdfium::MakeUnique<CJBig2_TRDProc>();
+ auto SBHUFFFS = std::make_unique<CJBig2_HuffmanTable>(6);
+ auto SBHUFFDS = std::make_unique<CJBig2_HuffmanTable>(8);
+ auto SBHUFFDT = std::make_unique<CJBig2_HuffmanTable>(11);
+ auto SBHUFFRDW = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRDH = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRDX = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRDY = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRSIZE = std::make_unique<CJBig2_HuffmanTable>(1);
+ auto pDecoder = std::make_unique<CJBig2_TRDProc>();
pDecoder->SBHUFF = SDHUFF;
pDecoder->SBREFINE = 1;
pDecoder->SBW = SYMWIDTH;
@@ -404,8 +402,8 @@
if (IDI < SBNUMSYMS)
break;
}
- auto SBHUFFRDX = pdfium::MakeUnique<CJBig2_HuffmanTable>(15);
- auto SBHUFFRSIZE = pdfium::MakeUnique<CJBig2_HuffmanTable>(1);
+ auto SBHUFFRDX = std::make_unique<CJBig2_HuffmanTable>(15);
+ auto SBHUFFRSIZE = std::make_unique<CJBig2_HuffmanTable>(1);
if ((pHuffmanDecoder->DecodeAValue(SBHUFFRDX.get(), &RDXI) != 0) ||
(pHuffmanDecoder->DecodeAValue(SBHUFFRDX.get(), &RDYI) != 0) ||
(pHuffmanDecoder->DecodeAValue(SBHUFFRSIZE.get(), &nVal) != 0)) {
@@ -417,7 +415,7 @@
std::copy(SDINSYMS, SDINSYMS + SDNUMINSYMS, SBSYMS.begin());
for (size_t i = 0; i < NSYMSDECODED; ++i)
SBSYMS[i + SDNUMINSYMS] = SDNEWSYMS[i].get();
- auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
+ auto pGRRD = std::make_unique<CJBig2_GRRDProc>();
pGRRD->GRW = SYMWIDTH;
pGRRD->GRH = HCHEIGHT;
pGRRD->GRTEMPLATE = SDRTEMPLATE;
@@ -429,7 +427,7 @@
pGRRD->GRAT[1] = SDRAT[1];
pGRRD->GRAT[2] = SDRAT[2];
pGRRD->GRAT[3] = SDRAT[3];
- auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(pStream);
+ auto pArithDecoder = std::make_unique<CJBig2_ArithDecoder>(pStream);
BS = pGRRD->Decode(pArithDecoder.get(), grContext->data());
if (!BS)
return nullptr;
@@ -464,14 +462,14 @@
}
const uint32_t stride = safe_stride.ValueOrDie();
- BHC = pdfium::MakeUnique<CJBig2_Image>(TOTWIDTH, HCHEIGHT);
+ BHC = std::make_unique<CJBig2_Image>(TOTWIDTH, HCHEIGHT);
for (I = 0; I < HCHEIGHT; I++) {
memcpy(BHC->data() + I * BHC->stride(), pStream->getPointer(),
stride);
pStream->offset(stride);
}
} else {
- auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
+ auto pGRD = std::make_unique<CJBig2_GRDProc>();
pGRD->MMR = 1;
pGRD->GBW = TOTWIDTH;
pGRD->GBH = HCHEIGHT;
@@ -490,7 +488,7 @@
}
EXINDEX = 0;
CUREXFLAG = 0;
- pTable = pdfium::MakeUnique<CJBig2_HuffmanTable>(1);
+ pTable = std::make_unique<CJBig2_HuffmanTable>(1);
EXFLAGS.resize(SDNUMINSYMS + SDNUMNEWSYMS);
num_ex_syms = 0;
while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) {
@@ -519,9 +517,8 @@
if (!EXFLAGS[I] || J >= SDNUMEXSYMS)
continue;
if (I < SDNUMINSYMS) {
- pDict->AddImage(SDINSYMS[I]
- ? pdfium::MakeUnique<CJBig2_Image>(*SDINSYMS[I])
- : nullptr);
+ pDict->AddImage(SDINSYMS[I] ? std::make_unique<CJBig2_Image>(*SDINSYMS[I])
+ : nullptr);
} else {
pDict->AddImage(std::move(SDNEWSYMS[I - SDNUMINSYMS]));
}
diff --git a/core/fxcodec/jbig2/JBig2_SymbolDict.cpp b/core/fxcodec/jbig2/JBig2_SymbolDict.cpp
index a6fafb4..969d404 100644
--- a/core/fxcodec/jbig2/JBig2_SymbolDict.cpp
+++ b/core/fxcodec/jbig2/JBig2_SymbolDict.cpp
@@ -7,16 +7,15 @@
#include "core/fxcodec/jbig2/JBig2_SymbolDict.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
-#include "third_party/base/ptr_util.h"
CJBig2_SymbolDict::CJBig2_SymbolDict() {}
CJBig2_SymbolDict::~CJBig2_SymbolDict() {}
std::unique_ptr<CJBig2_SymbolDict> CJBig2_SymbolDict::DeepCopy() const {
- auto dst = pdfium::MakeUnique<CJBig2_SymbolDict>();
+ auto dst = std::make_unique<CJBig2_SymbolDict>();
for (const auto& image : m_SDEXSYMS) {
- dst->m_SDEXSYMS.push_back(image ? pdfium::MakeUnique<CJBig2_Image>(*image)
+ dst->m_SDEXSYMS.push_back(image ? std::make_unique<CJBig2_Image>(*image)
: nullptr);
}
dst->m_gbContext = m_gbContext;
diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
index 7aa5989..a009000 100644
--- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
@@ -15,7 +15,6 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/maybe_owned.h"
#include "third_party/base/optional.h"
-#include "third_party/base/ptr_util.h"
namespace {
@@ -50,13 +49,13 @@
std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::DecodeHuffman(
CJBig2_BitStream* pStream,
JBig2ArithCtx* grContext) {
- auto SBREG = pdfium::MakeUnique<CJBig2_Image>(SBW, SBH);
+ auto SBREG = std::make_unique<CJBig2_Image>(SBW, SBH);
if (!SBREG->data())
return nullptr;
SBREG->Fill(SBDEFPIXEL);
int32_t INITIAL_STRIPT;
- auto pHuffmanDecoder = pdfium::MakeUnique<CJBig2_HuffmanDecoder>(pStream);
+ auto pHuffmanDecoder = std::make_unique<CJBig2_HuffmanDecoder>(pStream);
if (pHuffmanDecoder->DecodeAValue(SBHUFFDT.Get(), &INITIAL_STRIPT) != 0)
return nullptr;
@@ -173,7 +172,7 @@
if (!GRREFERENCEDX || !GRREFERENCEDY)
return nullptr;
- auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
+ auto pGRRD = std::make_unique<CJBig2_GRRDProc>();
pGRRD->GRW = WOI.value();
pGRRD->GRH = HOI.value();
pGRRD->GRTEMPLATE = SBRTEMPLATE;
@@ -186,7 +185,7 @@
pGRRD->GRAT[2] = SBRAT[2];
pGRRD->GRAT[3] = SBRAT[3];
- auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(pStream);
+ auto pArithDecoder = std::make_unique<CJBig2_ArithDecoder>(pStream);
IBI = pGRRD->Decode(pArithDecoder.get(), grContext);
if (!IBI)
return nullptr;
@@ -226,7 +225,7 @@
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext,
JBig2IntDecoderState* pIDS) {
- auto SBREG = pdfium::MakeUnique<CJBig2_Image>(SBW, SBH);
+ auto SBREG = std::make_unique<CJBig2_Image>(SBW, SBH);
if (!SBREG->data())
return nullptr;
@@ -234,7 +233,7 @@
if (pIDS)
pIADT = pIDS->IADT;
else
- pIADT = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ pIADT = std::make_unique<CJBig2_ArithIntDecoder>();
int32_t INITIAL_STRIPT;
if (!pIADT->Decode(pArithDecoder, &INITIAL_STRIPT))
return nullptr;
@@ -259,15 +258,15 @@
pIARDY = pIDS->IARDY;
pIAID = pIDS->IAID;
} else {
- pIAFS = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- pIADS = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- pIAIT = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- pIARI = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- pIARDW = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- pIARDH = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- pIARDX = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- pIARDY = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
- pIAID = pdfium::MakeUnique<CJBig2_ArithIaidDecoder>(SBSYMCODELEN);
+ pIAFS = std::make_unique<CJBig2_ArithIntDecoder>();
+ pIADS = std::make_unique<CJBig2_ArithIntDecoder>();
+ pIAIT = std::make_unique<CJBig2_ArithIntDecoder>();
+ pIARI = std::make_unique<CJBig2_ArithIntDecoder>();
+ pIARDW = std::make_unique<CJBig2_ArithIntDecoder>();
+ pIARDH = std::make_unique<CJBig2_ArithIntDecoder>();
+ pIARDX = std::make_unique<CJBig2_ArithIntDecoder>();
+ pIARDY = std::make_unique<CJBig2_ArithIntDecoder>();
+ pIAID = std::make_unique<CJBig2_ArithIaidDecoder>(SBSYMCODELEN);
}
SBREG->Fill(SBDEFPIXEL);
@@ -353,7 +352,7 @@
if (!GRREFERENCEDX || !GRREFERENCEDY)
return nullptr;
- auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
+ auto pGRRD = std::make_unique<CJBig2_GRRDProc>();
pGRRD->GRW = WOI.value();
pGRRD->GRH = HOI.value();
pGRRD->GRTEMPLATE = SBRTEMPLATE;
diff --git a/core/fxcodec/jbig2/jbig2_decoder.cpp b/core/fxcodec/jbig2/jbig2_decoder.cpp
index 3c10cc4..f757195 100644
--- a/core/fxcodec/jbig2/jbig2_decoder.cpp
+++ b/core/fxcodec/jbig2/jbig2_decoder.cpp
@@ -8,7 +8,6 @@
#include "core/fxcodec/jbig2/JBig2_Context.h"
#include "core/fxcodec/jbig2/JBig2_DocumentContext.h"
-#include "third_party/base/ptr_util.h"
namespace fxcodec {
@@ -35,7 +34,7 @@
JBig2_DocumentContext* GetJBig2DocumentContext(
std::unique_ptr<JBig2_DocumentContext>* pContextHolder) {
if (!*pContextHolder)
- *pContextHolder = pdfium::MakeUnique<JBig2_DocumentContext>();
+ *pContextHolder = std::make_unique<JBig2_DocumentContext>();
return pContextHolder->get();
}
diff --git a/core/fxcodec/jpeg/jpegmodule.cpp b/core/fxcodec/jpeg/jpegmodule.cpp
index 8724500..f26da6d 100644
--- a/core/fxcodec/jpeg/jpegmodule.cpp
+++ b/core/fxcodec/jpeg/jpegmodule.cpp
@@ -22,7 +22,6 @@
#include "core/fxge/fx_dib.h"
#include "third_party/base/logging.h"
#include "third_party/base/optional.h"
-#include "third_party/base/ptr_util.h"
static pdfium::span<const uint8_t> JpegScanSOI(
pdfium::span<const uint8_t> src_span) {
@@ -386,7 +385,7 @@
bool ColorTransform) {
ASSERT(!src_span.empty());
- auto pDecoder = pdfium::MakeUnique<JpegDecoder>();
+ auto pDecoder = std::make_unique<JpegDecoder>();
if (!pDecoder->Create(src_span, width, height, nComps, ColorTransform))
return nullptr;
diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp
index 4fc24ee..dbc1b10 100644
--- a/core/fxcodec/jpx/cjpx_decoder.cpp
+++ b/core/fxcodec/jpx/cjpx_decoder.cpp
@@ -420,8 +420,7 @@
m_Image = nullptr;
m_SrcData = src_data;
- m_DecodeData =
- pdfium::MakeUnique<DecodeData>(src_data.data(), src_data.size());
+ m_DecodeData = std::make_unique<DecodeData>(src_data.data(), src_data.size());
m_Stream = fx_opj_stream_create_memory_stream(m_DecodeData.get());
if (!m_Stream)
return false;
diff --git a/core/fxcodec/png/png_decoder.cpp b/core/fxcodec/png/png_decoder.cpp
index 0e4abc4..e3f65af 100644
--- a/core/fxcodec/png/png_decoder.cpp
+++ b/core/fxcodec/png/png_decoder.cpp
@@ -13,7 +13,6 @@
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/fx_dib.h"
#include "third_party/base/compiler_specific.h"
-#include "third_party/base/ptr_util.h"
#ifdef USE_SYSTEM_LIBPNG
#include <png.h>
@@ -187,7 +186,7 @@
// static
std::unique_ptr<ProgressiveDecoderIface::Context> PngDecoder::StartDecode(
Delegate* pDelegate) {
- auto p = pdfium::MakeUnique<CPngContext>(pDelegate);
+ auto p = std::make_unique<CPngContext>(pDelegate);
p->m_pPng =
png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (!p->m_pPng)
diff --git a/core/fxcodec/progressive_decoder_unittest.cpp b/core/fxcodec/progressive_decoder_unittest.cpp
index 9ace0d0..867c3db 100644
--- a/core/fxcodec/progressive_decoder_unittest.cpp
+++ b/core/fxcodec/progressive_decoder_unittest.cpp
@@ -8,7 +8,6 @@
#include "core/fxcrt/cfx_readonlymemorystream.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/span.h"
#ifdef PDF_ENABLE_XFA_GIF
@@ -371,7 +370,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
{
- auto decoder = pdfium::MakeUnique<ProgressiveDecoder>();
+ auto decoder = std::make_unique<ProgressiveDecoder>();
auto source = pdfium::MakeRetain<CFX_ReadOnlyMemoryStream>(kInput);
CFX_DIBAttribute attr;
diff --git a/core/fxcodec/tiff/tiff_decoder.cpp b/core/fxcodec/tiff/tiff_decoder.cpp
index 1776c26..0572fa9 100644
--- a/core/fxcodec/tiff/tiff_decoder.cpp
+++ b/core/fxcodec/tiff/tiff_decoder.cpp
@@ -18,7 +18,6 @@
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
#include "third_party/base/logging.h"
-#include "third_party/base/ptr_util.h"
extern "C" {
#include "third_party/libtiff/tiffiop.h"
@@ -487,7 +486,7 @@
// static
std::unique_ptr<ProgressiveDecoderIface::Context> TiffDecoder::CreateDecoder(
const RetainPtr<IFX_SeekableReadStream>& file_ptr) {
- auto pDecoder = pdfium::MakeUnique<CTiffContext>();
+ auto pDecoder = std::make_unique<CTiffContext>();
if (!pDecoder->InitDecoder(file_ptr))
return nullptr;