[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 5375d86 1/2: Write inequality comparisons in
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 5375d86 1/2: Write inequality comparisons in number-line order |
Date: |
Wed, 23 Nov 2016 20:24:44 +0000 (UTC) |
branch: master
commit 5375d86ab47f6595b5f576bfca7471f771782952
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Write inequality comparisons in number-line order
---
census_view.cpp | 2 +-
group_quote_pdf_gen_wx.cpp | 10 +++++-----
input_sequence_entry.cpp | 6 +++---
rate_table.cpp | 18 +++++++++---------
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/census_view.cpp b/census_view.cpp
index 32821c3..78e2582 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -808,7 +808,7 @@ wxString CensusViewDataViewModel::GetColumnType(unsigned
int col) const
std::string const& CensusViewDataViewModel::col_name(unsigned col) const
{
- LMI_ASSERT(col > 0);
+ LMI_ASSERT(0 < col);
return all_headers()[col - 1];
}
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 35a9403..ddeca66 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -336,11 +336,11 @@ wxImage load_image(char const* file)
/// Output an image at the given scale into the PDF.
///
-/// The scale specifies how many times the image should be shrunk, i.e. scale >
-/// 1 makes the image smaller while scale < 1 makes it larger.
+/// The scale specifies how many times the image should be shrunk:
+/// scale > 1 makes the image smaller, while scale < 1 makes it larger.
///
-/// Updates pos_y by increasing it by the height of the specified image at the
-/// given scale.
+/// Updates pos_y by increasing it by the height of the specified
+/// image at the given scale.
void output_image
(wxPdfDC& pdf_dc
@@ -1051,7 +1051,7 @@ void
group_quote_pdf_generator_wx::do_generate_pdf(wxPdfDC& pdf_dc)
{
table_gen.output_row(&pos_y, i->values);
- if(pos_y >= last_row_y)
+ if(last_row_y <= pos_y)
{
output_page_number_and_version(pdf_dc, total_pages, current_page);
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index fab6f2c..17bb769 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -696,7 +696,7 @@ void InputSequenceEditor::insert_row(int new_row)
// update id_to_row_ mapping:
for(id_to_row_map::iterator i = id_to_row_.begin(); i != id_to_row_.end();
++i)
{
- if(i->second >= new_row)
+ if(new_row <= i->second)
{
i->second = i->second + 1;
}
@@ -814,7 +814,7 @@ void InputSequenceEditor::remove_row(int row)
{
to_remove.push_back(i->first);
}
- else if(i->second > row)
+ else if(row < i->second)
{
i->second = i->second - 1;
}
@@ -1060,7 +1060,7 @@ void InputSequenceEditor::adjust_duration_num_range(int
row)
if(!duration_mode_field(row).needs_number())
return;
- int const prev_duration = (row > 0) ? duration_scalars_[row - 1] : 0;
+ int const prev_duration = (0 < row) ? duration_scalars_[row - 1] : 0;
wxSpinCtrl& duration = duration_num_field(row);
int range_min = 0;
diff --git a/rate_table.cpp b/rate_table.cpp
index 84b21bc..cbd9b3c 100644
--- a/rate_table.cpp
+++ b/rate_table.cpp
@@ -295,7 +295,7 @@ parse_result strict_parse_number(char const* start)
parse_result res;
// This check catches whitespace and the leading minus sign.
- if(*start >= '0' && *start <= '9')
+ if('0' <= *start && *start <= '9')
{
char* end = nullptr;
res.num = std::strtoull(start, &end, 10);
@@ -512,7 +512,7 @@ void writer::write_values
// that would result if we simply truncated it to 16 bits however.
do_write_record_header
(e_record_values
- ,length > std::numeric_limits<uint16_t>::max()
+ ,std::numeric_limits<uint16_t>::max() < length
? std::numeric_limits<uint16_t>::max()
: static_cast<uint16_t>(length)
);
@@ -570,7 +570,7 @@ void writer::write(enum_soa_field field,
boost::optional<std::string> const& ost
if(ostr)
{
std::string::size_type const length = ostr->size();
- if(length > std::numeric_limits<uint16_t>::max())
+ if(std::numeric_limits<uint16_t>::max() < length)
{
fatal_error()
<< "the value of the field '"
@@ -834,7 +834,7 @@ boost::optional<field_and_value> parse_field_and_value
// A valid field name can consist of a few words only, so check for this
// to avoid giving warnings about colons appearing in the middle (or even
// at the end of) a line.
- if(std::count(line.begin(), line.begin() + pos_colon, ' ') > 3)
+ if(3 < std::count(line.begin(), line.begin() + pos_colon, ' '))
{
return no_field;
}
@@ -1246,7 +1246,7 @@ unsigned table_impl::get_expected_number_of_values() const
// Compute the expected number of values, checking the consistency of the
// fields determining this as a side effect.
- if(*min_age_ > *max_age_)
+ if(*max_age_ < *min_age_)
{
fatal_error()
<< "minimum age " << *min_age_
@@ -1300,7 +1300,7 @@ unsigned table_impl::get_expected_number_of_values() const
// there is no risk of overflow here neither.
select_range *= *select_period_;
- if(select_range > std::numeric_limits<unsigned>::max() - num_values)
+ if(std::numeric_limits<unsigned>::max() - num_values < select_range)
{
fatal_error()
<< "too many values in the table with maximum age " <<
*max_age_
@@ -1386,7 +1386,7 @@ unsigned long table_impl::do_parse_number
;
}
- if(res.num > max_num)
+ if(max_num < res.num)
{
fatal_error()
<< "value for numeric field '"
@@ -2585,7 +2585,7 @@ void database_impl::remove_index_entry(table::Number
number)
// But also update the remaining lookup map indices.
for(auto& e: index_by_number_)
{
- if(e.second > index_deleted)
+ if(index_deleted < e.second)
{
--e.second;
}
@@ -2618,7 +2618,7 @@ void database_impl::read_index(std::istream& index_is)
offset = from_bytes<uint32_t>(&index_record[e_index_pos_offset]);
// Check that the cast to int below is safe.
- if(number >= static_cast<unsigned>(std::numeric_limits<int>::max()))
+ if(static_cast<unsigned>(std::numeric_limits<int>::max()) <= number)
{
fatal_error()
<< "database index is corrupt: "