<div dir="ltr">Test code: <a href="https://gist.github.com/greg-hellings/5218094">https://gist.github.com/greg-hellings/5218094</a><div><br></div><div style>Output with your current patch, Troy, is $ g++ `pkg-config --cflags sword` `pkg-config --libs sword` test.cpp -o test && ./test</div>
<div><font face="courier new, monospace">intro: 0</font></div><div><font face="courier new, monospace">bk (1): 1</font></div><div><font face="courier new, monospace">ch (1): 1</font></div><div><font face="courier new, monospace">vs (1): 1</font></div>
<div><font face="courier new, monospace">-----------------</font></div><div><font face="courier new, monospace">intro: 0</font></div><div><font face="courier new, monospace">bk (1): 0</font></div><div><font face="courier new, monospace">ch (1): 0</font></div>
<div><font face="courier new, monospace">vs (1): 0</font></div><div><font face="courier new, monospace">-----------------</font></div><div><font face="courier new, monospace">intro: 1</font></div><div><font face="courier new, monospace">bk (0): 0</font></div>
<div><font face="courier new, monospace">ch (0): 0</font></div><div><font face="courier new, monospace">vs (0): 0</font></div><div><font face="courier new, monospace">-----------------</font></div><div><br></div><div style>
The value in parenthsis represents what I thought the value "should" be. If I comment out line 19, I get this result $ g++ `pkg-config --cflags sword` `pkg-config --libs sword` test.cpp -o test && ./test</div>
<div><font face="courier new, monospace">intro: 0</font></div><div><font face="courier new, monospace">bk (1): 1</font></div><div><font face="courier new, monospace">ch (1): 1</font></div><div><font face="courier new, monospace">vs (1): 1</font></div>
<div><font face="courier new, monospace">-----------------</font></div><div><font face="courier new, monospace">intro: 0</font></div><div><font face="courier new, monospace">bk (1): 1</font></div><div><font face="courier new, monospace">ch (1): 1</font></div>
<div><font face="courier new, monospace">vs (1): 1</font></div><div><font face="courier new, monospace">-----------------</font></div><div><font face="courier new, monospace">intro: 1</font></div><div><font face="courier new, monospace">bk (0): 0</font></div>
<div><font face="courier new, monospace">ch (0): 0</font></div><div><font face="courier new, monospace">vs (0): 0</font></div><div><font face="courier new, monospace">-----------------</font></div><div><br></div><div style>
which matches the expected results. So Xiphos is getting around calling setIntros(1) by instead disabling auto-normalizing. It's odd to me that you can set a key to a value in the intros while setIntros is false. That doesn't seem like normalizing to me, that seems more like bounds checking, but that's not necessarily a bug in the API, possibly it's a bug in my understanding of intended behavior.</div>
<div style><br></div><div style>Troy's fix along with shuffling the location of setTestament (a change I made earlier to Xiphos' Subversion) fixes the known bugs I've seen in Xiphos regarding chapters not rendering and Genesis 1:1 causing a SegFault.</div>
<div style><br></div><div style>--Greg</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 21, 2013 at 6:51 PM, Greg Hellings <span dir="ltr"><<a href="mailto:greg.hellings@gmail.com" target="_blank">greg.hellings@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Thu, Mar 21, 2013 at 6:26 PM, Troy A. Griffitts <span dir="ltr"><<a href="mailto:scribe@crosswire.org" target="_blank">scribe@crosswire.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Thanks Karl, <br>
<br>
Yes, each snippet was helpful. Nic's was a quick test which caused the bug and was easy to use for testing. Greg's snippet wasn't as helpful as all his comments and stack traces leading up to his patch. He is preventing book from getting to 0 which does alleviate the problem but also stops a book from becoming an intro. Hope that explains.<br>
</div></div></blockquote><div><br></div></div><div>If the conditional in my code is changed to </div><div><br></div><div>if (book > (intros?0:1) ) {</div><div><br></div><div>Then my code corrects the problem that -- was moving a VerseKey from Genesis 1:1 to [Testament 1 Intro] when intros is false. While not a SegFault producing bug, this is still a bug. Similar checks should be made through the same run of code to ensure moving to verse 0 and chapter 0 are not possible when intros is false. Both your fix and an adapted form of mine should be introduced. Additionally, the issue with OSISFootnotes should probably be fixed.</div>
<div><br></div><div>I will write up a simple test case for that, if it helps, once I get back to my development machine.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>--Greg</div><div> </div></font></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
<div><div>
<br>
Troy <br><br><div class="gmail_quote">Karl Kleinpaste <<a href="mailto:karl@kleinpaste.org" target="_blank">karl@kleinpaste.org</a>> wrote:<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<pre style="white-space:pre-wrap;word-wrap:break-word;font-family:sans-serif;margin-top:0px"><div>You didn't also need this snippet from Greg a couple days ago?<br><br>--- src/keys/versekey.cpp (revision 2792)<br>
+++ src/keys/versekey.cpp (working copy)<br>@@ -1347,7 +1347,9 @@<br> }<br> if (verse < (intros?0:1)) {<br> if (--chapter < (intros?0:1)) {<br>- --book;<br>+ if (book > 1) {<br>+ --book;<br>+ }<br>
chapter += (getChapterMax() + (intros?1:0));<br> }<br> verse += (getVerseMax() + (intros?1:0));<br><br><hr><br></div><div>sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>Instructions to unsubscribe/change your settings at above page<br></div></pre></blockquote>
</div><br><div>
-- <br>
Sent from my Android phone with K-9 Mail. Please excuse my brevity.</div></div></div><br></div>_______________________________________________<div class="im"><br>
sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page<br></div></blockquote></div><br></div></div>
</blockquote></div><br></div>