summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdf_dataavail.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-01-26 14:44:19 -0800
committerTom Sepez <tsepez@chromium.org>2016-01-26 14:44:19 -0800
commitbadb41230bae96cba8fc481de47592836e3f43f8 (patch)
tree7ff569f1d97c93594a43f78d5a0f622cc0626e0a /fpdfsdk/src/fpdf_dataavail.cpp
parent0ec8bb4486ab315283f36d071be2ddc1b80998c3 (diff)
downloadpdfium-badb41230bae96cba8fc481de47592836e3f43f8.tar.xz
Merge to Master: War on #defines - part 2
Original Review URL: https://codereview.chromium.org/1634123004 . (cherry picked from commit f10ae634e7b198b18942baaf9f111f07cc8ce818) R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1640473002 .
Diffstat (limited to 'fpdfsdk/src/fpdf_dataavail.cpp')
-rw-r--r--fpdfsdk/src/fpdf_dataavail.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp
index f4e235ccf5..baf8f9c924 100644
--- a/fpdfsdk/src/fpdf_dataavail.cpp
+++ b/fpdfsdk/src/fpdf_dataavail.cpp
@@ -122,19 +122,20 @@ FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints) {
DLLEXPORT FPDF_DOCUMENT STDCALL
FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) {
- if (!avail)
+ CFPDF_DataAvail* pDataAvail = static_cast<CFPDF_DataAvail*>(avail);
+ if (!pDataAvail)
return NULL;
+
CPDF_Parser* pParser = new CPDF_Parser;
pParser->SetPassword(password);
-
- FX_DWORD err_code = pParser->StartAsynParse(
- ((CFPDF_DataAvail*)avail)->m_pDataAvail->GetFileRead());
- if (err_code) {
+ CPDF_Parser::Error error =
+ pParser->StartAsynParse(pDataAvail->m_pDataAvail->GetFileRead());
+ if (error != CPDF_Parser::SUCCESS) {
delete pParser;
- ProcessParseError(err_code);
+ ProcessParseError(error);
return NULL;
}
- ((CFPDF_DataAvail*)avail)->m_pDataAvail->SetDocument(pParser->GetDocument());
+ pDataAvail->m_pDataAvail->SetDocument(pParser->GetDocument());
CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS);
return FPDFDocumentFromCPDFDocument(pParser->GetDocument());
}