lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 878e52a 2/2: Fix remaining space calculation


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 878e52a 2/2: Fix remaining space calculation in compute_pages_for_table_rows()
Date: Fri, 26 Oct 2018 06:15:25 -0400 (EDT)

branch: master
commit 878e52a2dbe8fc112ddad5fc02e7c6fa5f32c2f7
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Fix remaining space calculation in compute_pages_for_table_rows()
    
    When the number of remaining rows, after accounting for the special case
    of the first page, was exactly divisible by the number of rows fitting
    on a continuation page, the remaining space was computed incorrectly as
    the code wrongly used 0 for the number of rows on the last page instead
    of the number of rows per page.
    
    This resulted in incorrectly assuming that the footer fits on the last
    page in the caller, which in turn led to assertion failures and wrong
    output.
---
 group_quote_pdf_gen_wx.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 5893a1d..1ffb818 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -812,6 +812,13 @@ int 
group_quote_pdf_generator_wx::compute_pages_for_table_rows
         total_pages += outward_quotient(remaining_rows, rows_per_page);
         remaining_space = page_area_y;
         remaining_rows %= rows_per_page;
+        if(!remaining_rows)
+            {
+            // If no rows remain, it actually means that the last page has the
+            // maximum amount of rows as we don't have an extra page with 0
+            // rows in this case.
+            remaining_rows = rows_per_page;
+            }
         }
 
     remaining_space -= remaining_rows * row_height;



reply via email to

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