[glom] export utils: Don't put an int in and unsigned int.



commit 3cc9c8620ddcd954a557f983c765e1ff8866e46b
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Mar 29 14:04:18 2016 +0200

    export utils: Don't put an int in and unsigned int.
    
    -1 is a real possible value, so this is a real issue.

 glom/libglom/db_utils_export.cc |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/glom/libglom/db_utils_export.cc b/glom/libglom/db_utils_export.cc
index acaf858..b368d22 100644
--- a/glom/libglom/db_utils_export.cc
+++ b/glom/libglom/db_utils_export.cc
@@ -109,19 +109,19 @@ void export_data_to_stream(const std::shared_ptr<Document>& document, std::ostre
   //TODO: Lock the database (prevent changes) during export.
   auto result = DbUtils::query_execute_select(query);
 
-  guint rows_count = 0;
+  int rows_count = 0;
   if(result)
-    rows_count = result->get_n_rows();
+    rows_count = result->get_n_rows(); // -1 means unknown.
 
-  if(rows_count)
+  if(rows_count > 0)
   {
-    const guint columns_count = result->get_n_columns();
+    const auto columns_count = result->get_n_columns(); // -1 means unknown.
 
-    for(guint row_index = 0; row_index < rows_count; ++row_index)
+    for(int row_index = 0; row_index < rows_count; ++row_index)
     {
         std::string row_string;
 
-        for(guint col_index = 0; col_index < columns_count; ++col_index)
+        for(int col_index = 0; col_index < columns_count; ++col_index)
         {
           const auto value = result->get_value_at(col_index, row_index);
 


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