diff options
author | tsepez <tsepez@chromium.org> | 2016-10-26 15:06:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-26 15:06:11 -0700 |
commit | e5cb0b191aed020da99757c117dae014ea65c6ba (patch) | |
tree | 49f6f8124adbf24f94def640932adbf7e1460175 /core/fpdfapi | |
parent | cd5f026e7b277ec73d53e149c7c48ee981547d1a (diff) | |
download | pdfium-e5cb0b191aed020da99757c117dae014ea65c6ba.tar.xz |
Take advantage of implicit std::unique_ptr<>(nulltpr_t) ctor.
Review-Url: https://codereview.chromium.org/2453163002
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/font/cpdf_font.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_clippath.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_colorspace.cpp | 14 | ||||
-rw-r--r-- | core/fpdfapi/page/fpdf_page_func.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_pattern.cpp | 2 |
5 files changed, 12 insertions, 11 deletions
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index d39f752a8b..c5da4ea519 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -343,7 +343,7 @@ std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc, pFont->m_pFontDict = pFontDict; pFont->m_pDocument = pDoc; pFont->m_BaseFont = pFontDict->GetStringFor("BaseFont"); - return pFont->Load() ? std::move(pFont) : std::unique_ptr<CPDF_Font>(); + return pFont->Load() ? std::move(pFont) : nullptr; } uint32_t CPDF_Font::GetNextChar(const FX_CHAR* pString, diff --git a/core/fpdfapi/page/cpdf_clippath.cpp b/core/fpdfapi/page/cpdf_clippath.cpp index 8c268a1b5e..9d4b737d33 100644 --- a/core/fpdfapi/page/cpdf_clippath.cpp +++ b/core/fpdfapi/page/cpdf_clippath.cpp @@ -100,7 +100,7 @@ void CPDF_ClipPath::AppendTexts( if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) { for (size_t i = 0; i < pTexts->size(); i++) pData->m_TextList.push_back(std::move((*pTexts)[i])); - pData->m_TextList.push_back(std::unique_ptr<CPDF_TextObject>()); + pData->m_TextList.push_back(nullptr); } pTexts->clear(); } diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index fe840d10df..e43bacc079 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -332,7 +332,7 @@ CPDF_ColorSpace* CPDF_ColorSpace::GetStockCS(int family) { std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) { if (!pObj) - return std::unique_ptr<CPDF_ColorSpace>(); + return nullptr; if (pObj->IsName()) { return std::unique_ptr<CPDF_ColorSpace>( @@ -341,7 +341,7 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(CPDF_Document* pDoc, if (CPDF_Stream* pStream = pObj->AsStream()) { CPDF_Dictionary* pDict = pStream->GetDict(); if (!pDict) - return std::unique_ptr<CPDF_ColorSpace>(); + return nullptr; for (const auto& it : *pDict) { std::unique_ptr<CPDF_ColorSpace> pRet; @@ -351,16 +351,16 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(CPDF_Document* pDoc, if (pRet) return pRet; } - return std::unique_ptr<CPDF_ColorSpace>(); + return nullptr; } CPDF_Array* pArray = pObj->AsArray(); if (!pArray || pArray->IsEmpty()) - return std::unique_ptr<CPDF_ColorSpace>(); + return nullptr; CPDF_Object* pFamilyObj = pArray->GetDirectObjectAt(0); if (!pFamilyObj) - return std::unique_ptr<CPDF_ColorSpace>(); + return nullptr; CFX_ByteString familyname = pFamilyObj->GetString(); if (pArray->GetCount() == 1) @@ -386,11 +386,11 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(CPDF_Document* pDoc, } else if (id == FXBSTR_ID('P', 'a', 't', 't')) { pCS.reset(new CPDF_PatternCS(pDoc)); } else { - return std::unique_ptr<CPDF_ColorSpace>(); + return nullptr; } pCS->m_pArray = pArray; if (!pCS->v_Load(pDoc, pArray)) - return std::unique_ptr<CPDF_ColorSpace>(); + return nullptr; return pCS; } diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp index a2e31f94bb..df658844cd 100644 --- a/core/fpdfapi/page/fpdf_page_func.cpp +++ b/core/fpdfapi/page/fpdf_page_func.cpp @@ -751,7 +751,8 @@ std::unique_ptr<CPDF_Function> CPDF_Function::Load(CPDF_Object* pFuncObj) { pFunc.reset(new CPDF_PSFunc()); if (!pFunc || !pFunc->Init(pFuncObj)) - return std::unique_ptr<CPDF_Function>(); + return nullptr; + return pFunc; } diff --git a/core/fpdfapi/render/fpdf_render_pattern.cpp b/core/fpdfapi/render/fpdf_render_pattern.cpp index f55a0e8b97..5238550bf5 100644 --- a/core/fpdfapi/render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/render/fpdf_render_pattern.cpp @@ -819,7 +819,7 @@ std::unique_ptr<CFX_DIBitmap> DrawPatternBitmap( std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap); if (!pBitmap->Create(width, height, pPattern->colored() ? FXDIB_Argb : FXDIB_8bppMask)) { - return std::unique_ptr<CFX_DIBitmap>(); + return nullptr; } CFX_FxgeDevice bitmap_device; bitmap_device.Attach(pBitmap.get(), false, nullptr, false); |