Prefer WideString() over L"".
Although longer in the source code, this avoids creating a literal
somewhere and supplying it's address as an argument to an implicit
constructor. I believe blink did something similar a long time ago
with its string usage.
Change-Id: I7879ceb9a706e762df324718af194e97ed6db858
Reviewed-on: https://pdfium-review.googlesource.com/c/46350
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 0872317..c44e28a 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -93,7 +93,7 @@
if (full_name.IsEmpty())
full_name = std::move(short_name);
else
- full_name = short_name + L"." + full_name;
+ full_name = short_name + L'.' + full_name;
}
pLevel = pLevel->GetDictFor("Parent");
if (pdfium::ContainsKey(visited, pLevel))
@@ -300,12 +300,12 @@
WideString CPDF_FormField::GetAlternateName() const {
const CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "TU");
- return pObj ? pObj->GetUnicodeText() : L"";
+ return pObj ? pObj->GetUnicodeText() : WideString();
}
WideString CPDF_FormField::GetMappingName() const {
const CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "TM");
- return pObj ? pObj->GetUnicodeText() : L"";
+ return pObj ? pObj->GetUnicodeText() : WideString();
}
uint32_t CPDF_FormField::GetFieldFlags() const {
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index b622073..192e142 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -51,7 +51,7 @@
WideString GetLabelNumPortion(int num, const ByteString& bsStyle) {
if (bsStyle.IsEmpty())
- return L"";
+ return WideString();
if (bsStyle == "D")
return WideString::Format(L"%d", num);
if (bsStyle == "R") {
@@ -68,7 +68,7 @@
}
if (bsStyle == "a")
return MakeLetters(num);
- return L"";
+ return WideString();
}
} // namespace
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index d1da327..cdbf46a 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -306,7 +306,8 @@
}
WideString CPDF_LinkExtract::GetURL(size_t index) const {
- return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L"";
+ return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl
+ : WideString();
}
std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const {
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 259167b..1a279e9 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -473,7 +473,7 @@
WideString CPDF_TextPage::GetPageText(int start, int count) const {
if (start < 0 || start >= CountChars() || count <= 0 || !m_bIsParsed ||
m_CharList.empty() || m_TextBuf.GetLength() == 0) {
- return L"";
+ return WideString();
}
const int count_chars = CountChars();
@@ -484,7 +484,7 @@
// character.
while (text_start < 0) {
if (start >= count_chars)
- return L"";
+ return WideString();
start++;
text_start = TextIndexFromCharIndex(start);
}
@@ -499,14 +499,14 @@
// character.
while (text_last < 0) {
if (last < text_start)
- return L"";
+ return WideString();
last--;
text_last = TextIndexFromCharIndex(last);
}
if (text_last < text_start)
- return L"";
+ return WideString();
int text_count = text_last - text_start + 1;
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 0ddbcd9..a58a5c9 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -296,7 +296,7 @@
va_end(argListCopy);
if (!guess.has_value())
- return L"";
+ return WideString();
maxLen = pdfium::base::checked_cast<int>(guess.value());
}
@@ -310,7 +310,7 @@
return *ret;
maxLen *= 2;
}
- return L"";
+ return WideString();
}
// static
diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp
index 02b3fcc..e09fc57 100644
--- a/core/fxcrt/xml/cfx_xmlelement.cpp
+++ b/core/fxcrt/xml/cfx_xmlelement.cpp
@@ -68,7 +68,7 @@
}
return pElement->GetAttribute(attr);
}
- return L"";
+ return WideString();
}
WideString CFX_XMLElement::GetTextData() const {
@@ -137,7 +137,7 @@
WideString CFX_XMLElement::GetAttribute(const WideString& name) const {
auto it = attrs_.find(name);
- return it != attrs_.end() ? it->second : L"";
+ return it != attrs_.end() ? it->second : WideString();
}
void CFX_XMLElement::SetAttribute(const WideString& name,
diff --git a/fpdfsdk/cpdfsdk_actionhandler.cpp b/fpdfsdk/cpdfsdk_actionhandler.cpp
index 1816c94..e543e85 100644
--- a/fpdfsdk/cpdfsdk_actionhandler.cpp
+++ b/fpdfsdk/cpdfsdk_actionhandler.cpp
@@ -128,7 +128,7 @@
if (pFormFillEnv->IsJSPlatformPresent()) {
WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty())
- RunDocumentOpenJavaScript(pFormFillEnv, L"", swJS);
+ RunDocumentOpenJavaScript(pFormFillEnv, WideString(), swJS);
}
} else {
DoAction_NoJs(action, CPDF_AAction::AActionType::kDocumentOpen,
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 3260908..68f5a67 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -452,7 +452,7 @@
const WideString& wsEncode,
const WideString& wsHeader) {
if (!m_pInfo || !m_pInfo->FFI_PostRequestURL)
- return L"";
+ return WideString();
ByteString bsURL = wsURL.ToUTF16LE();
ByteString bsData = wsData.ToUTF16LE();
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 0123837..efde8ce 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -142,8 +142,8 @@
fa.sChangeEx = GetSelectExportText();
if (fa.bFieldFull) {
- fa.sChange = L"";
- fa.sChangeEx = L"";
+ fa.sChange.clear();
+ fa.sChangeEx.clear();
}
}
}
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index 0b67ab0..d64fa7c 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -146,7 +146,7 @@
switch (type) {
case CPDF_AAction::kValidate:
if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
- fa.sValue = L"";
+ fa.sValue.clear();
} else {
auto* pListBox =
static_cast<CPWL_ListBox*>(GetPDFWindow(pPageView, false));
@@ -160,7 +160,7 @@
case CPDF_AAction::kLoseFocus:
case CPDF_AAction::kGetFocus:
if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
- fa.sValue = L"";
+ fa.sValue.clear();
} else {
int32_t nCurSel = m_pWidget->GetSelectedIndex(0);
if (nCurSel >= 0)
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index a591d37..fffdfbf 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -168,8 +168,8 @@
fa.sValue = pWnd->GetText();
if (fa.bFieldFull) {
- fa.sChange = L"";
- fa.sChangeEx = L"";
+ fa.sChange.clear();
+ fa.sChangeEx.clear();
}
}
break;
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
index 5a96818..43685b2 100644
--- a/fpdfsdk/fpdf_annot.cpp
+++ b/fpdfsdk/fpdf_annot.cpp
@@ -823,7 +823,7 @@
CPDF_Stream* pStream = GetAnnotAPNoFallback(pAnnotDict, mode);
return Utf16EncodeMaybeCopyAndReturnLength(
- pStream ? pStream->GetUnicodeText() : L"", buffer, buflen);
+ pStream ? pStream->GetUnicodeText() : WideString(), buffer, buflen);
}
FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 40ccbdc..a78ad37 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -228,15 +228,15 @@
}
WideString CPDFXFA_Context::GetAppName() {
- return m_pFormFillEnv ? m_pFormFillEnv->FFI_GetAppName() : L"";
+ return m_pFormFillEnv ? m_pFormFillEnv->FFI_GetAppName() : WideString();
}
WideString CPDFXFA_Context::GetLanguage() {
- return m_pFormFillEnv ? m_pFormFillEnv->GetLanguage() : L"";
+ return m_pFormFillEnv ? m_pFormFillEnv->GetLanguage() : WideString();
}
WideString CPDFXFA_Context::GetPlatform() {
- return m_pFormFillEnv ? m_pFormFillEnv->GetPlatform() : L"";
+ return m_pFormFillEnv ? m_pFormFillEnv->GetPlatform() : WideString();
}
void CPDFXFA_Context::Beep(uint32_t dwType) {
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 05ad437..516bcf2 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -645,7 +645,7 @@
return false;
pFormFillEnv->JS_appAlert(WideString::FromDefANSI(IDS_XFA_Validate_Input),
- L"", JSPLATFORM_ALERT_BUTTON_OK,
+ WideString(), JSPLATFORM_ALERT_BUTTON_OK,
JSPLATFORM_ALERT_ICON_WARNING);
return false;
}
@@ -880,9 +880,9 @@
tmp = tmp.Right(tmp.GetLength() - 5);
csMsg += tmp;
}
- srcURL = !pos.has_value()
- ? L""
- : srcURL.Right(csURL.GetLength() - (pos.value() + 1));
+ srcURL = pos.has_value()
+ ? srcURL.Right(csURL.GetLength() - (pos.value() + 1))
+ : WideString();
}
csToAddress.Replace(L",", L";");
csCCAddress.Replace(L",", L";");
@@ -899,8 +899,8 @@
WideString csURL = submit->GetSubmitTarget();
if (csURL.IsEmpty()) {
- pFormFillEnv->JS_appAlert(WideString::FromDefANSI("Submit cancelled."), L"",
- JSPLATFORM_ALERT_BUTTON_OK,
+ pFormFillEnv->JS_appAlert(WideString::FromDefANSI("Submit cancelled."),
+ WideString(), JSPLATFORM_ALERT_BUTTON_OK,
JSPLATFORM_ALERT_ICON_ASTERISK);
return false;
}
diff --git a/fpdfsdk/pwl/cpwl_list_impl.cpp b/fpdfsdk/pwl/cpwl_list_impl.cpp
index b7081c0..d8a6a1d 100644
--- a/fpdfsdk/pwl/cpwl_list_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_list_impl.cpp
@@ -634,5 +634,5 @@
WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const {
if (pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex])
return m_ListItems[nIndex]->GetText();
- return L"";
+ return WideString();
}
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 33d1087..926e731 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -64,7 +64,7 @@
WideString GetObjWordStr(const CPDF_TextObject* pTextObj, int nWordIndex) {
CPDF_Font* pFont = pTextObj->GetFont();
if (!pFont)
- return L"";
+ return WideString();
WideString swRet;
int nWords = 0;
diff --git a/fxjs/cjs_eventhandler.cpp b/fxjs/cjs_eventhandler.cpp
index 1fa19e7..ec6f9ec 100644
--- a/fxjs/cjs_eventhandler.cpp
+++ b/fxjs/cjs_eventhandler.cpp
@@ -369,11 +369,11 @@
void CJS_EventHandler::Initialize(JS_EVENT_T type) {
m_eEventType = type;
- m_strTargetName = L"";
- m_strSourceName = L"";
+ m_strTargetName.clear();
+ m_strSourceName.clear();
m_pWideStrChange = nullptr;
- m_WideStrChangeDu = L"";
- m_WideStrChangeEx = L"";
+ m_WideStrChangeDu.clear();
+ m_WideStrChangeEx.clear();
m_nCommitKey = -1;
m_bKeyDown = false;
m_bModifier = false;
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index e111fbc..cd95fd1 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -671,7 +671,7 @@
if (ret)
wsContentType = *ret;
if (wsContentType.EqualsASCII("text/html")) {
- wsContentType = L"";
+ wsContentType.clear();
SetAttribute(XFA_Attribute::ContentType, wsContentType.AsStringView(),
false);
}
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index 878c488..fd59cbc 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -790,7 +790,7 @@
WideString CFDE_TextEditEngine::GetSelectedText() const {
if (!has_selection_)
- return L"";
+ return WideString();
WideString text;
if (selection_.start_idx < gap_position_) {
@@ -824,7 +824,7 @@
WideString CFDE_TextEditEngine::DeleteSelectedText(
RecordOperation add_operation) {
if (!has_selection_)
- return L"";
+ return WideString();
return Delete(selection_.start_idx, selection_.count, add_operation);
}
@@ -833,10 +833,10 @@
size_t length,
RecordOperation add_operation) {
if (start_idx >= text_length_)
- return L"";
+ return WideString();
TextChange change;
- change.text = L"";
+ change.text.clear();
change.cancelled = false;
if (delegate_ && (add_operation != RecordOperation::kSkipRecord &&
add_operation != RecordOperation::kSkipNotify)) {
@@ -846,7 +846,7 @@
delegate_->OnTextWillChange(&change);
if (change.cancelled)
- return L"";
+ return WideString();
start_idx = change.selection_start;
length = change.selection_end - change.selection_start;
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index 1bd1799..b4a79fe 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -140,7 +140,7 @@
WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const {
CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>(
m_pListBox->GetItem(m_pListBox.get(), iIndex));
- return pItem ? pItem->GetText() : L"";
+ return pItem ? pItem->GetText() : WideString();
}
void CFWL_ComboBox::SetCurSel(int32_t iSel) {
@@ -151,7 +151,7 @@
m_pEdit->SetText(WideString());
} else {
CFWL_ListItem* hItem = m_pListBox->GetItem(this, iSel);
- m_pEdit->SetText(hItem ? hItem->GetText() : L"");
+ m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
}
m_pEdit->Update();
}
@@ -186,10 +186,10 @@
if (m_pEdit)
return m_pEdit->GetText();
if (!m_pListBox)
- return L"";
+ return WideString();
CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
- return hItem ? hItem->GetText() : L"";
+ return hItem ? hItem->GetText() : WideString();
}
void CFWL_ComboBox::OpenDropDownList(bool bActivate) {
@@ -283,7 +283,7 @@
void CFWL_ComboBox::SyncEditText(int32_t iListItem) {
CFWL_ListItem* hItem = m_pListBox->GetItem(this, iListItem);
- m_pEdit->SetText(hItem ? hItem->GetText() : L"");
+ m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
m_pEdit->Update();
m_pEdit->SetSelected();
}
@@ -319,7 +319,7 @@
if (m_iCurSel >= 0) {
CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
m_pEdit->LockUpdate();
- m_pEdit->SetText(hItem ? hItem->GetText() : L"");
+ m_pEdit->SetText(hItem ? hItem->GetText() : WideString());
m_pEdit->UnlockUpdate();
}
m_pEdit->Update();
@@ -569,7 +569,7 @@
iCurSel = pComboList->MatchItem(wsText);
if (iCurSel >= 0) {
CFWL_ListItem* item = m_pListBox->GetSelItem(iCurSel);
- bMatchEqual = wsText == (item ? item->GetText() : L"");
+ bMatchEqual = wsText == (item ? item->GetText() : WideString());
}
}
if (iCurSel < 0) {
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 2083802..237cc20 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -31,7 +31,7 @@
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
CFWL_ListItem* hItem = GetItem(this, i);
- WideString wsText = hItem ? hItem->GetText() : L"";
+ WideString wsText = hItem ? hItem->GetText() : WideString();
auto pos = wsText.Find(wsMatch.c_str());
if (pos.has_value() && pos.value() == 0)
return i;
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 9666f36..c3e327c 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -175,7 +175,7 @@
}
WideString CFWL_DateTimePicker::GetEditText() const {
- return m_pEdit ? m_pEdit->GetText() : L"";
+ return m_pEdit ? m_pEdit->GetText() : WideString();
}
int32_t CFWL_DateTimePicker::GetEditTextLength() const {
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
index 61035c5..3027dea 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
@@ -21,7 +21,7 @@
WideString IdentifierToName(WideStringView ident) {
if (ident.IsEmpty())
- return L"";
+ return WideString();
if (ident[0] != L'!')
return WideString(ident);
return L"pfm__excl__" + ident.Right(ident.GetLength() - 1);
diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
index 8bb029e..1de6a04 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
@@ -719,7 +719,7 @@
return nullptr;
expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>(
- std::move(expr), TOKcall, L"", std::move(s));
+ std::move(expr), TOKcall, WideStringView(), std::move(s));
break;
}
case TOKdot: {
@@ -753,7 +753,7 @@
return nullptr;
expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>(
- std::move(expr), TOKcall, L"", std::move(s));
+ std::move(expr), TOKcall, WideStringView(), std::move(s));
} else if (m_token.m_type == TOKlbracket) {
std::unique_ptr<CXFA_FMSimpleExpression> s = ParseIndexExpression();
if (!s)
diff --git a/xfa/fxfa/parser/cxfa_bind.cpp b/xfa/fxfa/parser/cxfa_bind.cpp
index 6ae84ae..411a3d6 100644
--- a/xfa/fxfa/parser/cxfa_bind.cpp
+++ b/xfa/fxfa/parser/cxfa_bind.cpp
@@ -50,5 +50,5 @@
WideString CXFA_Bind::GetPicture() {
CXFA_Picture* pPicture =
GetChild<CXFA_Picture>(0, XFA_Element::Picture, false);
- return pPicture ? pPicture->JSObject()->GetContent(false) : L"";
+ return pPicture ? pPicture->JSObject()->GetContent(false) : WideString();
}
diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp
index a5540df..5054e67 100644
--- a/xfa/fxfa/parser/cxfa_calculate.cpp
+++ b/xfa/fxfa/parser/cxfa_calculate.cpp
@@ -57,8 +57,8 @@
WideString CXFA_Calculate::GetMessageText() {
CXFA_Message* pNode = GetChild<CXFA_Message>(0, XFA_Element::Message, false);
if (!pNode)
- return L"";
+ return WideString();
CXFA_Text* text = pNode->GetChild<CXFA_Text>(0, XFA_Element::Text, false);
- return text ? text->GetContent() : L"";
+ return text ? text->GetContent() : WideString();
}
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 37eee55..d1deb0d 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -523,7 +523,7 @@
break;
}
case XFA_FFWidgetType::kChoiceList:
- wsValue = defValue ? defValue->GetChildValueContent() : L"";
+ wsValue = defValue ? defValue->GetChildValueContent() : WideString();
if (pFormNode->IsChoiceListMultiSelect()) {
std::vector<WideString> wsSelTextArray =
pFormNode->GetSelectedItemsValue();
@@ -549,7 +549,7 @@
}
break;
case XFA_FFWidgetType::kCheckButton:
- wsValue = defValue ? defValue->GetChildValueContent() : L"";
+ wsValue = defValue ? defValue->GetChildValueContent() : WideString();
if (wsValue.IsEmpty())
break;
@@ -619,7 +619,7 @@
break;
}
case XFA_FFWidgetType::kNumericEdit: {
- wsValue = defValue ? defValue->GetChildValueContent() : L"";
+ wsValue = defValue ? defValue->GetChildValueContent() : WideString();
if (wsValue.IsEmpty())
break;
@@ -633,7 +633,7 @@
break;
}
default:
- wsValue = defValue ? defValue->GetChildValueContent() : L"";
+ wsValue = defValue ? defValue->GetChildValueContent() : WideString();
if (wsValue.IsEmpty())
break;
@@ -1198,7 +1198,7 @@
WideString wsRef =
pTemplateNodeBind
? pTemplateNodeBind->JSObject()->GetCData(XFA_Attribute::Ref)
- : L"";
+ : WideString();
uint32_t dFlags =
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_CreateNode;
XFA_RESOLVENODE_RS rs;
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index 57a6e90..8a2ca46 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -265,7 +265,7 @@
WideString GetPlainTextFromRichText(CFX_XMLNode* pXMLNode) {
if (!pXMLNode)
- return L"";
+ return WideString();
WideString wsPlainText;
switch (pXMLNode->GetType()) {
@@ -1070,7 +1070,8 @@
if (!pXFAChild)
return;
- pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, L"", false, false);
+ pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, WideString(),
+ false, false);
pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsCurValue, false,
false);
pXFANode->InsertChild(pXFAChild, nullptr);
@@ -1107,7 +1108,8 @@
if (!pXFAChild)
return;
- pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, L"", false, false);
+ pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, WideString(),
+ false, false);
pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsCurValue, false,
false);
pXFANode->InsertChild(pXFAChild, nullptr);
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index fc3b1ce..fbfc560 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -1225,7 +1225,7 @@
return m_wsConfigLocale;
m_hasSetLocaleName = true;
- m_wsConfigLocale = L"";
+ m_wsConfigLocale.clear();
if (!pConfig)
return m_wsConfigLocale;
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index 1529a48..9b2a69e 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -46,8 +46,8 @@
bool ValueSplitDateTime(const WideString& wsDateTime,
WideString& wsDate,
WideString& wsTime) {
- wsDate = L"";
- wsTime = L"";
+ wsDate.clear();
+ wsTime.clear();
if (wsDateTime.IsEmpty())
return false;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 312568b..b7a2852 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -241,8 +241,8 @@
bool SplitDateTime(const WideString& wsDateTime,
WideString& wsDate,
WideString& wsTime) {
- wsDate = L"";
- wsTime = L"";
+ wsDate.clear();
+ wsTime.clear();
if (wsDateTime.IsEmpty())
return false;
@@ -371,7 +371,7 @@
WideString FormatNumStr(const WideString& wsValue, LocaleIface* pLocale) {
if (wsValue.IsEmpty())
- return L"";
+ return WideString();
WideString wsSrcNum = wsValue;
WideString wsGroupSymbol = pLocale->GetGroupingSymbol();
@@ -385,7 +385,7 @@
dot_index = !dot_index.has_value() ? wsSrcNum.GetLength() : dot_index;
if (dot_index.value() < 1)
- return L"";
+ return WideString();
size_t nPos = dot_index.value() % 3;
WideString wsOutput;
@@ -4174,11 +4174,11 @@
iCount++;
}
if (iSearch < 0)
- return L"";
+ return WideString();
CXFA_Node* pText =
pSaveItems->GetChild<CXFA_Node>(iSearch, XFA_Element::Unknown, false);
- return pText ? pText->JSObject()->GetContent(false) : L"";
+ return pText ? pText->JSObject()->GetContent(false) : WideString();
}
bool CXFA_Node::DeleteItem(int32_t nIndex, bool bNotify, bool bScriptModify) {
@@ -4345,7 +4345,7 @@
WideString CXFA_Node::GetPictureContent(XFA_VALUEPICTURE ePicture) {
if (ePicture == XFA_VALUEPICTURE_Raw)
- return L"";
+ return WideString();
CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this);
switch (ePicture) {
@@ -4363,7 +4363,7 @@
LocaleIface* pLocale = GetLocale();
if (!pLocale)
- return L"";
+ return WideString();
uint32_t dwType = widgetValue.GetType();
switch (dwType) {
@@ -4378,7 +4378,7 @@
case XFA_VT_DECIMAL:
case XFA_VT_FLOAT:
default:
- return L"";
+ return WideString();
}
}
case XFA_VALUEPICTURE_Edit: {
@@ -4395,7 +4395,7 @@
LocaleIface* pLocale = GetLocale();
if (!pLocale)
- return L"";
+ return WideString();
uint32_t dwType = widgetValue.GetType();
switch (dwType) {
@@ -4408,7 +4408,7 @@
L"T" +
pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short);
default:
- return L"";
+ return WideString();
}
}
case XFA_VALUEPICTURE_DataBind: {
@@ -4420,7 +4420,7 @@
default:
break;
}
- return L"";
+ return WideString();
}
WideString CXFA_Node::GetValue(XFA_VALUEPICTURE eValueType) {
@@ -4439,7 +4439,8 @@
if (eValueType == XFA_VALUEPICTURE_Display) {
int32_t iSelItemIndex = GetSelectedItem(0);
if (iSelItemIndex >= 0) {
- wsValue = GetChoiceListItem(iSelItemIndex, false).value_or(L"");
+ wsValue =
+ GetChoiceListItem(iSelItemIndex, false).value_or(WideString());
wsPicture.clear();
}
}
@@ -4490,7 +4491,7 @@
WideString CXFA_Node::GetNormalizeDataValue(const WideString& wsValue) {
if (wsValue.IsEmpty())
- return L"";
+ return WideString();
WideString wsPicture = GetPictureContent(XFA_VALUEPICTURE_DataBind);
if (wsPicture.IsEmpty())
@@ -4509,7 +4510,7 @@
WideString CXFA_Node::GetFormatDataValue(const WideString& wsValue) {
if (wsValue.IsEmpty())
- return L"";
+ return WideString();
WideString wsPicture = GetPictureContent(XFA_VALUEPICTURE_DataBind);
if (wsPicture.IsEmpty())
@@ -4591,7 +4592,7 @@
WideString CXFA_Node::NormalizeNumStr(const WideString& wsValue) {
if (wsValue.IsEmpty())
- return L"";
+ return WideString();
WideString wsOutput = wsValue;
wsOutput.TrimLeft('0');
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index 4f76f84..f5776a4 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -79,7 +79,7 @@
CXFA_Message* pNode =
JSObject()->GetProperty<CXFA_Message>(0, XFA_Element::Message);
if (!pNode)
- return L"";
+ return WideString();
for (CXFA_Node* pItemNode = pNode->GetFirstChild(); pItemNode;
pItemNode = pItemNode->GetNextSibling()) {
@@ -90,7 +90,7 @@
if (wsName.IsEmpty() || wsName == wsMessageType)
return pItemNode->JSObject()->GetContent(false);
}
- return L"";
+ return WideString();
}
void CXFA_Validate::SetFormatMessageText(const WideString& wsMessage) {
@@ -146,7 +146,7 @@
WideString CXFA_Validate::GetPicture() {
CXFA_Picture* pNode = GetChild<CXFA_Picture>(0, XFA_Element::Picture, false);
- return pNode ? pNode->JSObject()->GetContent(false) : L"";
+ return pNode ? pNode->JSObject()->GetContent(false) : WideString();
}
CXFA_Script* CXFA_Validate::GetScriptIfExists() {
diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp
index 24bd338..b06eebf 100644
--- a/xfa/fxfa/parser/cxfa_value.cpp
+++ b/xfa/fxfa/parser/cxfa_value.cpp
@@ -64,7 +64,9 @@
WideString CXFA_Value::GetChildValueContent() const {
CXFA_Node* pNode = GetFirstChild();
- return pNode ? pNode->JSObject()->TryContent(false, true).value_or(L"") : L"";
+ return pNode
+ ? pNode->JSObject()->TryContent(false, true).value_or(WideString())
+ : WideString();
}
CXFA_Arc* CXFA_Value::GetArcIfExists() const {
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp
index 4658c75..0b7da69 100644
--- a/xfa/fxfa/parser/cxfa_xmllocale.cpp
+++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp
@@ -68,32 +68,37 @@
WideString CXFA_XMLLocale::GetDecimalSymbol() const {
CFX_XMLElement* patterns = locale_->GetFirstChildNamed(kNumberSymbols);
- return patterns ? GetPattern(patterns, kNumberSymbol, L"decimal") : L"";
+ return patterns ? GetPattern(patterns, kNumberSymbol, L"decimal")
+ : WideString();
}
WideString CXFA_XMLLocale::GetGroupingSymbol() const {
CFX_XMLElement* patterns = locale_->GetFirstChildNamed(kNumberSymbols);
- return patterns ? GetPattern(patterns, kNumberSymbol, L"grouping") : L"";
+ return patterns ? GetPattern(patterns, kNumberSymbol, L"grouping")
+ : WideString();
}
WideString CXFA_XMLLocale::GetPercentSymbol() const {
CFX_XMLElement* patterns = locale_->GetFirstChildNamed(kNumberSymbols);
- return patterns ? GetPattern(patterns, kNumberSymbol, L"percent") : L"";
+ return patterns ? GetPattern(patterns, kNumberSymbol, L"percent")
+ : WideString();
}
WideString CXFA_XMLLocale::GetMinusSymbol() const {
CFX_XMLElement* patterns = locale_->GetFirstChildNamed(kNumberSymbols);
- return patterns ? GetPattern(patterns, kNumberSymbol, L"minus") : L"";
+ return patterns ? GetPattern(patterns, kNumberSymbol, L"minus")
+ : WideString();
}
WideString CXFA_XMLLocale::GetCurrencySymbol() const {
CFX_XMLElement* patterns = locale_->GetFirstChildNamed(kCurrencySymbols);
- return patterns ? GetPattern(patterns, kCurrencySymbol, L"symbol") : L"";
+ return patterns ? GetPattern(patterns, kCurrencySymbol, L"symbol")
+ : WideString();
}
WideString CXFA_XMLLocale::GetDateTimeSymbols() const {
CFX_XMLElement* symbols = locale_->GetFirstChildNamed(L"dateTimeSymbols");
- return symbols ? symbols->GetTextData() : L"";
+ return symbols ? symbols->GetTextData() : WideString();
}
WideString CXFA_XMLLocale::GetMonthName(int32_t nMonth, bool bAbbr) const {
@@ -121,7 +126,7 @@
bool bAbbr) const {
CFX_XMLElement* child = locale_->GetFirstChildNamed(L"calendarSymbols");
if (!child)
- return L"";
+ return WideString();
WideString pstrSymbolNames = symbol + L"Names";
CFX_XMLElement* name_child = nullptr;
@@ -142,17 +147,17 @@
break;
}
if (!name_child)
- return L"";
+ return WideString();
CFX_XMLElement* sym_element = name_child->GetNthChildNamed(symbol, index);
- return sym_element ? sym_element->GetTextData() : L"";
+ return sym_element ? sym_element->GetTextData() : WideString();
}
WideString CXFA_XMLLocale::GetDatePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const {
CFX_XMLElement* patterns = locale_->GetFirstChildNamed(L"datePatterns");
if (!patterns)
- return L"";
+ return WideString();
WideString wsName;
switch (eType) {
@@ -177,7 +182,7 @@
FX_LOCALEDATETIMESUBCATEGORY eType) const {
CFX_XMLElement* patterns = locale_->GetFirstChildNamed(L"timePatterns");
if (!patterns)
- return L"";
+ return WideString();
WideString wsName;
switch (eType) {
@@ -200,7 +205,7 @@
WideString CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const {
CFX_XMLElement* patterns = locale_->GetFirstChildNamed(L"numberPatterns");
- return patterns ? XFA_PatternToString(eType) : L"";
+ return patterns ? XFA_PatternToString(eType) : WideString();
}
WideString CXFA_XMLLocale::GetPattern(CFX_XMLElement* patterns,
@@ -214,5 +219,5 @@
return pattern->GetTextData();
}
}
- return L"";
+ return WideString();
}