From 9b8b217e6f8f2ff03b09d6075e689804928c7b3c Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 25 Apr 2018 22:12:34 +0000 Subject: Replace reinterpret_cast with static_cast where possible Change-Id: Ic62f1def8e043494c9fa6c08a937d7d872513567 Reviewed-on: https://pdfium-review.googlesource.com/31314 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- core/fpdfapi/parser/cpdf_crypto_handler.cpp | 4 ++-- core/fxcodec/bmp/cfx_bmpdecompressor.cpp | 2 +- fpdfsdk/cpdfsdk_xfawidgethandler.cpp | 2 +- fpdfsdk/fpdf_catalog_unittest.cpp | 2 +- fpdfsdk/fpdf_doc_unittest.cpp | 2 +- fpdfsdk/fpdf_view.cpp | 2 +- fxjs/cjs_runtime.cpp | 2 +- fxjs/ijs_runtime.cpp | 2 +- fxjs/xfa/cjx_object.cpp | 2 +- xfa/fxfa/parser/cxfa_document_parser.cpp | 4 ++-- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp index c27f9dc9fc..76be23e9d6 100644 --- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp +++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp @@ -180,11 +180,11 @@ bool CPDF_CryptoHandler::CryptStream(void* context, if (m_Cipher == FXCIPHER_RC4) { int old_size = dest_buf.GetSize(); dest_buf.AppendBlock(src_buf, src_size); - CRYPT_ArcFourCrypt(reinterpret_cast(context), + CRYPT_ArcFourCrypt(static_cast(context), dest_buf.GetBuffer() + old_size, src_size); return true; } - AESCryptContext* pContext = reinterpret_cast(context); + AESCryptContext* pContext = static_cast(context); if (pContext->m_bIV && bEncrypt) { dest_buf.AppendBlock(pContext->m_Block, 16); pContext->m_bIV = false; diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp index 4494198b43..b490004853 100644 --- a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp +++ b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp @@ -66,7 +66,7 @@ void CFX_BmpDecompressor::Error() { void CFX_BmpDecompressor::ReadScanline(uint32_t row_num_, const std::vector& row_buf) { - auto* p = reinterpret_cast(context_ptr_); + auto* p = static_cast(context_ptr_); p->m_pDelegate->BmpReadScanline(row_num_, row_buf); } diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp index 16692b3d25..1a8ec69ba2 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp @@ -70,7 +70,7 @@ void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView, void CPDFSDK_XFAWidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {} void CPDFSDK_XFAWidgetHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { - CPDFSDK_XFAWidget* pWidget = reinterpret_cast(pAnnot); + CPDFSDK_XFAWidget* pWidget = static_cast(pAnnot); CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); diff --git a/fpdfsdk/fpdf_catalog_unittest.cpp b/fpdfsdk/fpdf_catalog_unittest.cpp index 5bb55594eb..648cb24e7a 100644 --- a/fpdfsdk/fpdf_catalog_unittest.cpp +++ b/fpdfsdk/fpdf_catalog_unittest.cpp @@ -36,7 +36,7 @@ class CPDF_TestXFAContext : public CPDFXFA_Context { : CPDFXFA_Context(pdfium::MakeUnique()) {} void SetRoot(CPDF_Dictionary* root) { - reinterpret_cast(GetPDFDoc())->SetRoot(root); + static_cast(GetPDFDoc())->SetRoot(root); } CPDF_IndirectObjectHolder* GetHolder() { return GetPDFDoc(); } diff --git a/fpdfsdk/fpdf_doc_unittest.cpp b/fpdfsdk/fpdf_doc_unittest.cpp index 0aea5534da..bfd42628d1 100644 --- a/fpdfsdk/fpdf_doc_unittest.cpp +++ b/fpdfsdk/fpdf_doc_unittest.cpp @@ -41,7 +41,7 @@ class CPDF_TestXFAContext : public CPDFXFA_Context { : CPDFXFA_Context(pdfium::MakeUnique()) {} void SetRoot(CPDF_Dictionary* root) { - reinterpret_cast(GetPDFDoc())->SetRoot(root); + static_cast(GetPDFDoc())->SetRoot(root); } CPDF_IndirectObjectHolder* GetHolder() { return GetPDFDoc(); } diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index 28e42a8e81..0015716d98 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -1158,5 +1158,5 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document, } else { *buflen = -1; } - return (FPDF_DEST)pDestObj; + return pDestObj; } diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp index 3a607f1aae..f6e7b2d18a 100644 --- a/fxjs/cjs_runtime.cpp +++ b/fxjs/cjs_runtime.cpp @@ -64,7 +64,7 @@ CJS_Runtime::CJS_Runtime(CPDFSDK_FormFillEnvironment* pFormFillEnv) unsigned int embedderDataSlot = 0; v8::Isolate* pExternalIsolate = nullptr; if (pPlatform->version == 2) { - pExternalIsolate = reinterpret_cast(pPlatform->m_isolate); + pExternalIsolate = static_cast(pPlatform->m_isolate); embedderDataSlot = pPlatform->m_v8EmbedderSlot; } FXJS_Initialize(embedderDataSlot, pExternalIsolate); diff --git a/fxjs/ijs_runtime.cpp b/fxjs/ijs_runtime.cpp index 79238bfe11..3f4bcd2497 100644 --- a/fxjs/ijs_runtime.cpp +++ b/fxjs/ijs_runtime.cpp @@ -16,7 +16,7 @@ // static void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { #ifdef PDF_ENABLE_V8 - FXJS_Initialize(slot, reinterpret_cast(isolate)); + FXJS_Initialize(slot, static_cast(isolate)); #endif } diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index 2ea69d43c8..0ac2f44123 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -424,7 +424,7 @@ Optional CJX_Object::TryMeasure(XFA_Attribute eAttr, int32_t iBytes; if (GetMapModuleBuffer(pKey, pValue, iBytes, true) && iBytes == sizeof(CXFA_Measurement)) { - return {*reinterpret_cast(pValue)}; + return {*static_cast(pValue)}; } if (!bUseDefault) return {}; diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index e4f85f2bac..f773a36897 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -127,7 +127,7 @@ bool MatchNodeName(CFX_XMLNode* pNode, if (!pNode || pNode->GetType() != FX_XMLNODE_Element) return false; - CFX_XMLElement* pElement = reinterpret_cast(pNode); + CFX_XMLElement* pElement = static_cast(pNode); WideString wsNodeStr = pElement->GetLocalTagName(); if (wsNodeStr != wsLocalTagName) return false; @@ -487,7 +487,7 @@ CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_XDP( if (pChildItem == pXMLConfigDOMRoot) continue; - CFX_XMLElement* pElement = reinterpret_cast(pChildItem); + CFX_XMLElement* pElement = static_cast(pChildItem); WideString wsPacketName = pElement->GetLocalTagName(); const PacketInfo* pPacketInfo = GetPacketByName(wsPacketName.AsStringView()); -- cgit v1.2.3