[glom] Fixed some simple warnings found by scan-build.



commit 5e509c4e0b9b5b302e8077b296ad797aef145a72
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Mar 29 17:21:26 2012 +0200

    Fixed some simple warnings found by scan-build.
    
    * glom/libglom/report_builder.cc:
    * glom/mode_data/box_data_list_related.cc:
    * glom/mode_design/fields/box_db_table_definition.cc:
    * glom/python_embed/glom_python.cc: Mostly variables that were
    set but then not used.

 ChangeLog                                          |   10 ++++++++++
 glom/libglom/report_builder.cc                     |    1 -
 glom/mode_data/box_data_list_related.cc            |    8 ++++++++
 glom/mode_design/fields/box_db_table_definition.cc |    5 +++++
 glom/python_embed/glom_python.cc                   |    7 ++++++-
 5 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9a33666..236cc6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2012-03-29  Murray Cumming  <murrayc murrayc com>
 
+	Fixed some simple warnings found by scan-build.
+
+	* glom/libglom/report_builder.cc:
+	* glom/mode_data/box_data_list_related.cc:
+	* glom/mode_design/fields/box_db_table_definition.cc:
+	* glom/python_embed/glom_python.cc: Mostly variables that were
+	set but then not used.
+
+2012-03-29  Murray Cumming  <murrayc murrayc com>
+
 	Field: Remove get_holder().
 
 	* glom/libglom/data_structure/field.[h|cc]:
diff --git a/glom/libglom/report_builder.cc b/glom/libglom/report_builder.cc
index 89e2c86..cdcbd8b 100644
--- a/glom/libglom/report_builder.cc
+++ b/glom/libglom/report_builder.cc
@@ -497,7 +497,6 @@ bool ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp:
 
     value = datamodel->get_value_at(colField, row); //TODO: Catch exceptions.
     colField = 0;
-    row = 0;
   }
   else
   {
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index f0ae0b3..2c9aa22 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -149,12 +149,20 @@ bool Box_Data_List_Related::fill_from_database()
   {
     //No Foreign Key value, so just show the field names:
     result = Base_DB_Table_Data::fill_from_database();
+    if(!result)
+    {
+      std::cerr << G_STRFUNC << ": Base_DB_Table_Data::fill_from_database() failed." << std::endl;
+    }
 
     //create_layout();
   }
   else
   {
     result = Box_Data_Portal::fill_from_database();
+    if(!result)
+    {
+      std::cerr << G_STRFUNC << ": Box_Data_Portal::fill_from_database() failed." << std::endl;
+    }
 
     //TODO: Disable add if the from_field already has a value and the to_field is auto-incrementing because
     //- we cannot override the auto-increment in the to_field.
diff --git a/glom/mode_design/fields/box_db_table_definition.cc b/glom/mode_design/fields/box_db_table_definition.cc
index 6229289..d289fb7 100644
--- a/glom/mode_design/fields/box_db_table_definition.cc
+++ b/glom/mode_design/fields/box_db_table_definition.cc
@@ -126,6 +126,11 @@ void Box_DB_Table_Definition::fill_field_row(const Gtk::TreeModel::iterator& ite
 bool Box_DB_Table_Definition::fill_from_database()
 {
   bool result = Box_DB_Table::fill_from_database();
+  if(!result)
+  {
+    std::cerr << G_STRFUNC << ":  Box_DB_Table::fill_from_database() failed." << std::endl;
+    return false;
+  }
 
   if(!(ConnectionPool::get_instance()->get_ready_to_connect()))
     return false;
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index 5c58351..db9cbf6 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -114,7 +114,12 @@ static Glib::ustring get_traceback()
         chrRetval = g_strdup(PyString_AsString(strRetval));
 
       Py_DECREF(tbList);
-      Py_DECREF(strRetval);
+
+      if(strRetval)
+      {
+        Py_DECREF(strRetval);
+      }
+
       Py_DECREF(tracebackModule);
     }
     else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]