lmi
[Top][All Lists]
Advanced

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

[lmi] assorted warnings & compilation fixes


From: Vaclav Slavik
Subject: [lmi] assorted warnings & compilation fixes
Date: Fri, 25 May 2012 13:21:53 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

Hi,

here are some fixes for warnings (and one compilation error) I recently
encountered:


(1) This fixes a warning shown by Clang++. I agree with the compiler
    that it's easier on the human reader to use parenthesis here:

diff --git a/value_cast.hpp b/value_cast.hpp
index 807340d..f26834f 100644
--- a/value_cast.hpp
+++ b/value_cast.hpp
@@ -202,8 +202,8 @@ struct value_cast_choice
     enum
         {
         one_numeric_one_string =
-                boost::is_arithmetic<From>::value && is_string<To  >::value
-            ||  boost::is_arithmetic<To  >::value && is_string<From>::value
+                (boost::is_arithmetic<From>::value && is_string<To  >::value)
+            ||  (boost::is_arithmetic<To  >::value && is_string<From>::value)
         };
 
     enum


(2) VC++ produces a warning about comparing unsigned int and
    size_t values in the std::min use below. Because we already cast
    one of the values, we may as well cast it to the type that size()
    returns.

diff --git a/census_view.cpp b/census_view.cpp
index 6a029cb..d59488c 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -1593,7 +1593,7 @@ void CensusView::UponDeleteCells(wxCommandEvent&)
         list_model_->RowValueChanged(j, CensusViewDataViewModel::Col_CellNum);
 
     unsigned int const newsel = std::min
-        (static_cast<unsigned int>(erasures.front())
+        (static_cast<std::size_t>(erasures.front())
         ,cell_parms().size() - 1
         );
     wxDataViewItem const& y = list_model_->GetItem(newsel);


(3) wx/settings.h should be included for wxSystemSettings use in
    RangeTypeRenderer::GetSize:

diff --git a/census_view.cpp b/census_view.cpp
index 5d2d097..6a029cb 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -52,6 +52,7 @@
 #include <wx/icon.h>
 #include <wx/menu.h>
 #include <wx/msgdlg.h>
+#include <wx/settings.h>
 #include <wx/spinctrl.h>
 #include <wx/valnum.h>
 #include <wx/wupdlock.h>


Regards,
Vaclav



reply via email to

[Prev in Thread] Current Thread [Next in Thread]