diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fde/cfde_txtedtpage.cpp | 6 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtparag.cpp | 4 | ||||
-rw-r--r-- | xfa/fgas/crt/ifgas_stream.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/cfwl_barcode.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/cfwl_edit.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fwltheme.cpp | 24 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptcontext.cpp | 14 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_xml_parser.cpp | 4 |
11 files changed, 38 insertions, 37 deletions
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index ef16939116..122eb40f7d 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -215,7 +215,7 @@ int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) { if (nIndex < 0) { return -1; } - std::unique_ptr<CFX_WordBreak> pIter(new CFX_WordBreak); + auto pIter = pdfium::MakeUnique<CFX_WordBreak>(); pIter->Attach(new CFDE_TxtEdtBuf::Iterator(pBuf)); pIter->SetAt(nIndex); nCount = pIter->GetWordLength(); @@ -238,8 +238,8 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, if (pParams->dwMode & FDE_TEXTEDITMODE_Password) { wcAlias = m_pEditEngine->GetAliasChar(); } - m_pIter.reset(new CFDE_TxtEdtBuf::Iterator(static_cast<CFDE_TxtEdtBuf*>(pBuf), - wcAlias)); + m_pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>( + static_cast<CFDE_TxtEdtBuf*>(pBuf), wcAlias); CFX_TxtBreak* pBreak = m_pEditEngine->GetTextBreak(); pBreak->EndBreak(CFX_BreakType::Paragraph); pBreak->ClearBreakPieces(); diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp index ceff448f2c..bcacc66695 100644 --- a/xfa/fde/cfde_txtedtparag.cpp +++ b/xfa/fde/cfde_txtedtparag.cpp @@ -43,8 +43,8 @@ void CFDE_TxtEdtParag::LoadParag() { if (pParam->dwMode & FDE_TEXTEDITMODE_Password) wcAlias = m_pEngine->GetAliasChar(); - std::unique_ptr<IFX_CharIter> pIter(new CFDE_TxtEdtBuf::Iterator( - static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), wcAlias)); + auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>( + static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), wcAlias); pIter->SetAt(m_nCharStart); int32_t nEndIndex = m_nCharStart + m_nCharCount; std::vector<int32_t> LineBaseArr; diff --git a/xfa/fgas/crt/ifgas_stream.cpp b/xfa/fgas/crt/ifgas_stream.cpp index eef19a59ff..4981145f74 100644 --- a/xfa/fgas/crt/ifgas_stream.cpp +++ b/xfa/fgas/crt/ifgas_stream.cpp @@ -1082,7 +1082,7 @@ bool CFGAS_Stream::LoadFile(const wchar_t* pszSrcFileName, uint32_t dwAccess) { if (!pszSrcFileName || FXSYS_wcslen(pszSrcFileName) < 1) return false; - std::unique_ptr<CFGAS_FileStreamImp> pImp(new CFGAS_FileStreamImp()); + auto pImp = pdfium::MakeUnique<CFGAS_FileStreamImp>(); if (!pImp->LoadFile(pszSrcFileName, dwAccess)) return false; @@ -1102,7 +1102,7 @@ bool CFGAS_Stream::LoadFileRead( if (!pFileRead) return false; - std::unique_ptr<CFGAS_FileReadStreamImp> pImp(new CFGAS_FileReadStreamImp()); + auto pImp = pdfium::MakeUnique<CFGAS_FileReadStreamImp>(); if (!pImp->LoadFileRead(pFileRead, dwAccess)) return false; @@ -1142,7 +1142,7 @@ bool CFGAS_Stream::LoadBuffer(uint8_t* pData, if (!pData || iTotalSize < 1) return false; - std::unique_ptr<CFGAS_BufferStreamImp> pImp(new CFGAS_BufferStreamImp()); + auto pImp = pdfium::MakeUnique<CFGAS_BufferStreamImp>(); if (!pImp->LoadBuffer(pData, iTotalSize, dwAccess)) return false; diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp index e894d25d64..bed8921e0e 100644 --- a/xfa/fwl/cfwl_barcode.cpp +++ b/xfa/fwl/cfwl_barcode.cpp @@ -218,7 +218,7 @@ void CFWL_Barcode::CreateBarcodeEngine() { if (m_pBarcodeEngine || m_type == BC_UNKNOWN) return; - std::unique_ptr<CFX_Barcode> pBarcode(new CFX_Barcode); + auto pBarcode = pdfium::MakeUnique<CFX_Barcode>(); if (pBarcode->Create(m_type)) m_pBarcodeEngine = std::move(pBarcode); } diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index e05f251310..c2b0ddf669 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -566,9 +566,8 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, if (!pRenderDev) return; - std::unique_ptr<CFDE_RenderDevice> pRenderDevice( - new CFDE_RenderDevice(pRenderDev, false)); - std::unique_ptr<CFDE_RenderContext> pRenderContext(new CFDE_RenderContext); + auto pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pRenderDev, false); + auto pRenderContext = pdfium::MakeUnique<CFDE_RenderContext>(); pRenderDevice->SetClipRect(rtClip); pRenderContext->StartRender(pRenderDevice.get(), pPage, mt); pRenderContext->DoRender(nullptr); diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index c8ed4f7f46..f16fd8c1a9 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -559,8 +559,7 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, if (!pFxDevice) return false; - std::unique_ptr<CFDE_RenderDevice> pDevice( - new CFDE_RenderDevice(pFxDevice, false)); + auto pDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pFxDevice, false); pDevice->SaveState(); pDevice->SetClipRect(rtClip); @@ -1176,7 +1175,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, return; pPen->SetColor(pPiece->dwColor); - std::unique_ptr<CFDE_Path> pPath(new CFDE_Path); + auto pPath = pdfium::MakeUnique<CFDE_Path>(); int32_t iChars = GetDisplayPos(pPiece, pCharPos); if (iChars > 0) { CFX_PointF pt1, pt2; diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 4d5b20e438..629cd509e8 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -44,18 +44,18 @@ CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget) { } CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) - : m_pCheckBoxTP(new CFWL_CheckBoxTP), - m_pListBoxTP(new CFWL_ListBoxTP), - m_pPictureBoxTP(new CFWL_PictureBoxTP), - m_pSrollBarTP(new CFWL_ScrollBarTP), - m_pEditTP(new CFWL_EditTP), - m_pComboBoxTP(new CFWL_ComboBoxTP), - m_pMonthCalendarTP(new CFWL_MonthCalendarTP), - m_pDateTimePickerTP(new CFWL_DateTimePickerTP), - m_pPushButtonTP(new CFWL_PushButtonTP), - m_pCaretTP(new CFWL_CaretTP), - m_pBarcodeTP(new CFWL_BarcodeTP), - m_pTextOut(new CFDE_TextOut), + : m_pCheckBoxTP(pdfium::MakeUnique<CFWL_CheckBoxTP>()), + m_pListBoxTP(pdfium::MakeUnique<CFWL_ListBoxTP>()), + m_pPictureBoxTP(pdfium::MakeUnique<CFWL_PictureBoxTP>()), + m_pSrollBarTP(pdfium::MakeUnique<CFWL_ScrollBarTP>()), + m_pEditTP(pdfium::MakeUnique<CFWL_EditTP>()), + m_pComboBoxTP(pdfium::MakeUnique<CFWL_ComboBoxTP>()), + m_pMonthCalendarTP(pdfium::MakeUnique<CFWL_MonthCalendarTP>()), + m_pDateTimePickerTP(pdfium::MakeUnique<CFWL_DateTimePickerTP>()), + m_pPushButtonTP(pdfium::MakeUnique<CFWL_PushButtonTP>()), + m_pCaretTP(pdfium::MakeUnique<CFWL_CaretTP>()), + m_pBarcodeTP(pdfium::MakeUnique<CFWL_BarcodeTP>()), + m_pTextOut(pdfium::MakeUnique<CFDE_TextOut>()), m_pCalendarFont(nullptr), m_pApp(pApp) { m_Rect.Reset(); diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index b5036926aa..0deb864811 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -405,7 +405,7 @@ bool CXFA_FFDoc::SavePackage( const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile, CFX_ChecksumContext* pCSContext) { CXFA_Document* doc = m_pDocumentParser->GetDocument(); - std::unique_ptr<CXFA_DataExporter> pExport(new CXFA_DataExporter(doc)); + auto pExport = pdfium::MakeUnique<CXFA_DataExporter>(doc); CXFA_Node* pNode = code == XFA_HASHCODE_Xfa ? doc->GetRoot() : ToNode(doc->GetXFAObject(code)); if (!pNode) diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index 37f59bd71b..f539c39f76 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -153,8 +153,8 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, m_eScriptType = eScriptType; if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { if (!m_FM2JSContext) { - m_FM2JSContext.reset( - new CXFA_FM2JSContext(m_pIsolate, m_JsContext.get(), m_pDocument)); + m_FM2JSContext = pdfium::MakeUnique<CXFA_FM2JSContext>( + m_pIsolate, m_JsContext.get(), m_pDocument); } CFX_WideTextBuf wsJavaScript; CFX_WideString wsErrorInfo; @@ -492,7 +492,7 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { return false; CFX_ByteString btScript = FX_UTF8Encode(wsScript); - std::unique_ptr<CFXJSE_Value> hRetValue(new CFXJSE_Value(m_pIsolate)); + auto hRetValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent); CFXJSE_Context* pVariablesContext = CreateVariablesContext(pScriptNode, pThisObject); @@ -521,7 +521,7 @@ bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode, bool bRes = false; CFXJSE_Context* pVariableContext = static_cast<CFXJSE_Context*>(lpVariables); std::unique_ptr<CFXJSE_Value> pObject = pVariableContext->GetGlobalObject(); - std::unique_ptr<CFXJSE_Value> hVariableValue(new CFXJSE_Value(m_pIsolate)); + auto hVariableValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); if (!bGetter) { pObject->SetObjectOwnProperty(szPropName, pValue); bRes = true; @@ -545,7 +545,7 @@ void CXFA_ScriptContext::DefineJsClass() { void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const { static const CFX_ByteStringC OBJ_NAME[2] = {"Number", "Date"}; std::unique_ptr<CFXJSE_Value> pObject = pContext->GetGlobalObject(); - std::unique_ptr<CFXJSE_Value> hProp(new CFXJSE_Value(m_pIsolate)); + auto hProp = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); for (int i = 0; i < 2; ++i) { if (pObject->GetObjectProperty(OBJ_NAME[i], hProp.get())) pObject->DeleteObjectProperty(OBJ_NAME[i]); @@ -650,7 +650,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject, } if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute && rndFind.m_pScriptAttribute && nStart < wsExpression.GetLength()) { - std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(m_pIsolate)); + auto pValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); (rndFind.m_Objects.front() ->*(rndFind.m_pScriptAttribute->lpfnCallback))( pValue.get(), false, @@ -733,7 +733,7 @@ CFXJSE_Value* CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) { if (iter != m_mapObjectToValue.end()) return iter->second.get(); - std::unique_ptr<CFXJSE_Value> jsValue(new CFXJSE_Value(m_pIsolate)); + auto jsValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); jsValue->SetObject(pObject, m_pJsClass); CFXJSE_Value* pValue = jsValue.get(); m_mapObjectToValue.insert(std::make_pair(pObject, std::move(jsValue))); diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 949f7864ea..574ef3a458 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -661,7 +661,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( m_pXMLParser->m_dwCheckStatus != 0x03) { return nullptr; } - std::unique_ptr<CFX_ChecksumContext> pChecksum(new CFX_ChecksumContext); + + auto pChecksum = pdfium::MakeUnique<CFX_ChecksumContext>(); pChecksum->StartChecksum(); pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0], m_pXMLParser->m_nSize[0]); diff --git a/xfa/fxfa/parser/cxfa_xml_parser.cpp b/xfa/fxfa/parser/cxfa_xml_parser.cpp index ebde399931..72564d9fe5 100644 --- a/xfa/fxfa/parser/cxfa_xml_parser.cpp +++ b/xfa/fxfa/parser/cxfa_xml_parser.cpp @@ -6,13 +6,15 @@ #include "xfa/fxfa/parser/cxfa_xml_parser.h" +#include "third_party/base/ptr_util.h" + CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pParent, const CFX_RetainPtr<IFGAS_Stream>& pStream) : m_nElementStart(0), m_dwCheckStatus(0), m_dwCurrentCheckStatus(0), m_pStream(pStream), - m_pParser(new CFDE_XMLSyntaxParser), + m_pParser(pdfium::MakeUnique<CFDE_XMLSyntaxParser>()), m_pParent(pParent), m_pChild(nullptr), m_syntaxParserResult(FDE_XmlSyntaxResult::None) { |