summaryrefslogtreecommitdiff
path: root/xfa/fde
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
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')
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp2
-rw-r--r--xfa/fde/css/cfde_csstextbuf.cpp2
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser.cpp8
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser.h2
4 files changed, 8 insertions, 6 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index b6471766db..86a501559f 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -123,7 +123,7 @@ void CFDE_TxtEdtEngine::SetTextByStream(
wchar_t* lpwstr = FX_Alloc(wchar_t, nPlateSize);
bool bEos = false;
while (!bEos) {
- int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, bEos);
+ int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, &bEos);
bPreIsCR = ReplaceParagEnd(lpwstr, nRead, bPreIsCR);
m_pTxtBuf->Insert(nIndex, lpwstr, nRead);
nIndex += nRead;
diff --git a/xfa/fde/css/cfde_csstextbuf.cpp b/xfa/fde/css/cfde_csstextbuf.cpp
index b8d8b197ae..149ed31e98 100644
--- a/xfa/fde/css/cfde_csstextbuf.cpp
+++ b/xfa/fde/css/cfde_csstextbuf.cpp
@@ -55,7 +55,7 @@ int32_t CFDE_CSSTextBuf::LoadFromStream(
if (pTxtStream->GetPosition() != iStreamOffset)
pTxtStream->Seek(FX_STREAMSEEK_Begin, iStreamOffset);
- m_iDatLen = pTxtStream->ReadString(m_pBuffer, iMaxChars, bEOS);
+ m_iDatLen = pTxtStream->ReadString(m_pBuffer, iMaxChars, &bEOS);
return m_iDatLen;
}
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;