changeset 26501:cfe28edab48b stable

pr-output.cc: Fix static analyzer detected issues (bug #55347). * pr-output.cc (make_real_format): Remove never executed code for inf_or_nan. * pr-output.cc (make_real_matrix_format): Remove never executed code for inf_or_nan. * pr-output.cc (make_complex_format): Remove never executed code for inf_or_nan. * pr-output.cc (make_complex_matrix_format): Remove never executed code for inf_or_nan. * pr-output.cc (octave_print_matrix_internal): Remove useless test on "j < lim". * pr-output.cc (octave_print_diag_matrix_internal): Remove useless test on "j < lim". * pr-output.cc (print_nd_array): Remove useless test on "i < m". * pr-output.cc (octave_print_internal): Remove useless test on "j < lim" and on "i < m".
author Rik <rik@octave.org>
date Tue, 08 Jan 2019 17:13:20 -0800
parents d76f9e42290a
children dfc8d79cc28b
files libinterp/corefcn/pr-output.cc
diffstat 1 files changed, 5 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc	Tue Jan 08 16:44:44 2019 -0800
+++ b/libinterp/corefcn/pr-output.cc	Tue Jan 08 17:13:20 2019 -0800
@@ -412,8 +412,6 @@
         }
 
       fw = 1 + ld + 1 + rd;
-      if (inf_or_nan && fw < 4)
-        fw = 4;
     }
 
   if (! (rat_format || bank_format || hex_format || bit_format)
@@ -514,8 +512,6 @@
     {
       int digits = (x_max > x_min ? x_max : x_min);
       fw = (digits <= 0 ? 5 : digits + 4);
-      if (inf_or_nan && fw < 5)
-        fw = 5;
       rd = 2;
     }
   else if (hex_format)
@@ -687,8 +683,6 @@
       int digits = r_x;
       i_fw = 0;
       r_fw = (digits <= 0 ? 5 : digits + 4);
-      if (inf_or_nan && r_fw < 5)
-        r_fw = 5;
       rd = 2;
     }
   else if (hex_format)
@@ -755,11 +749,6 @@
 
       i_fw = ld + 1 + rd;
       r_fw = i_fw + 1;
-      if (inf_or_nan && i_fw < 3)
-        {
-          i_fw = 3;
-          r_fw = 4;
-        }
     }
 
   if (! (rat_format || bank_format || hex_format || bit_format)
@@ -906,8 +895,6 @@
       int digits = (r_x_max > r_x_min ? r_x_max : r_x_min);
       i_fw = 0;
       r_fw = (digits <= 0 ? 5 : digits + 4);
-      if (inf_or_nan && r_fw < 5)
-        r_fw = 5;
       rd = 2;
     }
   else if (hex_format)
@@ -1837,7 +1824,7 @@
                         os << "[ ";
                       else
                         {
-                          if (j > col && j < lim)
+                          if (j > col)
                             os << ", ";
                           else
                             os << "  ";
@@ -1953,7 +1940,7 @@
                     os << "[ ";
                   else
                     {
-                      if (j > col && j < lim)
+                      if (j > col)
                         os << ", ";
                       else
                         os << "  ";
@@ -2091,8 +2078,7 @@
               page.print_raw (os);
             }
 
-          if (i < m)
-            NDA_T::increment_index (ra_idx, dims, 2);
+          NDA_T::increment_index (ra_idx, dims, 2);
         }
     }
 }
@@ -2247,7 +2233,7 @@
                     os << "[ ";
                   else
                     {
-                      if (j > col && j < lim)
+                      if (j > col)
                         os << ", ";
                       else
                         os << "  ";
@@ -2691,8 +2677,7 @@
           if (i < m - 1)
             os << "\n";
 
-          if (i < m)
-            increment_index (ra_idx, dims, 2);
+          increment_index (ra_idx, dims, 2);
         }
     }
 }