OSDN Git Service

Cppcheck: Condition '...' is always true
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Wed, 6 May 2020 12:51:22 +0000 (21:51 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Wed, 6 May 2020 12:51:22 +0000 (21:51 +0900)
Externals/crystaledit/editlib/LineInfo.cpp
Externals/crystaledit/editlib/ccrystaltextview.cpp
Externals/crystaledit/editlib/parsers/tex.cpp

index af84f90..18129e9 100644 (file)
@@ -89,7 +89,7 @@ void LineInfo::Create(LPCTSTR pszLine, size_t nLength)
   int nEols = 0;
   if (nLength > 1 && IsDosEol(&pszLine[nLength - 2]))
     nEols = 2;
-  else if (nLength && IsEol(pszLine[nLength - 1]))
+  else if (IsEol(pszLine[nLength - 1]))
     nEols = 1;
   ASSERT (static_cast<size_t>(nEols) <= m_nLength);
   m_nLength -= nEols;
index 9d3bdd6..e594093 100644 (file)
@@ -5636,7 +5636,7 @@ OnMatchBrace ()
         {
           bAfter = false;
         }
-      else if (!nType && ptCursorPos.x > 0)
+      else if (ptCursorPos.x > 0)
         {
           nType = bracetype (pszEnd[-1]);
           bAfter = true;
index 2bffd71..df8f564 100644 (file)
@@ -1002,19 +1002,15 @@ out:
               else
                 {
                   bool bFunction = false;
-
-                  if (!bFunction)
+                  for (int j = I; j >= 0; j--)
                     {
-                      for (int j = I; j >= 0; j--)
+                      if (!xisspace (pszChars[j]))
                         {
-                          if (!xisspace (pszChars[j]))
+                          if (pszChars[j] == '$')
                             {
-                              if (pszChars[j] == '$')
-                                {
-                                  bFunction = true;
-                                }
-                              break;
+                              bFunction = true;
                             }
+                          break;
                         }
                     }
                   if (bFunction)
@@ -1046,19 +1042,15 @@ out:
       else
         {
           bool bFunction = false;
-
-          if (!bFunction)
+          for (int j = I; j >= 0; j--)
             {
-              for (int j = I; j >= 0; j--)
+              if (!xisspace (pszChars[j]))
                 {
-                  if (!xisspace (pszChars[j]))
+                  if (pszChars[j] == '$')
                     {
-                      if (pszChars[j] == '$')
-                        {
-                          bFunction = true;
-                        }
-                      break;
+                      bFunction = true;
                     }
+                  break;
                 }
             }
           if (bFunction)