summaryrefslogtreecommitdiff
path: root/fxjs/cjx_node.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-16 21:45:18 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-16 21:45:18 +0000
commit3f1c832dda209cf6682bb75316c07d71332fe6c3 (patch)
tree79e274e65a500bc7964fe4328a6185c805274640 /fxjs/cjx_node.cpp
parent40d522134a11867adb95f77c0b7891932e0739a2 (diff)
downloadpdfium-3f1c832dda209cf6682bb75316c07d71332fe6c3.tar.xz
Make WideString::{Format|FormatV} static
This CL moves the Format and FormatV methods from WideString to be static. Bug: pdfium:934 Change-Id: I9941d6a2a5bbf0a82087cd0ea5d0f8fc42eecd3e Reviewed-on: https://pdfium-review.googlesource.com/18630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cjx_node.cpp')
-rw-r--r--fxjs/cjx_node.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index 17662dada6..b89101ce17 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -297,10 +297,7 @@ pdfium::Optional<WideString> CJX_Node::TryAttribute(XFA_Attribute eAttr,
pdfium::Optional<int32_t> iValue = TryInteger(pAttr->eName, bUseDefault);
if (!iValue)
return {};
-
- WideString wsValue;
- wsValue.Format(L"%d", *iValue);
- return {wsValue};
+ return {WideString::Format(L"%d", *iValue)};
}
case XFA_AttributeType::Measure: {
pdfium::Optional<CXFA_Measurement> value =
@@ -1555,9 +1552,8 @@ void CJX_Node::Script_Som_BorderColor(CFXJSE_Value* pValue,
int32_t g;
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
- WideString strColor;
- strColor.Format(L"%d,%d,%d", r, g, b);
- pValue->SetString(strColor.UTF8Encode().AsStringView());
+ pValue->SetString(
+ WideString::Format(L"%d,%d,%d", r, g, b).UTF8Encode().AsStringView());
}
void CJX_Node::Script_Som_BorderWidth(CFXJSE_Value* pValue,
@@ -1610,9 +1606,8 @@ void CJX_Node::Script_Som_FillColor(CFXJSE_Value* pValue,
int32_t g;
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
- WideString wsColor;
- wsColor.Format(L"%d,%d,%d", r, g, b);
- pValue->SetString(wsColor.UTF8Encode().AsStringView());
+ pValue->SetString(
+ WideString::Format(L"%d,%d,%d", r, g, b).UTF8Encode().AsStringView());
}
void CJX_Node::Script_Som_DataNode(CFXJSE_Value* pValue,
@@ -3285,10 +3280,10 @@ bool CJX_Node::SetValue(XFA_Attribute eAttr,
elem->SetString(pInfo->pName, pValue ? L"1" : L"0");
break;
case XFA_AttributeType::Integer: {
- WideString wsValue;
- wsValue.Format(L"%d",
- static_cast<int32_t>(reinterpret_cast<uintptr_t>(pValue)));
- elem->SetString(pInfo->pName, wsValue);
+ elem->SetString(
+ pInfo->pName,
+ WideString::Format(L"%d", static_cast<int32_t>(
+ reinterpret_cast<uintptr_t>(pValue))));
break;
}
default: