diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-09-14 15:18:28 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-09-14 16:49:24 +0200 |
commit | 7469af24baeb74f171edec459d50e4502abe5017 (patch) | |
tree | aefefc13b6658becdd90f234e0edb0e1e899f4ac /sc/source/ui | |
parent | 7aa9f089e2f005c41d804530612e535c372f6c8b (diff) |
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@redhat.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
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; |