<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-09-17 14:20 GMT+02:00 Dirk Hohndel <span dir="ltr"><<a href="mailto:dirk@hohndel.org" target="_blank">dirk@hohndel.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Sep 17, 2015 at 12:13:06PM +0200, Guido Lerch wrote:<br>
> ><br>
> ><br>
> weird debug output, you have logfilenr 5, then logfilenr 4 then again<br>
> logfilenr 5 ....<br>
<br>
</span>Yes, indeed. Your existing code in master will alternate between those two<br>
files until the memory runs out. Which is because you are comparing the<br>
wrong two values. You compare the # that you ask for with the number that<br>
you want. You never parse (or use) the number that you got:<br></blockquote><div><br></div><div>interesting, I think your Uemis is unique in that. even I cleaned up the code, got</div><div>rid of the weird thing below I am not sure if my new patch can handle alternating</div><div>logfilenr.</div><div><br></div><div>I will implement your suggestion below and see what it does to mine since you</div><div>original code did alternate on my uemis between two dives till the memory ran</div><div>out too - so the question is, is my Uemis f..u.. or your's :-)</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
if (*dive_to_read >= dive->dc.diveid)<br>
        *dive_to_read = (*dive_to_read - 2 >= 0 ? *dive_to_read - 2 : 0);<br>
<br>
</span>So in my case where *dive_to_read and dive->dc.diveid are the same this<br>
condition is true the first time and *dive_to_read gets decremented.<br>
The next time around *dive_to_read is smaller and gets incremented.<br>
Then it's the same as the dc.diveid again and gets decremented.<br>
<br>
What you need to do instead is basically this:<br>
<br>
        uint32_t nr_found = 0;<br>
        char *logfilenr = strstr(mbuf, "logfilenr");<br>
        if (logfilenr)<br>
                sscanf(logfilenr, "logfilenr{int{%u", &nr_found);<br>
<br>
So figure out which logfilenr you got and then<br>
<br>
        if (nr_found >= dive->dc.diveid)<br>
                *dive_to_read = *dive_to_read - 2;<br>
        if (*dive_to_read < -1) // this will be incremented below so this way we can get to zero<br>
                *dive_to_read = -1;<br>
<br>
(easier on the eyes than your :? statement, IMHO)<br>
<br>
This way we compare what we found against what we want and decrement what<br>
we ask for until we get what we want.<br></blockquote><div><br></div><div>the issue is that if we only decrement it will not work on my, so I need to find some way to determine</div><div>whether the Uemis in use needs an increment or decrement - clearly funky design by Uemis Zurich </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> anyway, I think I understand what the difference is with your and my offset<br>
> and will send a patch soon.<br>
<br>
</span>Cool.<br>
<span class="HOEnZb"><font color="#888888"><br>
/D<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Best regards,<div>Guido</div></div></div>
</div></div>