summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-25 22:12:34 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-25 22:12:34 +0000
commit9b8b217e6f8f2ff03b09d6075e689804928c7b3c (patch)
tree37f19ed798112f86674be18de6ba76b0d73fded1
parentecc1b271aba7d785426b4488dde754e5ce5e4313 (diff)
downloadpdfium-9b8b217e6f8f2ff03b09d6075e689804928c7b3c.tar.xz
Replace reinterpret_cast with static_cast where possible
Change-Id: Ic62f1def8e043494c9fa6c08a937d7d872513567 Reviewed-on: https://pdfium-review.googlesource.com/31314 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--core/fpdfapi/parser/cpdf_crypto_handler.cpp4
-rw-r--r--core/fxcodec/bmp/cfx_bmpdecompressor.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp2
-rw-r--r--fpdfsdk/fpdf_catalog_unittest.cpp2
-rw-r--r--fpdfsdk/fpdf_doc_unittest.cpp2
-rw-r--r--fpdfsdk/fpdf_view.cpp2
-rw-r--r--fxjs/cjs_runtime.cpp2
-rw-r--r--fxjs/ijs_runtime.cpp2
-rw-r--r--fxjs/xfa/cjx_object.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp4
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<CRYPT_rc4_context*>(context),
+ CRYPT_ArcFourCrypt(static_cast<CRYPT_rc4_context*>(context),
dest_buf.GetBuffer() + old_size, src_size);
return true;
}
- AESCryptContext* pContext = reinterpret_cast<AESCryptContext*>(context);
+ AESCryptContext* pContext = static_cast<AESCryptContext*>(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<uint8_t>& row_buf) {
- auto* p = reinterpret_cast<CFX_BmpContext*>(context_ptr_);
+ auto* p = static_cast<CFX_BmpContext*>(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<CPDFSDK_XFAWidget*>(pAnnot);
+ CPDFSDK_XFAWidget* pWidget = static_cast<CPDFSDK_XFAWidget*>(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<CPDF_TestDocument>()) {}
void SetRoot(CPDF_Dictionary* root) {
- reinterpret_cast<CPDF_TestDocument*>(GetPDFDoc())->SetRoot(root);
+ static_cast<CPDF_TestDocument*>(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<CPDF_TestDocument>()) {}
void SetRoot(CPDF_Dictionary* root) {
- reinterpret_cast<CPDF_TestDocument*>(GetPDFDoc())->SetRoot(root);
+ static_cast<CPDF_TestDocument*>(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<v8::Isolate*>(pPlatform->m_isolate);
+ pExternalIsolate = static_cast<v8::Isolate*>(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<v8::Isolate*>(isolate));
+ FXJS_Initialize(slot, static_cast<v8::Isolate*>(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<CXFA_Measurement> CJX_Object::TryMeasure(XFA_Attribute eAttr,
int32_t iBytes;
if (GetMapModuleBuffer(pKey, pValue, iBytes, true) &&
iBytes == sizeof(CXFA_Measurement)) {
- return {*reinterpret_cast<CXFA_Measurement*>(pValue)};
+ return {*static_cast<CXFA_Measurement*>(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<CFX_XMLElement*>(pNode);
+ CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(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<CFX_XMLElement*>(pChildItem);
+ CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pChildItem);
WideString wsPacketName = pElement->GetLocalTagName();
const PacketInfo* pPacketInfo =
GetPacketByName(wsPacketName.AsStringView());