Remove c_str() calls from CXFA_Node::InsertItem()
Also remove an unused parameter from the notifier.
Change-Id: I2e13831a80ec0190ebfc23101c6f9a9c099485c5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/61750
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index 18a59c9..e034dc9 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -67,8 +67,7 @@
}
void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_Node* pSender,
- const wchar_t* pLabel,
- const wchar_t* pValue,
+ const WideString& wsLabel,
int32_t iIndex) {
if (pSender->GetFFWidgetType() != XFA_FFWidgetType::kChoiceList)
return;
@@ -76,7 +75,7 @@
CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender);
for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) {
if (pWidget->IsLoaded())
- ToDropDown(pWidget)->InsertItem(pLabel, iIndex);
+ ToDropDown(pWidget)->InsertItem(wsLabel.AsStringView(), iIndex);
}
}
diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h
index 6debca8..aa6de61 100644
--- a/xfa/fxfa/cxfa_ffnotify.h
+++ b/xfa/fxfa/cxfa_ffnotify.h
@@ -28,8 +28,7 @@
void OnPageEvent(CXFA_ViewLayoutItem* pSender, uint32_t dwEvent);
void OnWidgetListItemAdded(CXFA_Node* pSender,
- const wchar_t* pLabel,
- const wchar_t* pValue,
+ const WideString& wsLabel,
int32_t iIndex);
void OnWidgetListItemRemoved(CXFA_Node* pSender, int32_t iIndex);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 7c69295..5daccc4 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -4405,11 +4405,8 @@
InsertListTextItem(pNode, wsLabel, nIndex);
InsertListTextItem(pSaveItems, wsNewValue, nIndex);
}
- if (!bNotify)
- return;
-
- GetDocument()->GetNotify()->OnWidgetListItemAdded(this, wsLabel.c_str(),
- wsValue.c_str(), nIndex);
+ if (bNotify)
+ GetDocument()->GetNotify()->OnWidgetListItemAdded(this, wsLabel, nIndex);
}
WideString CXFA_Node::GetItemLabel(WideStringView wsValue) const {