summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_csssyntaxparser.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-08 10:05:05 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-09 15:55:20 +0000
commit21e954b59fcef1b84fdcdb9ae337e2d4c060b19e (patch)
tree2053cd0a8b0d4c1bb6903db3aa6f753a23afedcf /xfa/fde/css/cfde_csssyntaxparser.cpp
parent1b08df18300bbc67dabd12fb35ab6ce1732a1024 (diff)
downloadpdfium-21e954b59fcef1b84fdcdb9ae337e2d4c060b19e.tar.xz
Remove CopyToLocal from CFDE_CSSDeclaration
This CL removes the CopyToLocal method and creates CFX_WideString's directly. This fixes several memory leaks as the CopyToLocal strings were not cleaned up correctly. Change-Id: Ie5ba4cdc4d713cd0b8e3fb85e02f27dc09f38af1 Reviewed-on: https://pdfium-review.googlesource.com/2553 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_csssyntaxparser.cpp')
-rw-r--r--xfa/fde/css/cfde_csssyntaxparser.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/xfa/fde/css/cfde_csssyntaxparser.cpp b/xfa/fde/css/cfde_csssyntaxparser.cpp
index f562a374ac..2f7bcce9d7 100644
--- a/xfa/fde/css/cfde_csssyntaxparser.cpp
+++ b/xfa/fde/css/cfde_csssyntaxparser.cpp
@@ -22,7 +22,7 @@ bool IsSelectorStart(FX_WCHAR wch) {
} // namespace
CFDE_CSSSyntaxParser::CFDE_CSSSyntaxParser()
- : m_iTextDatLen(0),
+ : m_iTextDataLen(0),
m_dwCheck((uint32_t)-1),
m_eMode(FDE_CSSSyntaxMode::RuleSet),
m_eStatus(FDE_CSSSyntaxStatus::None) {}
@@ -46,7 +46,7 @@ bool CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer,
void CFDE_CSSSyntaxParser::Reset(bool bOnlyDeclaration) {
m_TextPlane.Reset();
m_TextData.Reset();
- m_iTextDatLen = 0;
+ m_iTextDataLen = 0;
m_dwCheck = (uint32_t)-1;
m_eStatus = FDE_CSSSyntaxStatus::None;
m_eMode = bOnlyDeclaration ? FDE_CSSSyntaxMode::PropertyName
@@ -102,7 +102,7 @@ FDE_CSSSyntaxStatus CFDE_CSSSyntaxParser::DoSyntaxParse() {
case ',':
m_TextPlane.MoveNext();
SwitchMode(FDE_CSSSyntaxMode::Selector);
- if (m_iTextDatLen > 0)
+ if (m_iTextDataLen > 0)
return FDE_CSSSyntaxStatus::Selector;
break;
case '{':
@@ -208,9 +208,9 @@ bool CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) {
}
int32_t CFDE_CSSSyntaxParser::SaveTextData() {
- m_iTextDatLen = m_TextData.TrimEnd();
+ m_iTextDataLen = m_TextData.TrimEnd();
m_TextData.Clear();
- return m_iTextDatLen;
+ return m_iTextDataLen;
}
void CFDE_CSSSyntaxParser::SwitchMode(FDE_CSSSyntaxMode eMode) {
@@ -234,7 +234,6 @@ bool CFDE_CSSSyntaxParser::RestoreMode() {
return true;
}
-const FX_WCHAR* CFDE_CSSSyntaxParser::GetCurrentString(int32_t& iLength) const {
- iLength = m_iTextDatLen;
- return m_TextData.GetBuffer();
+CFX_WideStringC CFDE_CSSSyntaxParser::GetCurrentString() const {
+ return CFX_WideStringC(m_TextData.GetBuffer(), m_iTextDataLen);
}