summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-14 15:46:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-14 15:46:27 -0700
commit6f167c3ea2f8093170cae12a3de4ded76ac521ce (patch)
tree76ad1435272c22f677b4af2ec6b246d604aef3ce
parent70c5520270ab41b71e8ae8d2e888b9ba25383190 (diff)
downloadpdfium-6f167c3ea2f8093170cae12a3de4ded76ac521ce.tar.xz
Change string argument type to GetFormatDataValue.
Avoid string duplication, since the first thing these routines do is allocate a new string from the static string argument. Review URL: https://codereview.chromium.org/1889983002
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp11
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h4
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp13
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp11
4 files changed, 17 insertions, 22 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 16380011fe..e75eef8916 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -820,7 +820,7 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex,
if (iSel < 0) {
CFX_WideString wsSaveText = wsSaveTextArray[nIndex];
CFX_WideString wsFormatText(wsSaveText);
- GetFormatDataValue(wsSaveText.AsStringC(), wsFormatText);
+ GetFormatDataValue(wsSaveText, wsFormatText);
m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify,
bSyncData);
}
@@ -850,7 +850,7 @@ void CXFA_WidgetData::SetSelectedItems(CFX_Int32Array& iSelArray,
}
CFX_WideString wsFormat(wsValue);
if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect)
- GetFormatDataValue(wsValue.AsStringC(), wsFormat);
+ GetFormatDataValue(wsValue, wsFormat);
m_pNode->SetContent(wsValue, wsFormat, bNotify, bScriptModify, bSyncData);
}
@@ -1559,7 +1559,7 @@ FX_BOOL CXFA_WidgetData::GetValue(CFX_WideString& wsValue,
}
FX_BOOL CXFA_WidgetData::GetNormalizeDataValue(
- const CFX_WideStringC& wsValue,
+ const CFX_WideString& wsValue,
CFX_WideString& wsNormalizeValue) {
wsNormalizeValue = wsValue;
if (wsValue.IsEmpty())
@@ -1583,7 +1583,7 @@ FX_BOOL CXFA_WidgetData::GetNormalizeDataValue(
return FALSE;
}
-FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideStringC& wsValue,
+FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue,
CFX_WideString& wsFormatedValue) {
wsFormatedValue = wsValue;
if (wsValue.IsEmpty())
@@ -1738,8 +1738,7 @@ void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue,
CFX_WideString wsFormatValue(wsValue);
CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData();
if (pContainerWidgetData)
- pContainerWidgetData->GetFormatDataValue(wsValue.AsStringC(),
- wsFormatValue);
+ pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
m_pNode->SetContent(wsValue, wsFormatValue, bNotify);
}
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index 503b47feb2..3cdc7cc8e4 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -133,9 +133,9 @@ class CXFA_WidgetData : public CXFA_Data {
XFA_VALUEPICTURE ePicture);
IFX_Locale* GetLocal();
FX_BOOL GetValue(CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType);
- FX_BOOL GetNormalizeDataValue(const CFX_WideStringC& wsValue,
+ FX_BOOL GetNormalizeDataValue(const CFX_WideString& wsValue,
CFX_WideString& wsNormalizeValue);
- FX_BOOL GetFormatDataValue(const CFX_WideStringC& wsValue,
+ FX_BOOL GetFormatDataValue(const CFX_WideString& wsValue,
CFX_WideString& wsFormatedValue);
void NormalizeNumStr(const CFX_WideString& wsValue, CFX_WideString& wsOutput);
CFX_WideString GetBarcodeType();
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index a271b10286..f0c2d7645a 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -132,7 +132,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode,
CFDE_XMLElement* pXMLDataElement =
static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode());
FXSYS_assert(pXMLDataElement);
- pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
+ pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
if (!wsHref.IsEmpty()) {
@@ -161,7 +161,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode,
->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup"));
}
} else if (!wsValue.IsEmpty()) {
- pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
+ pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
}
break;
@@ -170,7 +170,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode,
if (wsValue.IsEmpty()) {
break;
}
- pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
+ pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
break;
case XFA_ELEMENT_ExclGroup: {
@@ -240,7 +240,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode,
CFX_WideString wsOutput;
pWidgetData->NormalizeNumStr(wsValue, wsOutput);
wsValue = wsOutput;
- pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
+ pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
CXFA_Node* pValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value);
XFA_DataMerge_FormValueNode_SetChildContent(pValue, wsValue,
@@ -251,7 +251,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode,
if (wsValue.IsEmpty()) {
break;
}
- pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
+ pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
break;
}
@@ -259,8 +259,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode,
CFX_WideString wsXMLValue;
pDataNode->TryContent(wsXMLValue);
CFX_WideString wsNormailizeValue;
- pWidgetData->GetNormalizeDataValue(wsXMLValue.AsStringC(),
- wsNormailizeValue);
+ pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormailizeValue);
pDataNode->SetAttributeValue(wsNormailizeValue, wsXMLValue);
switch (eUIType) {
case XFA_ELEMENT_ImageEdit: {
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 2979e3700a..4428b67302 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -1688,8 +1688,7 @@ void CXFA_Node::Script_Som_DefaultValue(FXJSE_HVALUE hValue,
pContainerWidgetData = GetContainerWidgetData();
}
if (pContainerWidgetData) {
- pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(),
- wsFormatValue);
+ pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
}
SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
} else {
@@ -1738,8 +1737,7 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue,
CFX_WideString wsFormatValue(wsNewValue);
CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
if (pContainerWidgetData) {
- pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(),
- wsFormatValue);
+ pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
}
SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
} else {
@@ -1999,8 +1997,7 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue,
CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
CFX_WideString wsFormatText(wsNewText);
if (pContainerWidgetData) {
- pContainerWidgetData->GetFormatDataValue(wsNewText.AsStringC(),
- wsFormatText);
+ pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText);
}
SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE);
} else {
@@ -5220,7 +5217,7 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) {
CFX_WideString wsFormatValue(wsValue);
CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData();
if (pWidgetData) {
- pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatValue);
+ pWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
}
pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE);
}