[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master e62a407 1/2: Fix type errors found by buildin
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master e62a407 1/2: Fix type errors found by building 64-bit msw binaries |
Date: |
Sun, 24 Mar 2019 22:15:12 -0400 (EDT) |
branch: master
commit e62a407fca13f113739c6e2b93affb7dfb710038
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Fix type errors found by building 64-bit msw binaries
---
census_view.cpp | 11 ++++++-----
docmanager_ex.cpp | 3 ++-
main_wx_test.cpp | 3 ++-
multidimgrid_any.cpp | 7 ++++---
multidimgrid_safe.tpp | 4 +++-
pdf_command_wx.cpp | 2 +-
tier_view_editor.cpp | 4 +++-
tier_view_editor.hpp | 4 +++-
wx_table_generator.cpp | 2 +-
9 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/census_view.cpp b/census_view.cpp
index fba4c79..690551e 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -889,10 +889,11 @@ bool CensusViewDataViewModel::SetValueByRow
return true;
}
+// Avoid using unsigned types in an interface.
unsigned int CensusViewDataViewModel::GetColumnCount() const
{
// "+ 1" for cell serial number in first column.
- return all_headers().size() + 1;
+ return bourn_cast<unsigned int>(lmi::ssize(all_headers()) + 1);
}
wxString CensusViewDataViewModel::GetColumnType(unsigned int col) const
@@ -1093,7 +1094,7 @@ wxWindow* CensusView::CreateChildWindow()
// Show headers.
document().Modify(false);
- list_model_->Reset(cell_parms().size());
+ list_model_->Reset(lmi::ssize(cell_parms()));
Update();
list_window_->Select(list_model_->GetItem(0));
@@ -1639,7 +1640,7 @@ void CensusView::UponDeleteCells(wxCommandEvent&)
LMI_ASSERT(lmi::ssize(cell_parms()) == n_items);
- for(int j = erasures.size() - 1; 0 <= j; --j)
+ for(int j = lmi::ssize(erasures) - 1; 0 <= j; --j)
{
cell_parms().erase(erasures[j] + cell_parms().begin());
}
@@ -1844,7 +1845,7 @@ void CensusView::UponPasteCensus(wxCommandEvent&)
return;
}
- auto selection = cell_parms().size();
+ auto selection = lmi::ssize(cell_parms());
if(!document().IsModified() && !document().GetDocumentSaved())
{
@@ -1874,7 +1875,7 @@ void CensusView::UponPasteCensus(wxCommandEvent&)
}
document().Modify(true);
- list_model_->Reset(cell_parms().size());
+ list_model_->Reset(lmi::ssize(cell_parms()));
Update();
// Reset() leaves the listview unreachable from the keyboard
// because no row is selected--so select the first added row
diff --git a/docmanager_ex.cpp b/docmanager_ex.cpp
index 3ea47d9..b6110b8 100644
--- a/docmanager_ex.cpp
+++ b/docmanager_ex.cpp
@@ -36,6 +36,7 @@
#include "docmanager_ex.hpp"
+#include "bourn_cast.hpp"
#include "previewframe_ex.hpp"
#include "single_choice_popup_menu.hpp"
#include "wx_new.hpp"
@@ -244,7 +245,7 @@ wxDocTemplate* DocManagerEx::SelectDocumentType
// Yes, this will be slow, but template lists
// are typically short.
int j;
- n = strings.Count();
+ n = bourn_cast<int>(strings.Count());
for(i = 0; i < n; ++i)
{
for(j = 0; j < noTemplates; ++j)
diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index 0f130e0..a205aae 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -30,6 +30,7 @@
#include "main_common.hpp" // initialize_application()
#include "path_utility.hpp" // initialize_filesystem()
#include "skeleton.hpp"
+#include "ssize_lmi.hpp" // sstrlen()
#include "wx_test_case.hpp"
#include "wx_test_new.hpp"
@@ -302,7 +303,7 @@ bool application_test::process_command_line(int& argc,
char* argv[])
char const* last_test_option = nullptr;
char const* opt_gui_test_path = "--gui_test_path";
- int const opt_gui_test_path_length = strlen(opt_gui_test_path);
+ int const opt_gui_test_path_length = lmi::sstrlen(opt_gui_test_path);
for(int n = 1; n < argc; )
{
diff --git a/multidimgrid_any.cpp b/multidimgrid_any.cpp
index 47b4748..2eb2cae 100644
--- a/multidimgrid_any.cpp
+++ b/multidimgrid_any.cpp
@@ -24,6 +24,7 @@
#include "multidimgrid_any.hpp"
#include "alert.hpp"
+#include "bourn_cast.hpp"
#include "wx_new.hpp"
#include "wx_workarounds.hpp" // wx[GS]et.*groundColor()
@@ -909,7 +910,7 @@ int MultiDimGrid::GetGridAxisSelection(enum_axis_x_or_y
x_or_y)
return wxNOT_FOUND;
}
- return wxPtrToUInt(choice.GetClientData(oldSel));
+ return bourn_cast<int>(wxPtrToUInt(choice.GetClientData(oldSel)));
}
void MultiDimGrid::DoSetGridAxisSelection(enum_axis_x_or_y x_or_y, int axis)
@@ -927,7 +928,7 @@ void MultiDimGrid::DoSetGridAxisSelection(enum_axis_x_or_y
x_or_y, int axis)
{
for(unsigned int i = 1; i < choice.GetCount(); ++i)
{
- int cdata = wxPtrToUInt(choice.GetClientData(i));
+ int cdata = bourn_cast<int>(wxPtrToUInt(choice.GetClientData(i)));
if(cdata == axis)
{
choice.SetSelection(i);
@@ -1252,7 +1253,7 @@ void MultiDimGrid::UponAxisVariesToggle(wxCommandEvent&
event)
alarum() << "Event received from unexpected control." << LMI_FLUSH;
}
- std::size_t index = it - axis_varies_checkboxes_.begin();
+ unsigned int index = bourn_cast<unsigned int>(it -
axis_varies_checkboxes_.begin());
bool varies = axis_varies_checkboxes_[index]->GetValue();
if(varies != table().VariesByDimension(index))
{
diff --git a/multidimgrid_safe.tpp b/multidimgrid_safe.tpp
index 192d114..b494c74 100644
--- a/multidimgrid_safe.tpp
+++ b/multidimgrid_safe.tpp
@@ -22,6 +22,8 @@
#include "multidimgrid_safe.hpp"
#include "alert.hpp"
+#include "bourn_cast.hpp"
+#include "ssize_lmi.hpp"
#include "value_cast.hpp"
/// MultiDimAxis<E>
@@ -55,7 +57,7 @@ MultiDimEnumAxis<E>::MultiDimEnumAxis
template<typename E>
unsigned int MultiDimEnumAxis<E>::GetCardinality() const
{
- return values_.size();
+ return bourn_cast<unsigned int>(lmi::ssize(values_));
}
template<typename E>
diff --git a/pdf_command_wx.cpp b/pdf_command_wx.cpp
index e138acc..5a6b4a4 100644
--- a/pdf_command_wx.cpp
+++ b/pdf_command_wx.cpp
@@ -1862,7 +1862,7 @@ class page_with_tabular_report
table_gen().output_headers(pos_y, output_mode);
- auto const ncols = get_table_columns().size();
+ auto const ncols = lmi::ssize(get_table_columns());
table_gen().output_horz_separator(0, ncols, pos_y, output_mode);
pos_y += table_gen().separator_line_height();
diff --git a/tier_view_editor.cpp b/tier_view_editor.cpp
index e622084..92fec04 100644
--- a/tier_view_editor.cpp
+++ b/tier_view_editor.cpp
@@ -24,8 +24,10 @@
#include "tier_view_editor.hpp"
#include "assert_lmi.hpp"
+#include "bourn_cast.hpp"
#include "ieee754.hpp" // infinity<>()
#include "multidimgrid_safe.tpp"
+#include "ssize_lmi.hpp"
#include "stratified_charges.hpp"
#include "value_cast.hpp"
@@ -81,7 +83,7 @@ void tier_entity_adapter::set_bands_count(unsigned int n)
values().push_back(0.0);
}
- unsigned int const size = limits().size();
+ unsigned int const size = bourn_cast<unsigned int>(lmi::ssize(limits()));
if(n < size)
{
diff --git a/tier_view_editor.hpp b/tier_view_editor.hpp
index 36b4852..7a3c8e1 100644
--- a/tier_view_editor.hpp
+++ b/tier_view_editor.hpp
@@ -29,6 +29,8 @@
#include "multidimgrid_tools.hpp"
#include "alert.hpp"
+#include "bourn_cast.hpp"
+#include "ssize_lmi.hpp"
#include <wx/version.h> // Mark this file as wx dependent.
@@ -142,7 +144,7 @@ inline std::vector<double> const&
tier_entity_adapter::values() const
inline unsigned int tier_entity_adapter::get_bands_count() const
{
- return is_void() ? 0 : limits().size();
+ return is_void() ? 0 : bourn_cast<unsigned int>(lmi::ssize(limits()));
}
/// Axis representing number of bands in the stratified_entity
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index a1adf8a..af9f41f 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -233,7 +233,7 @@ void wx_table_generator::output_super_header
int end_column = indices_[a_end_column];
std::vector<std::string> const lines(split_into_lines(header));
- int const anticipated_pos_y = pos_y + row_height() * lines.size();
+ int const anticipated_pos_y = pos_y + row_height() * lmi::ssize(lines);
switch(output_mode)
{