[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 61f9d2d: Write inequality comparisons in numb
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 61f9d2d: Write inequality comparisons in number-line order |
Date: |
Mon, 12 Mar 2018 19:04:40 -0400 (EDT) |
branch: master
commit 61f9d2d4592004fdf3d865f647d421ba44f721cf
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Write inequality comparisons in number-line order
---
interpolate_string.cpp | 2 +-
ledger_pdf_generator_wx.cpp | 12 ++++++------
wx_table_generator.cpp | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/interpolate_string.cpp b/interpolate_string.cpp
index 841f33e..6abadd0 100644
--- a/interpolate_string.cpp
+++ b/interpolate_string.cpp
@@ -78,7 +78,7 @@ void do_interpolate_string_in_context
// The maximum recursion level is chosen completely arbitrarily, the only
// criteria are that it shouldn't be too big to crash due to stack overflow
// before it is reached nor too small to break legitimate use cases.
- if(recursion_level >= 100)
+ if(100 <= recursion_level)
{
alarum()
<< "Nesting level too deep while expanding the partial \""
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 59f61fd..1815c53 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -271,7 +271,7 @@ class html_interpolator
// and also check for overflow (notice that index == SIZE_MAX
// doesn't, in theory, need to indicate overflow, but in practice
// we're never going to have valid indices close to this number).
- if(stop != s.c_str() + s.length() - 1 || index >= SIZE_MAX)
+ if(stop != s.c_str() + s.length() - 1 || SIZE_MAX <= index)
{
throw std::runtime_error
("Index of vector variable '" + s + "' is not a valid
number"
@@ -801,7 +801,7 @@ class pdf_illustration : protected html_interpolator
// Helper for abbreviating a string to at most the given length (in bytes).
static std::string abbreviate_if_necessary(std::string s, size_t len)
{
- if(s.length() > len && len > 3)
+ if(len < s.length() && 3 < len)
{
s.replace(len - 3, std::string::npos, "...");
}
@@ -1166,7 +1166,7 @@ class numbered_page : public page_with_footer
{
// This assert would fail if start_numbering() hadn't been called
// before creating a numbered page, as it should be.
- LMI_ASSERT(last_page_number_ >= 0);
+ LMI_ASSERT(0 <= last_page_number_);
}
void pre_render
@@ -1185,7 +1185,7 @@ class numbered_page : public page_with_footer
,interpolate_html
);
- LMI_ASSERT(extra_pages_ >= 0);
+ LMI_ASSERT(0 <= extra_pages_);
last_page_number_ += extra_pages_;
}
@@ -1215,7 +1215,7 @@ class numbered_page : public page_with_footer
{
// This method may only be called if we had reserved enough physical
// pages for this logical pages by overriding get_extra_pages_needed().
- LMI_ASSERT(extra_pages_ > 0);
+ LMI_ASSERT(0 < extra_pages_);
writer.dc().StartPage();
@@ -1658,7 +1658,7 @@ class page_with_tabular_report
rows_in_next_group = year_max - year;
}
- if(pos_y > page_bottom - rows_in_next_group * row_height)
+ if(page_bottom - rows_in_next_group * row_height < pos_y)
{
next_page(writer);
numbered_page::render(ledger, writer,
interpolate_html);
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index a34ca41..7c7b007 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -228,7 +228,7 @@ void
wx_table_generator::do_compute_column_widths_if_necessary()
i.width_ -= overflow_per_column;
- if(underflow > 0)
+ if(0 < underflow)
{
i.width_++;
underflow--;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [lmi] master 61f9d2d: Write inequality comparisons in number-line order,
Greg Chicares <=