summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfdoc/cpdf_pagelabel.cpp4
-rw-r--r--fxjs/cjs_event_context.cpp2
-rw-r--r--fxjs/cjs_publicmethods.cpp26
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp7
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp4
6 files changed, 20 insertions, 25 deletions
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index e6a7780a95..d6f9220c26 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -143,7 +143,5 @@ int32_t CPDF_PageLabel::GetPageByLabel(const ByteStringView& bsLabel) const {
}
int32_t CPDF_PageLabel::GetPageByLabel(const WideStringView& wsLabel) const {
- // TODO(tsepez): check usage of c_str() below.
- return GetPageByLabel(
- PDF_EncodeText(wsLabel.unterminated_c_str()).AsStringView());
+ return GetPageByLabel(PDF_EncodeText(WideString(wsLabel)).AsStringView());
}
diff --git a/fxjs/cjs_event_context.cpp b/fxjs/cjs_event_context.cpp
index 50149c4172..70f06771d1 100644
--- a/fxjs/cjs_event_context.cpp
+++ b/fxjs/cjs_event_context.cpp
@@ -50,7 +50,7 @@ Optional<IJS_Runtime::JS_Error> CJS_EventContext::RunScript(
Optional<IJS_Runtime::JS_Error> err;
if (script.GetLength() > 0)
- err = m_pRuntime->ExecuteScript(script.c_str());
+ err = m_pRuntime->ExecuteScript(script);
m_pRuntime->RemoveEventFromSet(event);
m_pEventHandler->Destroy();
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 2bc68fa6d3..58a54e5212 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -79,7 +79,7 @@ T StrTrim(const T& str) {
return result;
}
-void AlertIfPossible(CJS_EventContext* pContext, const wchar_t* swMsg) {
+void AlertIfPossible(CJS_EventContext* pContext, const WideString& swMsg) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = pContext->GetFormFillEnv();
if (pFormFillEnv)
pFormFillEnv->JS_appAlert(swMsg, WideString(), 0, 3);
@@ -648,7 +648,7 @@ double CJS_PublicMethods::MakeRegularDate(const WideString& value,
sMonth.MakeLower();
for (int m = 0; m < 12; m++) {
- WideString sFullMonths = kFullMonths[m];
+ WideString sFullMonths = WideString(kFullMonths[m]);
sFullMonths.MakeLower();
if (sFullMonths.Contains(sMonth.c_str())) {
@@ -997,10 +997,10 @@ CJS_Return CJS_PublicMethods::AFNumber_Keystroke(
return CJS_Return();
NormalizeDecimalMarkW(&swTemp);
- if (!IsNumber(swTemp.c_str())) {
+ if (!IsNumber(swTemp)) {
pEvent->Rc() = false;
WideString sError = JSGetStringFromID(JSMessage::kInvalidInputError);
- AlertIfPossible(pContext, sError.c_str());
+ AlertIfPossible(pContext, sError);
return CJS_Return(sError);
}
// It happens after the last keystroke and before validating,
@@ -1180,7 +1180,7 @@ CJS_Return CJS_PublicMethods::AFDate_FormatEx(
if (std::isnan(dDate)) {
WideString swMsg = WideString::Format(
JSGetStringFromID(JSMessage::kParseDateError).c_str(), sFormat.c_str());
- AlertIfPossible(pContext, swMsg.c_str());
+ AlertIfPossible(pContext, swMsg);
return CJS_Return(JSMessage::kParseDateError);
}
@@ -1250,7 +1250,7 @@ CJS_Return CJS_PublicMethods::AFDate_KeystrokeEx(
WideString swMsg = WideString::Format(
JSGetStringFromID(JSMessage::kParseDateError).c_str(),
sFormat.c_str());
- AlertIfPossible(pContext, swMsg.c_str());
+ AlertIfPossible(pContext, swMsg);
pEvent->Rc() = false;
return CJS_Return();
}
@@ -1426,7 +1426,7 @@ CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
if (iIndexMask != wstrMask.GetLength() ||
(iIndexMask != valEvent.GetLength() && wstrMask.GetLength() != 0)) {
AlertIfPossible(pContext,
- JSGetStringFromID(JSMessage::kInvalidInputError).c_str());
+ JSGetStringFromID(JSMessage::kInvalidInputError));
pEvent->Rc() = false;
}
return CJS_Return();
@@ -1441,15 +1441,13 @@ CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
size_t combined_len = valEvent.GetLength() + wChange.GetLength() +
pEvent->SelStart() - pEvent->SelEnd();
if (combined_len > wstrMask.GetLength()) {
- AlertIfPossible(pContext,
- JSGetStringFromID(JSMessage::kParamTooLongError).c_str());
+ AlertIfPossible(pContext, JSGetStringFromID(JSMessage::kParamTooLongError));
pEvent->Rc() = false;
return CJS_Return();
}
if (iIndexMask >= wstrMask.GetLength() && !wChange.IsEmpty()) {
- AlertIfPossible(pContext,
- JSGetStringFromID(JSMessage::kParamTooLongError).c_str());
+ AlertIfPossible(pContext, JSGetStringFromID(JSMessage::kParamTooLongError));
pEvent->Rc() = false;
return CJS_Return();
}
@@ -1457,7 +1455,7 @@ CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
for (size_t i = 0; i < wChange.GetLength(); ++i) {
if (iIndexMask >= wstrMask.GetLength()) {
AlertIfPossible(pContext,
- JSGetStringFromID(JSMessage::kParamTooLongError).c_str());
+ JSGetStringFromID(JSMessage::kParamTooLongError));
pEvent->Rc() = false;
return CJS_Return();
}
@@ -1544,7 +1542,7 @@ CJS_Return CJS_PublicMethods::AFParseDateEx(
if (std::isnan(dDate)) {
WideString swMsg = WideString::Format(
JSGetStringFromID(JSMessage::kParseDateError).c_str(), sFormat.c_str());
- AlertIfPossible(pRuntime->GetCurrentEventContext(), swMsg.c_str());
+ AlertIfPossible(pRuntime->GetCurrentEventContext(), swMsg);
return CJS_Return(JSMessage::kParseDateError);
}
return CJS_Return(pRuntime->NewNumber(dDate));
@@ -1710,7 +1708,7 @@ CJS_Return CJS_PublicMethods::AFRange_Validate(
}
if (!swMsg.IsEmpty()) {
- AlertIfPossible(pContext, swMsg.c_str());
+ AlertIfPossible(pContext, swMsg);
pEvent->Rc() = false;
}
return CJS_Return();
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index 8bafc7f078..599662a160 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -1000,10 +1000,9 @@ void CXFA_DocumentParser::ParseDataGroup(CXFA_Node* pXFANode,
pXFAMetaData->SetFlag(XFA_NodeFlag_Initialized);
}
- if (!bNeedValue) {
- WideString wsNilName(L"xsi:nil");
- pXMLElement->RemoveAttribute(wsNilName.c_str());
- }
+ if (!bNeedValue)
+ pXMLElement->RemoveAttribute(L"xsi:nil");
+
pXFANode->InsertChild(pXFAChild, nullptr);
if (eNodeType == XFA_Element::DataGroup)
ParseDataGroup(pXFAChild, pXMLElement, ePacketID);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 6672e7fb29..00ea7b7a1b 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1245,7 +1245,7 @@ void CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
static_cast<CFX_XMLElement*>(pNode->xml_node_.Get());
WideString wsAttributeName =
pNode->JSObject()->GetCData(XFA_Attribute::QualifiedName);
- pXMLElement->RemoveAttribute(wsAttributeName.c_str());
+ pXMLElement->RemoveAttribute(wsAttributeName);
}
WideString wsName = pNode->JSObject()
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 9418ec8eda..b42da0b4a1 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -474,8 +474,8 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement* pNode,
continue;
auto* pElement = static_cast<CFX_XMLElement*>(pParent);
- if (pElement->HasAttribute(wsNSAttribute.c_str())) {
- *wsNamespaceURI = pElement->GetAttribute(wsNSAttribute.c_str());
+ if (pElement->HasAttribute(wsNSAttribute)) {
+ *wsNamespaceURI = pElement->GetAttribute(wsNSAttribute);
return true;
}
}