summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-18 21:34:50 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-18 21:34:50 +0000
commitae2aec8712aa4c52454737467869b9d256baa05f (patch)
treef289d5d3bf744368a0bf443a32055e70ca0fca95 /core
parent84febc1ce83be4e6d5fa7686e4e4af83ba621692 (diff)
downloadpdfium-ae2aec8712aa4c52454737467869b9d256baa05f.tar.xz
Do IWYU for core/fxcrt/xml headers.
Also make more core/fxcrt/xml member variable names consistent in style. Change-Id: I892841b4026df302aa28f754441bf21707e96764 Reviewed-on: https://pdfium-review.googlesource.com/c/44171 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/xml/cfx_xmldocument.h1
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.cpp34
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.h7
3 files changed, 19 insertions, 23 deletions
diff --git a/core/fxcrt/xml/cfx_xmldocument.h b/core/fxcrt/xml/cfx_xmldocument.h
index 7d6f02b48d..9931314ec5 100644
--- a/core/fxcrt/xml/cfx_xmldocument.h
+++ b/core/fxcrt/xml/cfx_xmldocument.h
@@ -13,7 +13,6 @@
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "third_party/base/ptr_util.h"
-class CFX_XMLInstruction;
class CFX_XMLNode;
class CFX_XMLDocument {
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp
index 97ba90d0fe..956aa76b4d 100644
--- a/core/fxcrt/xml/cfx_xmlparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -69,11 +69,10 @@ CFX_XMLParser::CFX_XMLParser(const RetainPtr<IFX_SeekableReadStream>& pStream) {
wCodePage != FX_CODEPAGE_UTF8) {
proxy->SetCodePage(FX_CODEPAGE_UTF8);
}
- m_pStream = proxy;
+ stream_ = proxy;
- m_iXMLPlaneSize =
- std::min(m_iXMLPlaneSize,
- pdfium::base::checked_cast<size_t>(m_pStream->GetSize()));
+ xml_plane_size_ = std::min(
+ xml_plane_size_, pdfium::base::checked_cast<size_t>(stream_->GetSize()));
current_text_.reserve(kCurrentTextReserve);
}
@@ -91,10 +90,10 @@ bool CFX_XMLParser::DoSyntaxParse(CFX_XMLDocument* doc) {
FX_FILESIZE current_buffer_idx = 0;
FX_FILESIZE buffer_size = 0;
- FX_SAFE_SIZE_T alloc_size_safe = m_iXMLPlaneSize;
+ FX_SAFE_SIZE_T alloc_size_safe = xml_plane_size_;
alloc_size_safe += 1; // For NUL.
if (!alloc_size_safe.IsValid() || alloc_size_safe.ValueOrDie() <= 0 ||
- m_iXMLPlaneSize <= 0)
+ xml_plane_size_ <= 0)
return false;
std::vector<wchar_t> buffer;
@@ -110,11 +109,10 @@ bool CFX_XMLParser::DoSyntaxParse(CFX_XMLDocument* doc) {
while (true) {
if (current_buffer_idx >= buffer_size) {
- if (m_pStream->IsEOF())
+ if (stream_->IsEOF())
return true;
- size_t buffer_chars =
- m_pStream->ReadBlock(buffer.data(), m_iXMLPlaneSize);
+ size_t buffer_chars = stream_->ReadBlock(buffer.data(), xml_plane_size_);
if (buffer_chars == 0)
return true;
@@ -261,7 +259,7 @@ bool CFX_XMLParser::DoSyntaxParse(CFX_XMLDocument* doc) {
break;
case FDE_XmlSyntaxState::AttriValue:
if (ch == current_quote_character) {
- if (m_iEntityStart > -1)
+ if (entity_start_ > -1)
return false;
current_quote_character = 0;
@@ -467,13 +465,13 @@ bool CFX_XMLParser::DoSyntaxParse(CFX_XMLDocument* doc) {
void CFX_XMLParser::ProcessTextChar(wchar_t character) {
current_text_.push_back(character);
- if (m_iEntityStart > -1 && character == L';') {
+ if (entity_start_ > -1 && character == L';') {
// Copy the entity out into a string and remove from the vector. When we
// copy the entity we don't want to copy out the & or the ; so we start
// shifted by one and want to copy 2 less characters in total.
- WideString csEntity(current_text_.data() + m_iEntityStart + 1,
- current_text_.size() - m_iEntityStart - 2);
- current_text_.erase(current_text_.begin() + m_iEntityStart,
+ WideString csEntity(current_text_.data() + entity_start_ + 1,
+ current_text_.size() - entity_start_ - 2);
+ current_text_.erase(current_text_.begin() + entity_start_,
current_text_.end());
int32_t iLen = csEntity.GetLength();
@@ -514,9 +512,9 @@ void CFX_XMLParser::ProcessTextChar(wchar_t character) {
}
}
- m_iEntityStart = -1;
- } else if (m_iEntityStart < 0 && character == L'&') {
- m_iEntityStart = current_text_.size() - 1;
+ entity_start_ = -1;
+ } else if (entity_start_ < 0 && character == L'&') {
+ entity_start_ = current_text_.size() - 1;
}
}
@@ -532,7 +530,7 @@ void CFX_XMLParser::ProcessTargetData() {
WideString CFX_XMLParser::GetTextData() {
WideString ret(current_text_.data(), current_text_.size());
- m_iEntityStart = -1;
+ entity_start_ = -1;
current_text_.clear();
current_text_.reserve(kCurrentTextReserve);
return ret;
diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h
index 466968054b..3d7cc78829 100644
--- a/core/fxcrt/xml/cfx_xmlparser.h
+++ b/core/fxcrt/xml/cfx_xmlparser.h
@@ -12,7 +12,6 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/retain_ptr.h"
-#include "core/fxcrt/xml/cfx_xmlnode.h"
class CFX_XMLDocument;
class CFX_XMLElement;
@@ -54,10 +53,10 @@ class CFX_XMLParser {
void ProcessTargetData();
CFX_XMLNode* current_node_ = nullptr;
- RetainPtr<IFX_SeekableReadStream> m_pStream;
+ RetainPtr<IFX_SeekableReadStream> stream_;
std::vector<wchar_t> current_text_;
- size_t m_iXMLPlaneSize = 1024;
- int32_t m_iEntityStart = -1;
+ size_t xml_plane_size_ = 1024;
+ int32_t entity_start_ = -1;
};
#endif // CORE_FXCRT_XML_CFX_XMLPARSER_H_