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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 4 12:56:33 UTC 2019


 sd/source/core/drawdoc3.cxx |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit de1e3a4d78d34cb7ab8c9a2f260b66a98abec983
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Mar 4 08:46:52 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Mar 4 13:56:11 2019 +0100

    Avoid storing potentially negative and unused value in sal_uInt16 var
    
    At least during CppunitTest_sd_misc_tests, when bReplace is true the value
    initially calculated for nSdPageEnd (and later overwritten) was -1, so caused a
    warning with Clang's implicit-signed-integer-truncation.
    
    Change-Id: I69be2649e431590fc79808908470c9c2e3cf3c74
    Reviewed-on: https://gerrit.libreoffice.org/68663
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 56cdec6f4f50..d2112117d385 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -789,17 +789,13 @@ bool SdDrawDocument::InsertBookmarkAsPage(
     if (nInsertPos > 0)
     {
         sal_uInt16 nSdPageStart = (nInsertPos - 1) / 2;
-        sal_uInt16 nSdPageEnd = GetSdPageCount(PageKind::Standard) - nSdPageCount +
-                            nSdPageStart - 1;
+        sal_uInt16 nSdPageEnd = bReplace
+            ? nSdPageStart + nReplacedStandardPages - 1
+            : GetSdPageCount(PageKind::Standard) - nSdPageCount + nSdPageStart - 1;
         const bool bRemoveEmptyPresObj =
                 (pBookmarkDoc->GetDocumentType() == DocumentType::Impress) &&
                 (GetDocumentType() == DocumentType::Draw);
 
-        if( bReplace )
-        {
-            nSdPageEnd = nSdPageStart + nReplacedStandardPages - 1;
-        }
-
         std::vector<OUString>::iterator pExchangeIter;
 
         if (pExchangeList)


More information about the Libreoffice-commits mailing list