summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_widgetdata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-29 11:02:17 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-29 15:21:35 +0000
commit9ad342b60490b9e88896aaf2eb7fb8f7bfa73e5a (patch)
tree2eae047becb4856266e4404f762ce3a122b311b3 /xfa/fxfa/parser/cxfa_widgetdata.cpp
parent21362ee6370e6ef0f5a8275af5afde3f127887c9 (diff)
downloadpdfium-9ad342b60490b9e88896aaf2eb7fb8f7bfa73e5a.tar.xz
Return values instead of out paramschromium/3056
This CL updates the IFX_Locale code and subclasses to return CFX_WideStrings instead of taking out params. Change-Id: Id03499c68161e809607e73b9d8ec778e24631845 Reviewed-on: https://pdfium-review.googlesource.com/3252 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_widgetdata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp82
1 files changed, 37 insertions, 45 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index e6cd75fe62..6da501b4a3 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -1486,7 +1486,7 @@ bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
return true;
}
}
- CFX_WideString wsDataPicture, wsTimePicture;
+
IFX_Locale* pLocale = GetLocal();
if (!pLocale)
return false;
@@ -1494,19 +1494,18 @@ bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
uint32_t dwType = widgetValue.GetType();
switch (dwType) {
case XFA_VT_DATE:
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium,
- wsPicture);
+ wsPicture =
+ pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium);
break;
case XFA_VT_TIME:
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium,
- wsPicture);
+ wsPicture =
+ pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium);
break;
case XFA_VT_DATETIME:
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium,
- wsDataPicture);
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium,
- wsTimePicture);
- wsPicture = wsDataPicture + L"T" + wsTimePicture;
+ wsPicture =
+ pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium) +
+ L"T" +
+ pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium);
break;
case XFA_VT_DECIMAL:
case XFA_VT_FLOAT:
@@ -1516,7 +1515,6 @@ bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
}
return true;
}
-
case XFA_VALUEPICTURE_Edit: {
CXFA_Node* pUI = m_pNode->GetChild(0, XFA_Element::Ui);
if (pUI) {
@@ -1525,32 +1523,29 @@ bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
return true;
}
}
- {
- CFX_WideString wsDataPicture, wsTimePicture;
- IFX_Locale* pLocale = GetLocal();
- if (!pLocale) {
- return false;
- }
- uint32_t dwType = widgetValue.GetType();
- switch (dwType) {
- case XFA_VT_DATE:
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Short,
- wsPicture);
- break;
- case XFA_VT_TIME:
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short,
- wsPicture);
- break;
- case XFA_VT_DATETIME:
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Short,
- wsDataPicture);
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short,
- wsTimePicture);
- wsPicture = wsDataPicture + L"T" + wsTimePicture;
- break;
- default:
- break;
- }
+
+ IFX_Locale* pLocale = GetLocal();
+ if (!pLocale)
+ return false;
+
+ uint32_t dwType = widgetValue.GetType();
+ switch (dwType) {
+ case XFA_VT_DATE:
+ wsPicture =
+ pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Short);
+ break;
+ case XFA_VT_TIME:
+ wsPicture =
+ pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short);
+ break;
+ case XFA_VT_DATETIME:
+ wsPicture =
+ pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Short) +
+ L"T" +
+ pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short);
+ break;
+ default:
+ break;
}
return true;
}
@@ -1783,8 +1778,8 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
return;
CFX_WideString wsSrcNum = wsValue;
- CFX_WideString wsGroupSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
+ CFX_WideString wsGroupSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping);
bool bNeg = false;
if (wsSrcNum[0] == '-') {
bNeg = true;
@@ -1806,15 +1801,12 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
wsOutput += wsSrcNum[i];
}
if (dot_index < len) {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsSymbol);
- wsOutput += wsSymbol;
+ wsOutput += pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
wsOutput += wsSrcNum.Right(len - dot_index - 1);
}
if (bNeg) {
- CFX_WideString wsMinusymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol);
- wsOutput = wsMinusymbol + wsOutput;
+ wsOutput =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus) + wsOutput;
}
}
}