| Index: core/fpdfapi/parser/cpdf_document.cpp
|
| diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
|
| index 97f55f872d9a598ef37c6a12fb2f0e2ebd31370b..a73e4afcc0decb4aac4c908d29124d04ad8236e0 100644
|
| --- a/core/fpdfapi/parser/cpdf_document.cpp
|
| +++ b/core/fpdfapi/parser/cpdf_document.cpp
|
| @@ -299,7 +299,7 @@ void ProcessNonbCJK(CPDF_Dictionary* pBaseDict,
|
| bool bold,
|
| bool italic,
|
| CFX_ByteString basefont,
|
| - CPDF_Array* pWidths) {
|
| + std::unique_ptr<CPDF_Array> pWidths) {
|
| if (bold && italic)
|
| basefont += ",BoldItalic";
|
| else if (bold)
|
| @@ -310,23 +310,24 @@ void ProcessNonbCJK(CPDF_Dictionary* pBaseDict,
|
| pBaseDict->SetNewFor<CPDF_Name>("BaseFont", basefont);
|
| pBaseDict->SetNewFor<CPDF_Number>("FirstChar", 32);
|
| pBaseDict->SetNewFor<CPDF_Number>("LastChar", 255);
|
| - pBaseDict->SetFor("Widths", pdfium::WrapUnique(pWidths));
|
| + pBaseDict->SetFor("Widths", std::move(pWidths));
|
| }
|
|
|
| -std::unique_ptr<CPDF_Dictionary> CalculateFontDesc(CPDF_Document* pDoc,
|
| - CFX_ByteString basefont,
|
| - int flags,
|
| - int italicangle,
|
| - int ascend,
|
| - int descend,
|
| - CPDF_Array* bbox,
|
| - int32_t stemV) {
|
| +std::unique_ptr<CPDF_Dictionary> CalculateFontDesc(
|
| + CPDF_Document* pDoc,
|
| + CFX_ByteString basefont,
|
| + int flags,
|
| + int italicangle,
|
| + int ascend,
|
| + int descend,
|
| + std::unique_ptr<CPDF_Array> bbox,
|
| + int32_t stemV) {
|
| auto pFontDesc =
|
| pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool());
|
| pFontDesc->SetNewFor<CPDF_Name>("Type", "FontDescriptor");
|
| pFontDesc->SetNewFor<CPDF_Name>("FontName", basefont);
|
| pFontDesc->SetNewFor<CPDF_Number>("Flags", flags);
|
| - pFontDesc->SetFor("FontBBox", pdfium::WrapUnique(bbox));
|
| + pFontDesc->SetFor("FontBBox", std::move(bbox));
|
| pFontDesc->SetNewFor<CPDF_Number>("ItalicAngle", italicangle);
|
| pFontDesc->SetNewFor<CPDF_Number>("Ascent", ascend);
|
| pFontDesc->SetNewFor<CPDF_Number>("Descent", descend);
|
| @@ -883,7 +884,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
|
| new CFX_UnicodeEncoding(pFont));
|
| CPDF_Dictionary* pFontDict = pBaseDict;
|
| if (!bCJK) {
|
| - CPDF_Array* pWidths = new CPDF_Array;
|
| + auto pWidths = pdfium::MakeUnique<CPDF_Array>();
|
| for (int charcode = 32; charcode < 128; charcode++) {
|
| int glyph_index = pEncoding->GlyphFromCharCode(charcode);
|
| int char_width = pFont->GetGlyphWidth(glyph_index);
|
| @@ -909,7 +910,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
|
| }
|
| }
|
| ProcessNonbCJK(pBaseDict, pFont->IsBold(), pFont->IsItalic(), basefont,
|
| - pWidths);
|
| + std::move(pWidths));
|
| } else {
|
| pFontDict = ProcessbCJK(pBaseDict, charset, bVert, basefont,
|
| [pFont, &pEncoding](FX_WCHAR start, FX_WCHAR end,
|
| @@ -922,7 +923,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
|
| pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0;
|
| FX_RECT bbox;
|
| pFont->GetBBox(bbox);
|
| - CPDF_Array* pBBox = new CPDF_Array;
|
| + auto pBBox = pdfium::MakeUnique<CPDF_Array>();
|
| pBBox->AddNew<CPDF_Number>(bbox.left);
|
| pBBox->AddNew<CPDF_Number>(bbox.bottom);
|
| pBBox->AddNew<CPDF_Number>(bbox.right);
|
| @@ -944,7 +945,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
|
| }
|
| CPDF_Dictionary* pFontDesc = ToDictionary(AddIndirectObject(
|
| CalculateFontDesc(this, basefont, flags, italicangle, pFont->GetAscent(),
|
| - pFont->GetDescent(), pBBox, nStemV)));
|
| + pFont->GetDescent(), std::move(pBBox), nStemV)));
|
| pFontDict->SetNewFor<CPDF_Reference>("FontDescriptor", this,
|
| pFontDesc->GetObjNum());
|
| return LoadFont(pBaseDict);
|
|
|