summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/css/cfde_cssdeclaration.cpp3
-rw-r--r--xfa/fde/css/cfde_cssselector.cpp2
-rw-r--r--xfa/fgas/crt/cfgas_formatstring.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp5
-rw-r--r--xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp26
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmlexer.cpp2
-rw-r--r--xfa/fxfa/parser/cscript_hostpseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_data.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_measurement.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp7
-rw-r--r--xfa/fxfa/parser/cxfa_resolveprocessor.cpp2
12 files changed, 31 insertions, 26 deletions
diff --git a/xfa/fde/css/cfde_cssdeclaration.cpp b/xfa/fde/css/cfde_cssdeclaration.cpp
index 00a2c9e33c..e15e5f7fe7 100644
--- a/xfa/fde/css/cfde_cssdeclaration.cpp
+++ b/xfa/fde/css/cfde_cssdeclaration.cpp
@@ -160,9 +160,8 @@ void CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyTable* pTable,
const CFX_WideStringC& value) {
ASSERT(!value.IsEmpty());
- const wchar_t* pszValue = value.c_str();
+ const wchar_t* pszValue = value.unterminated_c_str();
int32_t iValueLen = value.GetLength();
-
bool bImportant = false;
if (iValueLen >= 10 && pszValue[iValueLen - 10] == '!' &&
FXSYS_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) {
diff --git a/xfa/fde/css/cfde_cssselector.cpp b/xfa/fde/css/cfde_cssselector.cpp
index c1e9f7f22a..ad2ec40c2b 100644
--- a/xfa/fde/css/cfde_cssselector.cpp
+++ b/xfa/fde/css/cfde_cssselector.cpp
@@ -52,7 +52,7 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString(
const CFX_WideStringC& str) {
ASSERT(!str.IsEmpty());
- const wchar_t* psz = str.c_str();
+ const wchar_t* psz = str.unterminated_c_str();
const wchar_t* pStart = psz;
const wchar_t* pEnd = psz + str.GetLength();
for (; psz < pEnd; ++psz) {
diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp
index a9e5f7c795..0abc86fbf3 100644
--- a/xfa/fgas/crt/cfgas_formatstring.cpp
+++ b/xfa/fgas/crt/cfgas_formatstring.cpp
@@ -769,7 +769,7 @@ bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
if (wsTime.GetLength() == 0)
return false;
- const wchar_t* str = wsTime.c_str();
+ const wchar_t* str = wsTime.unterminated_c_str();
int len = wsTime.GetLength();
int cc = 0;
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 90a144fcc1..e863a0e0d3 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -291,8 +291,9 @@ bool CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily,
m_pFontMgr = CFGAS_FontMgr::Create(m_pFontSource.get());
#endif
}
- m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles,
- dwCodePage, m_pFontMgr.get());
+ // TODO(tsepez): check usage of c_str() below.
+ m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.unterminated_c_str(),
+ dwFontStyles, dwCodePage, m_pFontMgr.get());
return !!m_pFont;
}
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
index 8c94444075..5f1a4d2989 100644
--- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
@@ -1970,8 +1970,8 @@ int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) {
int32_t iDay = 0;
if (iLength <= 10) {
int32_t iStyle = -1;
- if (!IsIsoDateFormat(szDateString.c_str(), iLength, iStyle, iYear, iMonth,
- iDay)) {
+ if (!IsIsoDateFormat(szDateString.unterminated_c_str(), iLength, iStyle,
+ iYear, iMonth, iDay)) {
return 0;
}
} else {
@@ -1981,9 +1981,9 @@ int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) {
int32_t iMilliSecond = 0;
int32_t iZoneHour = 0;
int32_t iZoneMinute = 0;
- if (!IsIsoDateTimeFormat(szDateString.c_str(), iLength, iYear, iMonth, iDay,
- iHour, iMinute, iSecond, iMilliSecond, iZoneHour,
- iZoneMinute)) {
+ if (!IsIsoDateTimeFormat(szDateString.unterminated_c_str(), iLength, iYear,
+ iMonth, iDay, iHour, iMinute, iSecond,
+ iMilliSecond, iZoneHour, iZoneMinute)) {
return 0;
}
}
@@ -3516,7 +3516,8 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString,
// static
void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString,
CFX_ByteTextBuf& szResultBuf) {
- CFX_ByteString str = szHTMLString.c_str();
+ // TODO(tsepez): check usage of c_str() below.
+ CFX_ByteString str = szHTMLString.unterminated_c_str();
CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str.AsStringC());
const wchar_t* strCode = L"0123456789abcdef";
wchar_t strEncode[9];
@@ -3637,13 +3638,14 @@ bool CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData,
uint32_t* iCode) {
auto cmpFunc = [](const XFA_FMHtmlReserveCode& iter,
const CFX_WideStringC& val) {
- return wcscmp(val.c_str(), iter.m_htmlReserve) > 0;
+ // TODO(tsepez): check usage of c_str() below.
+ return wcscmp(val.unterminated_c_str(), iter.m_htmlReserve) > 0;
};
const XFA_FMHtmlReserveCode* result =
std::lower_bound(std::begin(reservesForDecode),
std::end(reservesForDecode), pData, cmpFunc);
if (result != std::end(reservesForEncode) &&
- !wcscmp(pData.c_str(), result->m_htmlReserve)) {
+ !wcscmp(pData.unterminated_c_str(), result->m_htmlReserve)) {
*iCode = result->m_uCode;
return true;
}
@@ -4424,7 +4426,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData,
"Sixty", "Seventy", "Eighty", "Ninety"};
CFX_ByteStringC pComm[] = {" Hundred ", " Thousand ", " Million ",
" Billion ", "Trillion"};
- const char* pData = szData.c_str();
+ const char* pData = szData.unterminated_c_str();
int32_t iLength = szData.GetLength();
int32_t iComm = 0;
if (iLength > 12)
@@ -4513,7 +4515,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData,
void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData,
int32_t iStyle,
CFX_ByteTextBuf& strBuf) {
- const char* pData = szData.c_str();
+ const char* pData = szData.unterminated_c_str();
int32_t iLength = szData.GetLength();
if (iStyle < 0 || iStyle > 2) {
return;
@@ -6094,7 +6096,9 @@ void CXFA_FM2JSContext::GlobalPropertyGetter(CFXJSE_Value* pValue) {
void CXFA_FM2JSContext::ThrowNoDefaultPropertyException(
const CFX_ByteStringC& name) const {
- ThrowException(L"%.16S doesn't have a default property.", name.c_str());
+ // TODO(tsepez): check usage of c_str() below.
+ ThrowException(L"%.16S doesn't have a default property.",
+ name.unterminated_c_str());
}
void CXFA_FM2JSContext::ThrowCompilerErrorException() const {
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
index 908cd2f04a..6b8508a503 100644
--- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
@@ -111,7 +111,7 @@ CXFA_FMToken::CXFA_FMToken(uint32_t uLineNum)
CXFA_FMToken::~CXFA_FMToken() {}
CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc)
- : m_ptr(wsFormCalc.c_str()),
+ : m_ptr(wsFormCalc.unterminated_c_str()),
m_end(m_ptr + wsFormCalc.GetLength() - 1),
m_uCurrentLine(1),
m_LexerError(false) {}
diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
index b229b23151..d9eb5d699f 100644
--- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
@@ -325,7 +325,7 @@ static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression,
}
wchar_t* pBuf = wsFilter.GetBuffer(iLength - nStart);
int32_t nCount = 0;
- const wchar_t* pSrc = wsExpression.c_str();
+ const wchar_t* pSrc = wsExpression.unterminated_c_str();
wchar_t wCur;
while (nStart < iLength) {
wCur = pSrc[nStart++];
diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp
index bdfc25c79c..7bf18a5d3e 100644
--- a/xfa/fxfa/parser/cxfa_data.cpp
+++ b/xfa/fxfa/parser/cxfa_data.cpp
@@ -17,7 +17,7 @@ FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) {
return 0xff000000;
int cc = 0;
- const wchar_t* str = wsValue.c_str();
+ const wchar_t* str = wsValue.unterminated_c_str();
int len = wsValue.GetLength();
while (FXSYS_iswspace(str[cc]) && cc < len)
cc++;
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index b6e6e7f8e9..694b24dc27 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -1748,7 +1748,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
: containerSize.width - fLeftInset - fRightInset;
CFX_WideStringC wsColumnWidths;
if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) {
- auto widths = SeparateStringW(wsColumnWidths.c_str(),
+ auto widths = SeparateStringW(wsColumnWidths.unterminated_c_str(),
wsColumnWidths.GetLength(), L' ');
for (auto& width : widths) {
width.TrimLeft(L' ');
diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp
index 9173223d3c..70420d7b5e 100644
--- a/xfa/fxfa/parser/cxfa_measurement.cpp
+++ b/xfa/fxfa/parser/cxfa_measurement.cpp
@@ -28,7 +28,7 @@ void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) {
}
int32_t iUsedLen = 0;
int32_t iOffset = (wsMeasure.GetAt(0) == L'=') ? 1 : 0;
- float fValue = FXSYS_wcstof(wsMeasure.c_str() + iOffset,
+ float fValue = FXSYS_wcstof(wsMeasure.unterminated_c_str() + iOffset,
wsMeasure.GetLength() - iOffset, &iUsedLen);
XFA_UNIT eUnit = GetUnit(wsMeasure.Mid(iOffset + iUsedLen));
Set(fValue, eUnit);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 845d3f379d..5c4f8d102e 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -3591,7 +3591,7 @@ bool CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr,
return SetBoolean(pAttr->eName, wsValue != L"0", bNotify);
case XFA_ATTRIBUTETYPE_Integer:
return SetInteger(pAttr->eName,
- FXSYS_round(FXSYS_wcstof(wsValue.c_str(),
+ FXSYS_round(FXSYS_wcstof(wsValue.unterminated_c_str(),
wsValue.GetLength(), nullptr)),
bNotify);
case XFA_ATTRIBUTETYPE_Measure:
@@ -4554,7 +4554,8 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
static_cast<CFX_XMLElement*>(pNode->m_pXMLNode);
CFX_WideStringC wsAttributeName =
pNode->GetCData(XFA_ATTRIBUTE_QualifiedName);
- pXMLElement->RemoveAttribute(wsAttributeName.c_str());
+ // TODO(tsepez): check usage of c_str() below.
+ pXMLElement->RemoveAttribute(wsAttributeName.unterminated_c_str());
}
CFX_WideString wsName;
pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false);
@@ -4850,7 +4851,7 @@ bool CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) {
}
void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) {
- SetMapModuleBuffer(pKey, (void*)wsValue.c_str(),
+ SetMapModuleBuffer(pKey, (void*)wsValue.unterminated_c_str(),
wsValue.GetLength() * sizeof(wchar_t));
}
diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
index add8cb8fcb..93b2d86061 100644
--- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
@@ -502,7 +502,7 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression,
int32_t nConditionCount = 0;
std::vector<int32_t> stack;
int32_t nType = -1;
- const wchar_t* pSrc = wsExpression.c_str();
+ const wchar_t* pSrc = wsExpression.unterminated_c_str();
wchar_t wPrev = 0, wCur;
bool bIsCondition = false;
while (nStart < iLength) {