summaryrefslogtreecommitdiff
path: root/xfa/fde
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-13 21:40:19 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-13 21:40:19 -0700
commitbd9748d504555f100d34025d76a9e0119986bc3f (patch)
tree829a03f0064b6593f6eff9551ed24b862a06006e /xfa/fde
parent6e0d67d4f55fc7cb4632f4c5d08cd7565a237d30 (diff)
downloadpdfium-bd9748d504555f100d34025d76a9e0119986bc3f.tar.xz
Remove implicit cast from CFX_WideString to (const wchar_t*)
BUG= Review URL: https://codereview.chromium.org/1882043004
Diffstat (limited to 'xfa/fde')
-rw-r--r--xfa/fde/css/fde_cssstyleselector.cpp3
-rw-r--r--xfa/fde/css/fde_cssstylesheet.cpp5
-rw-r--r--xfa/fde/tto/fde_textout.cpp6
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp64
4 files changed, 40 insertions, 38 deletions
diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp
index d93a756b3b..60283a6628 100644
--- a/xfa/fde/css/fde_cssstyleselector.cpp
+++ b/xfa/fde/css/fde_cssstyleselector.cpp
@@ -570,7 +570,8 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl,
} else if (iLen > 0) {
psz = pSyntax->GetCurrentString(iLen);
if (iLen > 0) {
- pDecl->AddProperty(&args, wsName, wsName.GetLength(), psz, iLen);
+ pDecl->AddProperty(&args, wsName.c_str(), wsName.GetLength(), psz,
+ iLen);
}
}
} else {
diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp
index 3da7cf41d5..4afb0cee63 100644
--- a/xfa/fde/css/fde_cssstylesheet.cpp
+++ b/xfa/fde/css/fde_cssstylesheet.cpp
@@ -264,8 +264,9 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule(
} else if (iValueLen > 0) {
pszValue = pSyntax->GetCurrentString(iValueLen);
if (iValueLen > 0) {
- pStyleRule->GetDeclImp().AddProperty(
- &propertyArgs, wsName, wsName.GetLength(), pszValue, iValueLen);
+ pStyleRule->GetDeclImp().AddProperty(&propertyArgs, wsName.c_str(),
+ wsName.GetLength(), pszValue,
+ iValueLen);
}
}
break;
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index d846abc886..8e9c30e2ba 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -624,7 +624,7 @@ void CFDE_TextOut::LoadEllipsis() {
return;
}
ExpandBuffer(iLength, 1);
- const FX_WCHAR* pStr = (const FX_WCHAR*)m_wsEllipsis;
+ const FX_WCHAR* pStr = m_wsEllipsis.c_str();
int32_t* pCharWidths = m_pEllCharWidths;
uint32_t dwBreakStatus;
FX_WCHAR wch;
@@ -873,7 +873,7 @@ void CFDE_TextOut::Reload(const CFX_RectF& rect) {
}
}
void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
- const FX_WCHAR* pwsStr = (const FX_WCHAR*)m_wsText;
+ const FX_WCHAR* pwsStr = m_wsText.c_str();
FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
int32_t iPieceWidths = 0;
FDE_LPTTOPIECE pPiece = pLine->GetPtrAt(0);
@@ -990,7 +990,7 @@ int32_t CFDE_TextOut::GetCharRects(FDE_LPTTOPIECE pPiece) {
void CFDE_TextOut::ToTextRun(const FDE_LPTTOPIECE pPiece, FX_TXTRUN& tr) {
tr.pAccess = NULL;
tr.pIdentity = NULL;
- tr.pStr = (const FX_WCHAR*)m_wsText + pPiece->iStartChar;
+ tr.pStr = (m_wsText + pPiece->iStartChar).c_str();
tr.pWidths = m_pCharWidths + pPiece->iStartChar;
tr.iLength = pPiece->iChars;
tr.pFont = m_pFont;
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index 25c4c5abe5..f678cf5cf8 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -397,10 +397,10 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
ws += L"UTF-8";
}
ws += L"\"?>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} else {
- ws.Format(L"<?%s", (const FX_WCHAR*)pInstruction->m_wsTarget);
- pXMLStream->WriteString(ws, ws.GetLength());
+ ws.Format(L"<?%s", pInstruction->m_wsTarget.c_str());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
CFX_WideStringArray& attributes = pInstruction->m_Attributes;
int32_t i, iCount = attributes.GetSize();
CFX_WideString wsValue;
@@ -416,7 +416,7 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
wsValue.Replace(L"\"", L"&quot;");
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
CFX_WideStringArray& targetdata = pInstruction->m_TargetData;
iCount = targetdata.GetSize();
@@ -424,17 +424,17 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
ws = L" \"";
ws += targetdata[i];
ws += L"\"";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
ws = L"?>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
} break;
case FDE_XMLNODE_Element: {
CFX_WideString ws;
ws = L"<";
ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
CFX_WideStringArray& attributes = ((CFDE_XMLElement*)pNode)->m_Attributes;
int32_t iCount = attributes.GetSize();
CFX_WideString wsValue;
@@ -450,14 +450,14 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
wsValue.Replace(L"\"", L"&quot;");
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
if (pNode->m_pChild == NULL) {
ws = L"\n/>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} else {
ws = L"\n>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
CFDE_XMLNode* pChild = pNode->m_pChild;
while (pChild != NULL) {
pChild->SaveXMLNode(pXMLStream);
@@ -466,7 +466,7 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
ws = L"</";
ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
ws += L"\n>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
} break;
case FDE_XMLNODE_Text: {
@@ -476,13 +476,13 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
ws.Replace(L">", L"&gt;");
ws.Replace(L"\'", L"&apos;");
ws.Replace(L"\"", L"&quot;");
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} break;
case FDE_XMLNODE_CharData: {
CFX_WideString ws = L"<![CDATA[";
ws += ((CFDE_XMLCharData*)pNode)->m_wsCharData;
ws += L"]]>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} break;
case FDE_XMLNODE_Unknown:
break;
@@ -580,7 +580,7 @@ int32_t CFDE_XMLInstruction::GetInteger(const FX_WCHAR* pwsAttriName,
int32_t iCount = m_Attributes.GetSize();
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FXSYS_wtoi((const FX_WCHAR*)m_Attributes[i + 1]);
+ return FXSYS_wtoi(m_Attributes[i + 1].c_str());
}
}
return iDefValue;
@@ -596,7 +596,7 @@ FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName,
int32_t iCount = m_Attributes.GetSize();
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FX_wcstof((const FX_WCHAR*)m_Attributes[i + 1]);
+ return FX_wcstof(m_Attributes[i + 1].c_str());
}
}
return fDefValue;
@@ -700,11 +700,11 @@ void CFDE_XMLElement::GetNamespaceURI(CFX_WideString& wsNamespace) const {
break;
}
CFDE_XMLElement* pElement = (CFDE_XMLElement*)pNode;
- if (!pElement->HasAttribute(wsAttri)) {
+ if (!pElement->HasAttribute(wsAttri.c_str())) {
pNode = pNode->GetNodeItem(CFDE_XMLNode::Parent);
continue;
}
- pElement->GetString(wsAttri, wsNamespace);
+ pElement->GetString(wsAttri.c_str(), wsNamespace);
break;
}
}
@@ -766,7 +766,7 @@ int32_t CFDE_XMLElement::GetInteger(const FX_WCHAR* pwsAttriName,
int32_t iCount = m_Attributes.GetSize();
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FXSYS_wtoi((const FX_WCHAR*)m_Attributes[i + 1]);
+ return FXSYS_wtoi(m_Attributes[i + 1].c_str());
}
}
return iDefValue;
@@ -782,7 +782,7 @@ FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName,
int32_t iCount = m_Attributes.GetSize();
for (int32_t i = 0; i < iCount; i += 2) {
if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FX_wcstof((const FX_WCHAR*)m_Attributes[i + 1]);
+ return FX_wcstof(m_Attributes[i + 1].c_str());
}
}
return fDefValue;
@@ -955,10 +955,10 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
ws += L"UTF-8";
}
ws += L"\"?>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} else {
- ws.Format(L"<?%s", (const FX_WCHAR*)pInstruction->m_wsTarget);
- pXMLStream->WriteString(ws, ws.GetLength());
+ ws.Format(L"<?%s", pInstruction->m_wsTarget.c_str());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
CFX_WideStringArray& attributes = pInstruction->m_Attributes;
int32_t i, iCount = attributes.GetSize();
CFX_WideString wsValue;
@@ -974,7 +974,7 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
wsValue.Replace(L"\"", L"&quot;");
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
CFX_WideStringArray& targetdata = pInstruction->m_TargetData;
iCount = targetdata.GetSize();
@@ -982,17 +982,17 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
ws = L" \"";
ws += targetdata[i];
ws += L"\"";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
ws = L"?>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
} break;
case FDE_XMLNODE_Element: {
CFX_WideString ws;
ws = L"<";
ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
CFX_WideStringArray& attributes = ((CFDE_XMLElement*)pNode)->m_Attributes;
int32_t iCount = attributes.GetSize();
CFX_WideString wsValue;
@@ -1008,14 +1008,14 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
wsValue.Replace(L"\"", L"&quot;");
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
if (pNode->m_pChild == NULL) {
ws = L"\n/>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} else {
ws = L"\n>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
CFDE_XMLNode* pChild = pNode->m_pChild;
while (pChild != NULL) {
SaveXMLNode(pXMLStream, static_cast<CFDE_XMLNode*>(pChild));
@@ -1024,7 +1024,7 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
ws = L"</";
ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
ws += L"\n>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
}
} break;
case FDE_XMLNODE_Text: {
@@ -1034,13 +1034,13 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
ws.Replace(L">", L"&gt;");
ws.Replace(L"\'", L"&apos;");
ws.Replace(L"\"", L"&quot;");
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} break;
case FDE_XMLNODE_CharData: {
CFX_WideString ws = L"<![CDATA[";
ws += ((CFDE_XMLCharData*)pNode)->m_wsCharData;
ws += L"]]>";
- pXMLStream->WriteString(ws, ws.GetLength());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
} break;
case FDE_XMLNODE_Unknown:
break;