summaryrefslogtreecommitdiff
path: root/xfa/fde/xml
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-13 17:03:37 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-13 21:15:02 +0000
commit7b7c6532310eeeabadae7b34fdf86f4a890951e8 (patch)
treebc4b3c20ae1dd5bdd82dbda9622448298fe57426 /xfa/fde/xml
parent7062b2632ffa351903e508003788b67a8c8aba77 (diff)
downloadpdfium-7b7c6532310eeeabadae7b34fdf86f4a890951e8.tar.xz
Fold LoadFile{Read|Write} back into constructors
The load file methods are always called right after creating the class. This Cl moves their code up into the constructor and then changes the other code to assume that the m_pFile{Read|Write} always exists. Change-Id: I015abf71ea4804d02d4f6f94b97eb1e7855e1fc4 Reviewed-on: https://pdfium-review.googlesource.com/4110 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde/xml')
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser.cpp8
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
index 51507526c2..78382058ec 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
@@ -105,10 +105,12 @@ CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser(
m_CurNode.iNodeNum = -1;
m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
- m_iXMLPlaneSize = std::min(m_iXMLPlaneSize, m_pStream->GetLength());
+ m_iXMLPlaneSize =
+ std::min(m_iXMLPlaneSize,
+ pdfium::base::checked_cast<FX_STRSIZE>(m_pStream->GetLength()));
m_iCurrentPos = m_pStream->GetBOMLength();
- FX_SAFE_INT32 alloc_size_safe = m_iXMLPlaneSize;
+ FX_SAFE_STRSIZE alloc_size_safe = m_iXMLPlaneSize;
alloc_size_safe += 1; // For NUL.
if (!alloc_size_safe.IsValid() || alloc_size_safe.ValueOrDie() <= 0) {
m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
@@ -146,7 +148,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
m_pStream->Seek(FX_STREAMSEEK_Begin, m_iCurrentPos);
}
m_iBufferChars =
- m_pStream->ReadString(m_Buffer.data(), m_iXMLPlaneSize, m_bEOS);
+ m_pStream->ReadString(m_Buffer.data(), m_iXMLPlaneSize, &m_bEOS);
iPos = m_pStream->GetPosition();
if (m_iBufferChars < 1) {
m_iCurrentPos = iStreamLength;
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.h b/xfa/fde/xml/cfde_xmlsyntaxparser.h
index 9f1274fa83..f229cc02b1 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser.h
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser.h
@@ -98,7 +98,7 @@ class CFDE_XMLSyntaxParser {
void ParseTextChar(wchar_t ch);
CFX_RetainPtr<IFGAS_Stream> m_pStream;
- int32_t m_iXMLPlaneSize;
+ FX_STRSIZE m_iXMLPlaneSize;
int32_t m_iCurrentPos;
int32_t m_iCurrentNodeNum;
int32_t m_iLastNodeNum;