desktop/source/lib/init.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 654dfca97feb76480d4e99d0883686899e929a10
Author:     Jason Whitmore <[email protected]>
AuthorDate: Tue Sep 16 13:53:27 2025 -0700
Commit:     Hossein <[email protected]>
CommitDate: Wed Oct 15 13:41:03 2025 +0200

    tdf#158237 replace find() and end() with contains()
    
    This change updates some code to use C++20 features
    as well as minor performance improvements.
    
    Change-Id: I1f84d0f7155bec41a83ee2ddb011fdc5f0ba7386
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191056
    Reviewed-by: Hossein <[email protected]>
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 92aef9669b3d..fd181d521e02 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5123,8 +5123,9 @@ static void lcl_sendDialogEvent(unsigned long long int 
nWindowId, const char* pA
     SolarMutexGuard aGuard;
 
     const StringMap aMap(jsdialog::jsonToStringMap(pArguments));
+    auto aIdIter = aMap.find(u"id"_ustr);
 
-    if (aMap.find(u"id"_ustr) == aMap.end() || aMap.at(u"id"_ustr).isEmpty())
+    if (aIdIter == aMap.end() || aIdIter->second.isEmpty())
     {
         SAL_WARN("lok", "sendDialogEvent: no widget id set");
         assert(false);
@@ -5135,7 +5136,7 @@ static void lcl_sendDialogEvent(unsigned long long int 
nWindowId, const char* pA
 
     try
     {
-        const OUString sControlId = aMap.at(u"id"_ustr);
+        const OUString sControlId = aIdIter->second;
         OUString sWindowId = OUString::number(nWindowId);
         const OUString sCurrentShellId = OUString::number(nCurrentShellId);
 
@@ -7516,7 +7517,7 @@ static void 
doc_sendFormFieldEvent(LibreOfficeKitDocument* pThis, const char* pA
     }
 
     // Sanity check
-    if (aMap.find(u"type"_ustr) == aMap.end() || aMap.find(u"cmd"_ustr) == 
aMap.end())
+    if (!aMap.contains(u"type"_ustr) || !aMap.contains(u"cmd"_ustr))
     {
         SetLastExceptionMsg(u"Wrong arguments for sendFormFieldEvent!"_ustr);
         return;
@@ -7597,7 +7598,7 @@ static void 
doc_sendContentControlEvent(LibreOfficeKitDocument* pThis, const cha
     }
 
     // Sanity check
-    if (aMap.find(u"type"_ustr) == aMap.end())
+    if (!aMap.contains(u"type"_ustr))
     {
         SetLastExceptionMsg(u"Missing 'type' argument for 
sendContentControlEvent"_ustr);
         return;

Reply via email to