]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a couple places that cppcheck marked up.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 1 Dec 2010 20:21:18 +0000 (20:21 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 1 Dec 2010 20:21:18 +0000 (20:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@22893 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/constraint_matrix.templates.h
deal.II/include/deal.II/lac/trilinos_sparse_matrix.h
deal.II/source/base/index_set.cc
deal.II/source/base/parameter_handler.cc
deal.II/source/grid/grid_reordering.cc
deal.II/source/grid/grid_tools.cc

index 637b20b21484d4b5867cbec80c4324fc611aee0b..6270f60bc941a35d563cca7ad8563764cc4067c8 100644 (file)
@@ -990,8 +990,8 @@ namespace internals
 
       ~DataCache()
        {
-         if (data != 0)
-           delete [] data;
+         delete [] data;
+         data = 0;
        }
 
       void reinit ()
index b173f7dc2b016cb5cb172c060e9cb0f923e0a880..8cab8ef9cf2800e2c6e01f1792da914755fc788e 100644 (file)
@@ -2790,7 +2790,6 @@ namespace TrilinosWrappers
                     const unsigned int   j,
                     const TrilinosScalar value)
   {
-
     Assert (numbers::is_finite(value), ExcNumberNotFinite());
 
     if (value == 0)
index 2ecf4f2bc6d597fc1a378103a7f89363dbb903c9..073715cb286f6543dbdd742e6feebe320615745b 100644 (file)
@@ -241,7 +241,7 @@ IndexSet::block_write(std::ostream & out) const
   size_t n_ranges = ranges.size();
   out.write(reinterpret_cast<const char*>(&n_ranges),
            sizeof(n_ranges));
-  if (ranges.size())
+  if (ranges.empty() == false)
     out.write (reinterpret_cast<const char*>(&*ranges.begin()),
               reinterpret_cast<const char*>(&*ranges.end())
               - reinterpret_cast<const char*>(&*ranges.begin()));
@@ -257,7 +257,7 @@ IndexSet::block_read(std::istream & in)
   in.read(reinterpret_cast<char*>(&n_ranges), sizeof(n_ranges));
                                   // we have to clear ranges first
   ranges.clear();
-  set_size(size);  
+  set_size(size);
   ranges.resize(n_ranges, Range(0,0));
   if (n_ranges)
     in.read(reinterpret_cast<char*>(&*ranges.begin()),
index 009a7260fee95622077a8cf34ad481553788c7ea..0ed237c25f68645933916f8823bc8f671c351270 100644 (file)
@@ -74,48 +74,48 @@ namespace Patterns
   PatternBase* pattern_factory (const std::string& description)
   {
     PatternBase* p;
-    
+
     p = Integer::create(description);
     if (p != 0)
       return p;
-    
+
     p = Double::create(description);
     if (p !=0 )
       return p;
-    
+
     p = Selection::create(description);
     if (p !=0 )
       return p;
-      
+
     p = List::create(description);
-    if (p !=0 )  
+    if (p !=0 )
       return p;
-  
+
     p = MultipleSelection::create(description);
-    if (p !=0 )  
+    if (p !=0 )
       return p;
-  
+
     p = Bool::create(description);
     if (p!=0 )
       return p;
-  
+
     p = Anything::create(description);
     if (p !=0 )
       return p;
-      
+
     p = FileName::create(description);
     if (p !=0 )
       return p;
-      
+
     p = DirectoryName::create(description);
     if (p!=0 )
       return p;
-      
+
     Assert(false, ExcNotImplemented());
-    
+
     return 0;
   }
-  
+
 
 
   PatternBase::~PatternBase ()
@@ -137,7 +137,7 @@ namespace Patterns
       return sizeof(*this) + 32;
   }
 
-  
+
 
   const int Integer::min_int_value =
 #ifdef HAVE_STD_NUMERIC_LIMITS
@@ -223,22 +223,22 @@ namespace Patterns
     if(description.compare(0, std::strlen(description_init), description_init) == 0)
     {
       std::istringstream is(description);
-      
+
       if(is.str().size() > strlen(description_init) + 1)
-      { 
+      {
 //TODO: verify that description matches the pattern "^\[Integer range \d+\.\.\.\d+\]$"
         int lower_bound, upper_bound;
-        
+
         is.ignore(strlen(description_init) + strlen(" range "));
-        
+
         if(!(is >> lower_bound))
           return new Integer();
-          
+
         is.ignore(strlen("..."));
-        
+
         if(!(is >> upper_bound))
           return new Integer();
-        
+
         return new Integer(lower_bound, upper_bound);
       }
       else
@@ -247,7 +247,7 @@ namespace Patterns
     else
       return 0;
   }
-  
+
 
 
   const double Double::min_double_value =
@@ -336,21 +336,21 @@ namespace Patterns
     if(description.compare(0, std::strlen(description_init), description_init) == 0)
     {
       std::istringstream is(description);
-      
+
       if(is.str().size() > strlen(description_init) + 1)
-      { 
+      {
         double lower_bound, upper_bound;
-        
+
         is.ignore(strlen(description_init) + strlen(" range "));
-        
+
         if(!(is >> lower_bound))
           return new Double();
-          
+
         is.ignore(strlen("..."));
-        
+
         if(!(is >> upper_bound))
           return new Double();
-        
+
         return new Double(lower_bound, upper_bound);
       }
       else
@@ -359,7 +359,7 @@ namespace Patterns
     else
       return 0;
   }
-  
+
 
 
   const char* Selection::description_init = "[Selection";
@@ -434,16 +434,16 @@ namespace Patterns
     if(description.compare(0, std::strlen(description_init), description_init) == 0)
     {
       std::string sequence(description);
-      
+
       sequence.erase(0, std::strlen(description_init) + 1);
       sequence.erase(sequence.length()-2, 2);
-      
+
       return new Selection(sequence);
     }
     else
       return 0;
   }
-  
+
 
 
   const unsigned int List::max_int_value =
@@ -561,26 +561,26 @@ namespace Patterns
     if(description.compare(0, std::strlen(description_init), description_init) == 0)
     {
       int min_elements, max_elements;
-      
+
       std::istringstream is(description);
       is.ignore(strlen(description_init) + strlen(" list of <"));
-      
+
       std::auto_ptr<char> new_description (new char[is.str().size() + 1]);
       is.getline(&(*new_description), is.str().size(), '>');
       std::string str(&(*new_description));
-      
+
       std::auto_ptr<PatternBase> base_pattern (pattern_factory(str));
-      
+
       is.ignore(strlen(" of length "));
       if(!(is >> min_elements))
         return new List(*base_pattern);
-        
+
       is.ignore(strlen("..."));
       if(!(is >> max_elements))
         return new List(*base_pattern);
-      
+
       return new List(*base_pattern, min_elements, max_elements);
-    }  
+    }
     else
       return 0;
   }
@@ -702,21 +702,21 @@ namespace Patterns
     if(description.compare(0, std::strlen(description_init), description_init) == 0)
     {
       std::string sequence(description);
-      
+
       sequence.erase(0, std::strlen(description_init) + 1);
       sequence.erase(sequence.length()-2, 2);
-      
+
       return new MultipleSelection(sequence);
     }
     else
       return 0;
   }
