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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 19 14:05:32 UTC 2018


 sw/source/core/text/pormulti.cxx |    2 +-
 sw/source/core/text/txtfrm.cxx   |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 23f3246dfa0c212ae662c14fa2d0c0ad1d222041
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 19 11:12:14 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Oct 19 16:03:37 2018 +0200

    sw_redlinehide_3: fix some unnecessary loops
    
    PVS-Studio complains about the funny code.
    
    Change-Id: I58e2ebcca7e13baa78cfbcc4a654d5badab8d037
    Reviewed-on: https://gerrit.libreoffice.org/61987
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Tested-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index c0dfeaba837a..ef87d58f168f 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -883,7 +883,7 @@ namespace sw {
             SwpHints const*const pHints(m_pNode->GetpSwpHints());
             if (pHints)
             {
-                while (m_CurrentHint < pHints->Count())
+                if (m_CurrentHint < pHints->Count())
                 {
                     SwTextAttr const*const pHint(pHints->Get(m_CurrentHint));
                     ++m_CurrentHint;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 86fa875516a4..fb3504d86da8 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -134,7 +134,7 @@ namespace sw {
             SwpHints const*const pHints(m_pNode->GetpSwpHints());
             if (pHints)
             {
-                while (m_CurrentHint < pHints->Count())
+                if (m_CurrentHint < pHints->Count())
                 {
                     SwTextAttr const*const pHint(pHints->Get(m_CurrentHint));
                     ++m_CurrentHint;
@@ -191,7 +191,7 @@ namespace sw {
             SwpHints const*const pHints(m_pNode->GetpSwpHints());
             if (pHints)
             {
-                while (m_CurrentHint < pHints->Count())
+                if (m_CurrentHint < pHints->Count())
                 {
                     SwTextAttr const*const pHint(
                             pHints->GetSortedByEnd(m_CurrentHint));
@@ -269,7 +269,7 @@ namespace sw {
             SwpHints const*const pHints(m_pNode->GetpSwpHints());
             if (pHints)
             {
-                while (0 < m_CurrentHint)
+                if (0 < m_CurrentHint)
                 {
                     SwTextAttr const*const pHint(pHints->Get(m_CurrentHint - 1));
                     --m_CurrentHint;


More information about the Libreoffice-commits mailing list