diff options
-rw-r--r-- | core/fpdfdoc/doc_basic_unittest.cpp | 18 | ||||
-rw-r--r-- | core/fpdfdoc/doc_formcontrol.cpp | 2 | ||||
-rw-r--r-- | core/fxcrt/fx_basic_bstring.cpp | 28 | ||||
-rw-r--r-- | core/fxcrt/fx_basic_wstring.cpp | 28 | ||||
-rw-r--r-- | core/fxcrt/include/fx_string.h | 40 | ||||
-rw-r--r-- | fpdfsdk/fpdfdoc.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/fpdfppo.cpp | 7 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_comboboximp.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffdoc.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgetacc.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fontmgr.cpp | 11 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 62 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_simpleexpression.cpp | 16 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_serialize.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object_imp.cpp | 19 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_objectacc_imp.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_parser_imp.cpp | 2 |
19 files changed, 112 insertions, 149 deletions
diff --git a/core/fpdfdoc/doc_basic_unittest.cpp b/core/fpdfdoc/doc_basic_unittest.cpp index a84f334ebb..0ab70c9304 100644 --- a/core/fpdfdoc/doc_basic_unittest.cpp +++ b/core/fpdfdoc/doc_basic_unittest.cpp @@ -52,10 +52,10 @@ TEST(doc_basic_filespec, EncodeDecodeFileName) { }; for (const auto& data : test_data) { CFX_WideString encoded_str = CPDF_FileSpec::EncodeFileName(data.input); - EXPECT_TRUE(encoded_str.Equal(data.expected)); + EXPECT_TRUE(encoded_str == data.expected); // DecodeFileName is the reverse procedure of EncodeFileName. CFX_WideString decoded_str = CPDF_FileSpec::DecodeFileName(data.expected); - EXPECT_TRUE(decoded_str.Equal(data.input)); + EXPECT_TRUE(decoded_str == data.input); } } @@ -78,7 +78,7 @@ TEST(doc_basic_filespec, GetFileName) { CPDF_FileSpec file_spec(str_obj.get()); CFX_WideString file_name; EXPECT_TRUE(file_spec.GetFileName(&file_name)); - EXPECT_TRUE(file_name.Equal(test_data.expected)); + EXPECT_TRUE(file_name == test_data.expected); } { // Dictionary object. @@ -111,14 +111,14 @@ TEST(doc_basic_filespec, GetFileName) { for (int i = 0; i < 5; ++i) { dict_obj->SetAt(keywords[i], new CPDF_String(test_data[i].input)); EXPECT_TRUE(file_spec.GetFileName(&file_name)); - EXPECT_TRUE(file_name.Equal(test_data[i].expected)); + EXPECT_TRUE(file_name == test_data[i].expected); } // With all the former fields and 'FS' field suggests 'URL' type. dict_obj->SetAtString("FS", "URL"); EXPECT_TRUE(file_spec.GetFileName(&file_name)); // Url string is not decoded. - EXPECT_TRUE(file_name.Equal(test_data[4].input)); + EXPECT_TRUE(file_name == test_data[4].input); } { // Invalid object. @@ -152,7 +152,7 @@ TEST(doc_basic_filespec, SetFileName) { // Check we can get the file name back. CFX_WideString file_name; EXPECT_TRUE(file_spec1.GetFileName(&file_name)); - EXPECT_TRUE(file_name.Equal(test_data.input)); + EXPECT_TRUE(file_name == test_data.input); // Dictionary object. ScopedDict dict_obj(new CPDF_Dictionary); @@ -160,10 +160,10 @@ TEST(doc_basic_filespec, SetFileName) { file_spec2.SetFileName(test_data.input); // Check internal object value. file_name = dict_obj->GetUnicodeTextBy("F"); - EXPECT_TRUE(file_name.Equal(test_data.expected)); + EXPECT_TRUE(file_name == test_data.expected); file_name = dict_obj->GetUnicodeTextBy("UF"); - EXPECT_TRUE(file_name.Equal(test_data.expected)); + EXPECT_TRUE(file_name == test_data.expected); // Check we can get the file name back. EXPECT_TRUE(file_spec2.GetFileName(&file_name)); - EXPECT_TRUE(file_name.Equal(test_data.input)); + EXPECT_TRUE(file_name == test_data.input); } diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp index 255b5e9a70..1fcc4a386b 100644 --- a/core/fpdfdoc/doc_formcontrol.cpp +++ b/core/fpdfdoc/doc_formcontrol.cpp @@ -190,7 +190,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() { } CFX_ByteString csH = m_pWidgetDict->GetStringBy("H", "I"); for (int i = 0; g_sHighlightingMode[i]; ++i) { - if (csH.Equal(g_sHighlightingMode[i])) + if (csH == g_sHighlightingMode[i]) return static_cast<HighlightingMode>(i); } return Invert; diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index 10bc05bcc5..08f5dca664 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -217,30 +217,30 @@ const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) { ConcatInPlace(str.GetLength(), str.GetCStr()); return *this; } -bool CFX_ByteString::Equal(const char* ptr) const { - if (!m_pData) { - return !ptr || ptr[0] == '\0'; - } - if (!ptr) { +bool CFX_ByteString::operator==(const char* ptr) const { + if (!m_pData) + return !ptr || !ptr[0]; + + if (!ptr) return m_pData->m_nDataLength == 0; - } + return FXSYS_strlen(ptr) == m_pData->m_nDataLength && FXSYS_memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0; } -bool CFX_ByteString::Equal(const CFX_ByteStringC& str) const { - if (!m_pData) { +bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const { + if (!m_pData) return str.IsEmpty(); - } + return m_pData->m_nDataLength == str.GetLength() && FXSYS_memcmp(m_pData->m_String, str.GetCStr(), str.GetLength()) == 0; } -bool CFX_ByteString::Equal(const CFX_ByteString& other) const { - if (IsEmpty()) { +bool CFX_ByteString::operator==(const CFX_ByteString& other) const { + if (IsEmpty()) return other.IsEmpty(); - } - if (other.IsEmpty()) { + + if (other.IsEmpty()) return false; - } + return other.m_pData->m_nDataLength == m_pData->m_nDataLength && FXSYS_memcmp(other.m_pData->m_String, m_pData->m_String, m_pData->m_nDataLength) == 0; diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp index 642b75eafe..9c17948c34 100644 --- a/core/fxcrt/fx_basic_wstring.cpp +++ b/core/fxcrt/fx_basic_wstring.cpp @@ -198,30 +198,30 @@ const CFX_WideString& CFX_WideString::operator+=(const CFX_WideStringC& str) { ConcatInPlace(str.GetLength(), str.GetPtr()); return *this; } -bool CFX_WideString::Equal(const wchar_t* ptr) const { - if (!m_pData) { - return !ptr || ptr[0] == L'\0'; - } - if (!ptr) { +bool CFX_WideString::operator==(const wchar_t* ptr) const { + if (!m_pData) + return !ptr || !ptr[0]; + + if (!ptr) return m_pData->m_nDataLength == 0; - } + return wcslen(ptr) == static_cast<size_t>(m_pData->m_nDataLength) && wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0; } -bool CFX_WideString::Equal(const CFX_WideStringC& str) const { - if (!m_pData) { +bool CFX_WideString::operator==(const CFX_WideStringC& str) const { + if (!m_pData) return str.IsEmpty(); - } + return str.GetLength() == m_pData->m_nDataLength && wmemcmp(str.GetPtr(), m_pData->m_String, m_pData->m_nDataLength) == 0; } -bool CFX_WideString::Equal(const CFX_WideString& other) const { - if (IsEmpty()) { +bool CFX_WideString::operator==(const CFX_WideString& other) const { + if (IsEmpty()) return other.IsEmpty(); - } - if (other.IsEmpty()) { + + if (other.IsEmpty()) return false; - } + return other.m_pData->m_nDataLength == m_pData->m_nDataLength && wmemcmp(other.m_pData->m_String, m_pData->m_String, m_pData->m_nDataLength) == 0; diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index 0aa34171c2..26000dd6c1 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -194,16 +194,11 @@ class CFX_ByteString { bool IsEmpty() const { return !GetLength(); } int Compare(const CFX_ByteStringC& str) const; - - bool Equal(const char* ptr) const; - bool Equal(const CFX_ByteStringC& str) const; - bool Equal(const CFX_ByteString& other) const; - bool EqualNoCase(const CFX_ByteStringC& str) const; - bool operator==(const char* ptr) const { return Equal(ptr); } - bool operator==(const CFX_ByteStringC& str) const { return Equal(str); } - bool operator==(const CFX_ByteString& other) const { return Equal(other); } + bool operator==(const char* ptr) const; + bool operator==(const CFX_ByteStringC& str) const; + bool operator==(const CFX_ByteString& other) const; bool operator!=(const char* ptr) const { return !(*this == ptr); } bool operator!=(const CFX_ByteStringC& str) const { return !(*this == str); } @@ -588,26 +583,20 @@ class CFX_WideString { void Empty(); bool IsEmpty() const { return !GetLength(); } - FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } const CFX_WideString& operator=(const FX_WCHAR* str); - const CFX_WideString& operator=(const CFX_WideString& stringSrc); - const CFX_WideString& operator=(const CFX_WideStringC& stringSrc); const CFX_WideString& operator+=(const FX_WCHAR* str); - const CFX_WideString& operator+=(FX_WCHAR ch); - const CFX_WideString& operator+=(const CFX_WideString& str); - const CFX_WideString& operator+=(const CFX_WideStringC& str); - bool operator==(const wchar_t* ptr) const { return Equal(ptr); } - bool operator==(const CFX_WideStringC& str) const { return Equal(str); } - bool operator==(const CFX_WideString& other) const { return Equal(other); } + bool operator==(const wchar_t* ptr) const; + bool operator==(const CFX_WideStringC& str) const; + bool operator==(const CFX_WideString& other) const; bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); } bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); } @@ -632,51 +621,34 @@ class CFX_WideString { void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch); int Compare(const FX_WCHAR* str) const; - int Compare(const CFX_WideString& str) const; - int CompareNoCase(const FX_WCHAR* str) const; - bool Equal(const wchar_t* ptr) const; - bool Equal(const CFX_WideStringC& str) const; - bool Equal(const CFX_WideString& other) const; CFX_WideString Mid(FX_STRSIZE first) const; - CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const; - CFX_WideString Left(FX_STRSIZE count) const; - CFX_WideString Right(FX_STRSIZE count) const; FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch); - FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); void Format(const FX_WCHAR* lpszFormat, ...); - void FormatV(const FX_WCHAR* lpszFormat, va_list argList); void MakeLower(); - void MakeUpper(); void TrimRight(); - void TrimRight(FX_WCHAR chTarget); - void TrimRight(const FX_WCHAR* lpszTargets); void TrimLeft(); - void TrimLeft(FX_WCHAR chTarget); - void TrimLeft(const FX_WCHAR* lpszTargets); void Reserve(FX_STRSIZE len); - FX_WCHAR* GetBuffer(FX_STRSIZE len); - void ReleaseBuffer(FX_STRSIZE len = -1); int GetInteger() const; diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index 1b2daaeb5a..c9030e5035 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -291,7 +291,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetDirectObjectAt(i))); if (!pDict) continue; - if (pDict->GetStringBy("Subtype").Equal("Link")) { + if (pDict->GetStringBy("Subtype") == "Link") { *startPos = i + 1; *linkAnnot = (FPDF_LINK)pDict; return TRUE; diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index 94fa6bae84..cab2c6c3e0 100644 --- a/fpdfsdk/fpdfppo.cpp +++ b/fpdfsdk/fpdfppo.cpp @@ -54,7 +54,6 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, if (!pNewRoot) return FALSE; - // Set the document information CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo(); if (!DInfoDict) return FALSE; @@ -63,11 +62,9 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, producerstr.Format("PDFium"); DInfoDict->SetAt("Producer", new CPDF_String(producerstr, FALSE)); - // Set type CFX_ByteString cbRootType = pNewRoot->GetStringBy("Type", ""); - if (cbRootType.Equal("")) { + if (cbRootType.IsEmpty()) pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); - } CPDF_Object* pElement = pNewRoot->GetObjectBy("Pages"); CPDF_Dictionary* pNewPages = @@ -79,7 +76,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, } CFX_ByteString cbPageType = pNewPages->GetStringBy("Type", ""); - if (cbPageType.Equal("")) { + if (cbPageType == "") { pNewPages->SetAt("Type", new CPDF_Name("Pages")); } diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index 9d3a5db4c2..66d749a382 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -1556,7 +1556,7 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { FWL_HLISTITEM hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel); static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) ->GetItemText(hItem, wsTemp); - bMatchEqual = wsText.Equal(wsTemp); + bMatchEqual = wsText == wsTemp; } } if (iCurSel < 0) { @@ -1703,7 +1703,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { CFX_WideString wsTemp; FWL_HLISTITEM item = m_pOwner->m_pListBox->GetSelItem(iCurSel); m_pOwner->m_pListBox->GetItemText(item, wsTemp); - bMatchEqual = wsText.Equal(wsTemp); + bMatchEqual = wsText == wsTemp; } } if (iCurSel < 0) { diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 94f035251e..ed4f94cd77 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -59,7 +59,7 @@ FX_BOOL XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement, CFX_WideString wsTagName; CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); pXMLElement->GetTagName(wsTagName); - if (wsTagName.Equal(FX_WSTRC(L"document"))) { + if (wsTagName == FX_WSTRC(L"document")) { pDocumentElement = pXMLElement; break; } @@ -76,7 +76,7 @@ FX_BOOL XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement, CFX_WideString wsTagName; CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); pXMLElement->GetTagName(wsTagName); - if (wsTagName.Equal(FX_WSTRC(L"chunk"))) { + if (wsTagName == FX_WSTRC(L"chunk")) { pChunkElement = pXMLElement; break; } diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index fc8b38f458..5c2e6c354b 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -1583,7 +1583,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { CFX_WideString wsContentType; m_pTextNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); - if (wsContentType.Equal(FX_WSTRC(L"text/html"))) { + if (wsContentType == FX_WSTRC(L"text/html")) { bRichText = TRUE; } } @@ -1599,7 +1599,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { if (pChildNode && pChildNode->GetClassID() == XFA_ELEMENT_ExData) { CFX_WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); - if (wsContentType.Equal(FX_WSTRC(L"text/html"))) { + if (wsContentType == FX_WSTRC(L"text/html")) { bRichText = TRUE; } } @@ -1634,7 +1634,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { if (pChildNode && pChildNode->GetClassID() == XFA_ELEMENT_ExData) { CFX_WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); - if (wsContentType.Equal(FX_WSTRC(L"text/html"))) { + if (wsContentType == FX_WSTRC(L"text/html")) { bRichText = TRUE; } } diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index fb6fd39249..e915dcbaf7 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1960,8 +1960,8 @@ FX_BOOL CXFA_PDFFontMgr::PsNameMatchDRFontName( } if (iDifferLength > 1) { CFX_ByteString bsDRTailer = bsDRName.Right(iDifferLength); - if (bsDRTailer.Equal("MT") || bsDRTailer.Equal("PSMT") || - bsDRTailer.Equal("Regular") || bsDRTailer.Equal("Reg")) { + if (bsDRTailer == "MT" || bsDRTailer == "PSMT" || + bsDRTailer == "Regular" || bsDRTailer == "Reg") { return TRUE; } if (bBoldFont || bItalicFont) { @@ -1970,18 +1970,17 @@ FX_BOOL CXFA_PDFFontMgr::PsNameMatchDRFontName( FX_BOOL bMatch = FALSE; switch (bsPsName.GetAt(iPsLen - 1)) { case 'L': { - if (bsDRName.Right(5).Equal("Light")) { + if (bsDRName.Right(5) == "Light") { bMatch = TRUE; } } break; case 'R': { - if (bsDRName.Right(7).Equal("Regular") || - bsDRName.Right(3).Equal("Reg")) { + if (bsDRName.Right(7) == "Regular" || bsDRName.Right(3) == "Reg") { bMatch = TRUE; } } break; case 'M': { - if (bsDRName.Right(5).Equal("Medium")) { + if (bsDRName.Right(5) == "Medium") { bMatch = TRUE; } } break; diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index f60ed26c64..07a353e287 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -729,7 +729,7 @@ CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() { CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild); CFX_WideString wsTag; pXMLElement->GetLocalTagName(wsTag); - if (wsTag.Equal(FX_WSTRC(L"body")) || wsTag.Equal(FX_WSTRC(L"html"))) { + if (wsTag == FX_WSTRC(L"body") || wsTag == FX_WSTRC(L"html")) { pXMLContainer = pXMLChild; break; } diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 971c09d6f3..73eaed6f5b 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -3542,65 +3542,62 @@ void CXFA_FM2JSContext::UnitValue(FXJSE_HOBJECT hThis, strUnit = strFirstUnit; } FX_DOUBLE dResult = 0; - if (strFirstUnit.Equal("in") || strFirstUnit.Equal("inches")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + if (strFirstUnit == "in" || strFirstUnit == "inches") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber * 25.4; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber * 2.54; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber / 72; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber / 72000; } else { dResult = dFirstNumber; } - } else if (strFirstUnit.Equal("mm") || - strFirstUnit.Equal("millimeters")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + } else if (strFirstUnit == "mm" || strFirstUnit == "millimeters") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber / 10; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber / 25.4 / 72; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber / 25.4 / 72000; } else { dResult = dFirstNumber / 25.4; } - } else if (strFirstUnit.Equal("cm") || - strFirstUnit.Equal("centimeters")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + } else if (strFirstUnit == "cm" || strFirstUnit == "centimeters") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber * 10; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber / 2.54 / 72; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber / 2.54 / 72000; } else { dResult = dFirstNumber / 2.54; } - } else if (strFirstUnit.Equal("pt") || strFirstUnit.Equal("points")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + } else if (strFirstUnit == "pt" || strFirstUnit == "points") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber / 72 * 25.4; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber / 72 * 2.54; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber * 1000; } else { dResult = dFirstNumber / 72; } - } else if (strFirstUnit.Equal("mp") || - strFirstUnit.Equal("millipoints")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + } else if (strFirstUnit == "mp" || strFirstUnit == "millipoints") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber / 72000 * 25.4; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber / 72000 * 2.54; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber / 1000; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber; } else { dResult = dFirstNumber / 72000; @@ -5710,7 +5707,7 @@ void CXFA_FM2JSContext::equality_operator(FXJSE_HOBJECT hThis, FXJSE_Value_ToUTF8String(argFirst, firstOutput); FXJSE_Value_ToUTF8String(argSecond, secondOutput); FXJSE_Value_SetInteger(args.GetReturnValue(), - firstOutput.Equal(secondOutput) ? 1 : 0); + firstOutput == secondOutput); } else { FX_DOUBLE first = HValueToDouble(hThis, argFirst); FX_DOUBLE second = HValueToDouble(hThis, argSecond); @@ -5748,12 +5745,11 @@ void CXFA_FM2JSContext::notequality_operator(FXJSE_HOBJECT hThis, FXJSE_Value_ToUTF8String(argFirst, firstOutput); FXJSE_Value_ToUTF8String(argSecond, secondOutput); FXJSE_Value_SetInteger(args.GetReturnValue(), - firstOutput.Equal(secondOutput) ? 0 : 1); + firstOutput != secondOutput); } else { FX_DOUBLE first = HValueToDouble(hThis, argFirst); FX_DOUBLE second = HValueToDouble(hThis, argSecond); - FXJSE_Value_SetInteger(args.GetReturnValue(), - (first == second) ? 0 : 1); + FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); } FXJSE_Value_Release(argFirst); FXJSE_Value_Release(argSecond); @@ -6694,7 +6690,7 @@ FX_BOOL CXFA_FM2JSContext::simpleValueCompare(FXJSE_HOBJECT hThis, CFX_ByteString firstString, secondString; HValueToUTF8String(firstValue, firstString); HValueToUTF8String(secondValue, secondString); - bReturn = firstString.Equal(secondString); + bReturn = firstString == secondString; } else if (FXJSE_Value_IsNumber(firstValue)) { FX_FLOAT first = HValueToFloat(hThis, firstValue); FX_FLOAT second = HValueToFloat(hThis, secondValue); diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index 113fbfb536..f1e1137459 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -178,21 +178,21 @@ CXFA_FMIdentifierExpressionn::CXFA_FMIdentifierExpressionn( void CXFA_FMIdentifierExpressionn::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr = m_wsIdentifier; - if (tempStr.Equal(FX_WSTRC(L"$"))) { + if (tempStr == FX_WSTRC(L"$")) { tempStr = FX_WSTRC(L"this"); - } else if (tempStr.Equal(FX_WSTRC(L"!"))) { + } else if (tempStr == FX_WSTRC(L"!")) { tempStr = FX_WSTRC(L"xfa.datasets"); - } else if (tempStr.Equal(FX_WSTRC(L"$data"))) { + } else if (tempStr == FX_WSTRC(L"$data")) { tempStr = FX_WSTRC(L"xfa.datasets.data"); - } else if (tempStr.Equal(FX_WSTRC(L"$event"))) { + } else if (tempStr == FX_WSTRC(L"$event")) { tempStr = FX_WSTRC(L"xfa.event"); - } else if (tempStr.Equal(FX_WSTRC(L"$form"))) { + } else if (tempStr == FX_WSTRC(L"$form")) { tempStr = FX_WSTRC(L"xfa.form"); - } else if (tempStr.Equal(FX_WSTRC(L"$host"))) { + } else if (tempStr == FX_WSTRC(L"$host")) { tempStr = FX_WSTRC(L"xfa.host"); - } else if (tempStr.Equal(FX_WSTRC(L"$layout"))) { + } else if (tempStr == FX_WSTRC(L"$layout")) { tempStr = FX_WSTRC(L"xfa.layout"); - } else if (tempStr.Equal(FX_WSTRC(L"$template"))) { + } else if (tempStr == FX_WSTRC(L"$template")) { tempStr = FX_WSTRC(L"xfa.template"); } else if (tempStr[0] == L'!') { tempStr = EXCLAMATION_IN_IDENTIFIER + tempStr.Mid(1); diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index e525532f7c..5d371619e4 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -79,9 +79,9 @@ static FX_BOOL XFA_DataMerge_FormValueNode_SetChildContent( CFX_WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); - if (wsContentType.Equal(FX_WSTRC(L"text/html"))) { + if (wsContentType == FX_WSTRC(L"text/html")) { element = XFA_ELEMENT_SharpxHTML; - } else if (wsContentType.Equal(FX_WSTRC(L"text/xml"))) { + } else if (wsContentType == FX_WSTRC(L"text/xml")) { element = XFA_ELEMENT_Sharpxml; } } diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index f207b32263..448acbdd1d 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -242,7 +242,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( CFX_WideString wsContentType; pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); if (pRawValueNode->GetClassID() == XFA_ELEMENT_SharpxHTML && - wsContentType.Equal(FX_WSTRC(L"text/html"))) { + wsContentType == FX_WSTRC(L"text/html")) { CFDE_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); if (!pExDataXML) { break; @@ -264,7 +264,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( pTempStream->Release(); pMemStream->Release(); } else if (pRawValueNode->GetClassID() == XFA_ELEMENT_Sharpxml && - wsContentType.Equal(FX_WSTRC(L"text/xml"))) { + wsContentType == FX_WSTRC(L"text/xml")) { CFX_WideString wsRawValue; pRawValueNode->GetAttribute(XFA_ATTRIBUTE_Value, wsRawValue, FALSE); if (wsRawValue.IsEmpty()) { diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 0bd114b6c4..15f21c8a23 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -1078,7 +1078,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { FX_BOOL bPrettyMode = FALSE; if (iLength == 1) { CFX_ByteString bsPretty = pArguments->GetUTF8String(0); - if (!bsPretty.Equal("pretty")) { + if (bsPretty != "pretty") { ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); return; } @@ -1259,7 +1259,7 @@ void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { TryNamespace(wsNodeNameSpace); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { - FXJSE_Value_SetBoolean(hValue, wsNodeNameSpace.Equal(wsNameSpace)); + FXJSE_Value_SetBoolean(hValue, wsNodeNameSpace == wsNameSpace); } } void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue, @@ -1748,7 +1748,7 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); } else { CFX_WideString wsValue = GetScriptContent(TRUE); - FXJSE_Value_SetBoolean(hValue, wsValue.Equal(FX_WSTRC(L"1"))); + FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1")); } } struct XFA_ExecEventParaInfo { @@ -4303,17 +4303,16 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, CFX_WideString wsContentType; if (GetClassID() == XFA_ELEMENT_ExData) { GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); - if (wsContentType.Equal(FX_WSTRC(L"text/html"))) { + if (wsContentType == FX_WSTRC(L"text/html")) { wsContentType = FX_WSTRC(L""); SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType); } } CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); if (!pContentRawDataNode) { - pContentRawDataNode = - CreateSamePacketNode((wsContentType.Equal(FX_WSTRC(L"text/xml"))) - ? XFA_ELEMENT_Sharpxml - : XFA_ELEMENT_Sharptext); + pContentRawDataNode = CreateSamePacketNode( + (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_ELEMENT_Sharpxml + : XFA_ELEMENT_Sharptext); InsertChild(pContentRawDataNode); } return pContentRawDataNode->SetScriptContent( @@ -4409,9 +4408,9 @@ FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, if (GetClassID() == XFA_ELEMENT_ExData) { CFX_WideString wsContentType; GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); - if (wsContentType.Equal(FX_WSTRC(L"text/html"))) { + if (wsContentType == FX_WSTRC(L"text/html")) { element = XFA_ELEMENT_SharpxHTML; - } else if (wsContentType.Equal(FX_WSTRC(L"text/xml"))) { + } else if (wsContentType == FX_WSTRC(L"text/xml")) { element = XFA_ELEMENT_Sharpxml; } } diff --git a/xfa/fxfa/parser/xfa_objectacc_imp.cpp b/xfa/fxfa/parser/xfa_objectacc_imp.cpp index b634746ef4..8c438c5634 100644 --- a/xfa/fxfa/parser/xfa_objectacc_imp.cpp +++ b/xfa/fxfa/parser/xfa_objectacc_imp.cpp @@ -2273,7 +2273,7 @@ IFX_Locale* CXFA_WidgetData::GetLocal() { CFX_WideString wsLocaleName; bLocale = m_pNode->GetLocaleName(wsLocaleName); if (bLocale) { - if (wsLocaleName.Equal(FX_WSTRC(L"ambient"))) { + if (wsLocaleName == FX_WSTRC(L"ambient")) { pLocale = m_pNode->GetDocument()->GetLocalMgr()->GetDefLocale(); } else { pLocale = diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index a2c2ae7909..71c37755f9 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -1456,7 +1456,7 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { } m_pParser->GetTagName(m_ws1); static_cast<CFDE_XMLElement*>(m_pChild)->GetTagName(m_ws2); - if (m_ws1.GetLength() > 0 && !m_ws1.Equal(m_ws2)) { + if (m_ws1.GetLength() > 0 && m_ws1 != m_ws2) { m_dwStatus = FDE_XMLSYNTAXSTATUS_Error; break; } |