-  
+
 
 
   const char* Bool::description_init = "[Bool";
 
-  
+
   Bool::Bool ()
                   :
                  Selection ("true|false")
@@ -750,7 +750,7 @@ namespace Patterns
       return new Bool();
     else
       return 0;
-  } 
+  }
 
 
 
@@ -795,7 +795,7 @@ namespace Patterns
       return new Anything();
     else
       return 0;
-  } 
+  }
 
 
 
@@ -846,21 +846,21 @@ namespace Patterns
       std::istringstream is(description);
       std::string file_type;
       FileType type;
-      
+
       is.ignore(strlen(description_init) + strlen(" (Type:"));
-      
+
       is >> file_type;
-      
+
       if (file_type == "input)]")
         type = input;
-      else 
+      else
         type = output;
-      
+
       return new FileName(type);
-    }  
+    }
     else
       return 0;
-  } 
+  }
 
 
 
@@ -904,7 +904,7 @@ namespace Patterns
       return new DirectoryName();
     else
       return 0;
-  } 
+  }
 
 }   // end namespace Patterns
 
@@ -1646,7 +1646,7 @@ ParameterHandler::print_parameters_section (std::ostream      &out,
                    out << std::setw(indent_level*2+6) << ""
                        << description_str[i] << std::endl;
                }
-             else if (description_str.size() > 0)
+             else if (description_str.empty() == false)
                out << "  " << description_str[0] << std::endl;
              else
                out << std::endl;
index 6b47bba43f18c587aeecd6f1ee1a02941874b433..4550de69f299dce7b42b65e362a0206304172dcd 100644 (file)
@@ -1362,7 +1362,7 @@ namespace internal
                                       // finished with.
       Cell &c = mesh.cell_list[cur_posn];
       c.waiting_to_be_processed = false;
-      if (sheet_to_process.size() != 0)
+      if (sheet_to_process.empty() == false)
        {
          cur_posn = sheet_to_process.back();
          sheet_to_process.pop_back();
index 5af96763c749b85ed8b29a38e9501d9b78686958..bfe89e2bf23c31606f00f2b05eef7a75884cd532 100644 (file)
@@ -489,7 +489,7 @@ GridTools::delete_duplicated_vertices (std::vector<Point<spacedim> >    &vertice
                      :
                      angle(angle)
        {}
-      Point<2> operator() (const Point<2> p) const
+      Point<2> operator() (const Point<2> &p) const
        {
          return Point<2> (std::cos(angle)*p(0) - std::sin(angle) * p(1),
                           std::sin(angle)*p(0) + std::cos(angle) * p(1));

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.