[PATCH 1/2] Print: fix issues when printing a lot of dives in table print

Lubomir I. Ivanov neolit123 at gmail.com
Fri Dec 6 09:58:43 UTC 2013


On 6 December 2013 19:34, Dirk Hohndel <dirk at hohndel.org> wrote:
> On Fri, 2013-12-06 at 18:24 +0200, Lubomir I. Ivanov wrote:
>> From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
>> +     /* the algorithm bellow processes the table rows in multiple passes,
>> +      * compensating for loss of space due to moving rows on a new page instead
>> +      * of truncating them.
>> +      * there is a 'passes' array defining how much percents of the total
>> +      * progress each will take. given, the first and last stage of this function
>> +      * use 10% each, then the sum of passes[] here should be 80%.
>> +      * two should be enough! */
>> +     const int passes[] = { 70, 10 };
>> +     int tableHeight = 0, lastAccIndex = 0, rowH, accH, headings;
>> +     bool isHeading = false;
>> +
>> +     for (int pass = 0; pass < sizeof(passes); pass++) {
>
> http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#The-sizeof-Operator
>
> "You can use the sizeof operator to obtain the size (in bytes) of the
> data type of its operand."
>
> So no, sizeof(passes) does not give you the number of elements in the
> array.
>
> sizeof(passes) / sizeof(passes[0]) does...
>
> Oops (actually: SIGSEGV)
>

that's embarrassing :(.
i blame the lack of sleep...

attached is the fixed version.

lubomir
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Print-fix-issues-when-printing-a-lot-of-dives-in-tab.patch
Type: application/octet-stream
Size: 4728 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20131206/62354a7d/attachment.obj>


More information about the subsurface mailing list