sw/inc/view.hxx                      |    4 ++--
 sw/source/uibase/uiview/viewsrch.cxx |   12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit a62d9e9bb6b565e83c422066cf1f428173cdc0e0
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Mar 26 12:16:26 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Mar 26 10:05:41 2025 +0100

    tdf#165910: use sal_Int32 for match count
    
    This is what all the functions called from SwView::FUNC_Search return:
    SwWrtShell::SearchAttr, SwWrtShell::SearchTempl, SwWrtShell::SearchPattern;
    and all of them use SAL_MAX_INT32 to denote 'cancel' state.
    
    Change-Id: Icec9c6b33ebfc856e4a67320f3442324db7459d6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183324
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index a70668a09048..f07662ccb138 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -285,8 +285,8 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
     // methods for searching
     // set search context
     SAL_DLLPRIVATE bool          SearchAndWrap(bool bApi);
-    SAL_DLLPRIVATE sal_uInt16 SearchAll();
-    SAL_DLLPRIVATE sal_uLong     FUNC_Search( const SwSearchOptions& rOptions 
);
+    SAL_DLLPRIVATE sal_Int32 SearchAll();
+    SAL_DLLPRIVATE sal_Int32     FUNC_Search( const SwSearchOptions& rOptions 
);
     SAL_DLLPRIVATE void          Replace();
 
     bool                        IsDocumentBorder();
diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index 1944f1f40ca3..9d3eaa3603b5 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -350,7 +350,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
                 {
                     SwSearchOptions aOpts( m_pWrtShell.get(), 
s_pSrchItem->GetBackward() );
                     s_bExtra = false;
-                    sal_uLong nFound;
+                    sal_Int32 nFound;
 
                     {   //Scope for SwWait-Object
                         SwWait aWait( *GetDocShell(), true );
@@ -381,7 +381,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
                         m_pWrtShell->EndAllAction();
                     }
 
-                    rReq.SetReturnValue(SfxBoolItem(nSlot, nFound != 0 && 
ULONG_MAX != nFound));
+                    rReq.SetReturnValue(SfxBoolItem(nSlot, nFound != 0 && 
SAL_MAX_INT32 != nFound));
                     if( !nFound )
                     {
 #if HAVE_FEATURE_DESKTOP
@@ -396,7 +396,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
                         return;
                     }
 
-                    if( !bQuiet && ULONG_MAX != nFound)
+                    if (!bQuiet && SAL_MAX_INT32 != nFound)
                     {
                         OUString sText( SwResId( STR_NB_REPLACED ) );
                         sText = sText.replaceFirst("XX", OUString::number( 
nFound ));
@@ -618,7 +618,7 @@ bool SwView::SearchAndWrap(bool bApi)
     return s_bFound;
 }
 
-sal_uInt16 SwView::SearchAll()
+sal_Int32 SwView::SearchAll()
 {
     SwWait aWait( *GetDocShell(), true );
     m_pWrtShell->StartAllAction();
@@ -636,7 +636,7 @@ sal_uInt16 SwView::SearchAll()
             m_pWrtShell->StartOfSection();
     }
     s_bExtra = false;
-    sal_uInt16 nFound = o3tl::narrowing<sal_uInt16>(FUNC_Search( aOpts ));
+    auto nFound = FUNC_Search(aOpts);
     s_bFound = 0 != nFound;
 
     m_pWrtShell->EndAllAction();
@@ -752,7 +752,7 @@ SwSearchOptions::SwSearchOptions( SwWrtShell const * pSh, 
bool bBackward )
     }
 }
 
-sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions )
+sal_Int32 SwView::FUNC_Search(const SwSearchOptions& rOptions)
 {
 #if HAVE_FEATURE_DESKTOP
     SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::Empty);

Reply via email to