summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-07 20:08:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-07 20:08:56 +0000
commit37ef9577dadc909c5affa6a6d6961557a7e73755 (patch)
tree7e5a6ccafaf938448db732c8598deef7b6f1258c
parent4871395b676802e4c563c4d5bdf62fa6928020c3 (diff)
downloadpdfium-37ef9577dadc909c5affa6a6d6961557a7e73755.tar.xz
Use wide string addition in place of some Format() calls.
Simpler, faster, and avoids platform idiosyncracies of wprintf(). Change-Id: I91676bc38199ca2c30936094ca145239f915bc53 Reviewed-on: https://pdfium-review.googlesource.com/39610 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp27
2 files changed, 13 insertions, 17 deletions
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index e18b099401..88b48b4b65 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -203,8 +203,7 @@ void CXFA_FFTextEdit::ValidateNumberField(const WideString& wsText) {
return;
WideString wsSomField = GetNode()->GetSOMExpression();
- pAppProvider->MsgBox(WideString::Format(L"%ls can not contain %ls",
- wsText.c_str(), wsSomField.c_str()),
+ pAppProvider->MsgBox(wsText + L" can not contain " + wsSomField,
pAppProvider->GetAppTitle(),
static_cast<uint32_t>(AlertIcon::kError),
static_cast<uint32_t>(AlertButton::kOK));
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index f9bc9a4dee..7ff205c6f4 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -2187,8 +2187,7 @@ int32_t CXFA_Node::ProcessNullTestValidate(CXFA_FFDocView* docView,
case XFA_AttributeEnum::Error: {
if (wsNullMsg.IsEmpty()) {
wsCaptionName = GetValidateCaptionName(bVersionFlag);
- wsNullMsg =
- WideString::Format(L"%ls cannot be blank.", wsCaptionName.c_str());
+ wsNullMsg = wsCaptionName + L" cannot be blank.";
}
pAppProvider->MsgBox(wsNullMsg, wsTitle,
static_cast<uint32_t>(AlertIcon::kStatus),
@@ -2201,10 +2200,9 @@ int32_t CXFA_Node::ProcessNullTestValidate(CXFA_FFDocView* docView,
if (wsNullMsg.IsEmpty()) {
wsCaptionName = GetValidateCaptionName(bVersionFlag);
- wsNullMsg = WideString::Format(
- L"%ls cannot be blank. To ignore validations for %ls, click "
- L"Ignore.",
- wsCaptionName.c_str(), wsCaptionName.c_str());
+ wsNullMsg = wsCaptionName +
+ L" cannot be blank. To ignore validations for " +
+ wsCaptionName + L", click Ignore.";
}
if (pAppProvider->MsgBox(wsNullMsg, wsTitle,
static_cast<uint32_t>(AlertIcon::kWarning),
@@ -2288,15 +2286,14 @@ WideString CXFA_Node::GetValidateCaptionName(bool bVersionFlag) {
WideString CXFA_Node::GetValidateMessage(bool bError, bool bVersionFlag) {
WideString wsCaptionName = GetValidateCaptionName(bVersionFlag);
if (bVersionFlag)
- return WideString::Format(L"%ls validation failed", wsCaptionName.c_str());
- if (bError) {
- return WideString::Format(L"The value you entered for %ls is invalid.",
- wsCaptionName.c_str());
- }
- return WideString::Format(
- L"The value you entered for %ls is invalid. To ignore "
- L"validations for %ls, click Ignore.",
- wsCaptionName.c_str(), wsCaptionName.c_str());
+ return wsCaptionName + L" validation failed";
+ WideString result =
+ L"The value you entered for " + wsCaptionName + L" is invalid.";
+ if (!bError) {
+ result +=
+ L" To ignore validations for " + wsCaptionName + L", click Ignore.";
+ }
+ return result;
}
int32_t CXFA_Node::ExecuteScript(CXFA_FFDocView* docView,