[Libreoffice-commits] core.git: sc/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 14 14:49:57 UTC 2021


 sc/source/ui/docshell/impex.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7469af24baeb74f171edec459d50e4502abe5017
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Sep 14 15:18:28 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Sep 14 16:49:24 2021 +0200

    Drop some useless conversions to sal_Int32
    
    These started out as sal::static_int_cast<xub_StrLen> in
    1b9a6329fcda25fd738bd0e0a36663a6e745cab8 "INTEGRATION: CWS calcwarnings",
    presumably to silence some signed-to-unsigned conversion warnings, then morphed
    into the completely useless sal::static_int_cast<sal_Int32> with the String ->
    OUString changes (where the length parameter changed from unsigned xub_StrLen
    to signed sal_Int32), which then started to hide erroneous overflow (see e.g.
    4a4be7a1edead11b48e1a8598e52a3246e6744bb "tdf#144106 Don't proceed ptrim_i past
    ptrim_f") from tools like -fsanitize=implicit-integer-sign-change with the
    OUString -> std::u16string_view changes (where the length parameter changed from
    signed sal_Int32 to unsigned std::size_t).  If there were demand to prevent
    signed-to-unsigned conversion warnings here, that should be done with
    o3tl::make_unsigned instead.
    
    Change-Id: I9b078658500b6ed5dcd0e860d2f0b725133188f8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122092
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index daf0c6a626ff..59e266bcbdc0 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -687,7 +687,7 @@ static bool lcl_appendLineData( OUString& rField, const sal_Unicode* p1, const s
 {
     if (rField.getLength() + (p2 - p1) <= nArbitraryCellLengthLimit)
     {
-        rField += std::u16string_view( p1, sal::static_int_cast<sal_Int32>( p2 - p1 ) );
+        rField += std::u16string_view( p1, p2 - p1 );
         return true;
     }
     else
@@ -814,7 +814,7 @@ static const sal_Unicode* lcl_ScanSylkString( const sal_Unicode* p,
     }
     if (!pEndQuote)
         pEndQuote = p;  // Take all data as string.
-    rString += std::u16string_view(pStartQuote + 1, sal::static_int_cast<sal_Int32>( pEndQuote - pStartQuote - 1 ) );
+    rString += std::u16string_view(pStartQuote + 1, pEndQuote - pStartQuote - 1 );
     lcl_UnescapeSylk( rString, eVersion);
     return p;
 }
@@ -836,7 +836,7 @@ static const sal_Unicode* lcl_ScanSylkFormula( const sal_Unicode* p,
             }
             ++p;
         }
-        rString += std::u16string_view( pStart, sal::static_int_cast<sal_Int32>( p - pStart));
+        rString += std::u16string_view( pStart, p - pStart);
         lcl_UnescapeSylk( rString, eVersion);
     }
     else
@@ -877,7 +877,7 @@ static const sal_Unicode* lcl_ScanSylkFormula( const sal_Unicode* p,
         {
             while (*p && *p != ';')
                 ++p;
-            rString += std::u16string_view( pStart, sal::static_int_cast<sal_Int32>( p - pStart));
+            rString += std::u16string_view( pStart, p - pStart);
         }
     }
     return p;


More information about the Libreoffice-commits mailing list