<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>DM,</p>
<p>Sorry for the late reply and thank you for tracking this down.
Yes! This looks like a reasonable solution. Please feel free to
commit if all the sword/tests/testsuite/run-all.sh returns no
problems with your change.</p>
<p>It's been a bit crazy these days and I haven't been able to keep
up with all the great stuff going on here.<br>
</p>
<p>Troy</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 6/16/25 9:27 PM, DM Smith wrote:<br>
</div>
<blockquote type="cite"
cite="mid:414DEB15-FDC0-4BFA-9F5E-298658F436CF@crosswire.org">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Troy,
<div>In VerseKey::checkBounds()</div>
<div>
<div>void VerseKey::checkBounds() {</div>
<div><br>
</div>
<div> long i = getIndex();</div>
<div><br>
</div>
<div> initBounds();</div>
<div> if (i > upperBound) {</div>
<div> setIndex(upperBound);</div>
<div> i = getIndex();</div>
<div> error = KEYERR_OUTOFBOUNDS;</div>
<div> }</div>
<div> if (i < lowerBound) {</div>
<div> setIndex(lowerBound);</div>
<div> error = KEYERR_OUTOFBOUNDS;</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>i, upperBound and lowerBound are all -1, when working with
a chapter that is not in the book. This is good. The proc
getIndex() can’t compute the index since the chapter is not
known so it rightfully returns -1.</div>
<div><br>
</div>
<div>I think there should be a check in here like there is in
VerseKey.setIndex(int iindex).</div>
<div><br>
</div>
<div>So</div>
<div>
<div>void VerseKey::checkBounds() {</div>
<div><br>
</div>
<div> long i = getIndex();</div>
<div><br>
</div>
<div><b> // assert we're sane</b></div>
<div><b> if (i < 0) {</b></div>
<div><b> error = KEYERR_OUTOFBOUNDS;</b></div>
<div><b> return;</b></div>
<div><b> }</b></div>
</div>
<div><br>
</div>
<div>
<div> initBounds();</div>
<div> if (i > upperBound) {</div>
<div> setIndex(upperBound);</div>
<div> i = getIndex();</div>
<div> error = KEYERR_OUTOFBOUNDS;</div>
<div> }</div>
<div> if (i < lowerBound) {</div>
<div> setIndex(lowerBound);</div>
<div> error = KEYERR_OUTOFBOUNDS;</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>What do you think?</div>
<div><br>
</div>
<div>DM</div>
<div><br>
</div>
<blockquote type="cite">
<div>On Jun 15, 2025, at 8:11 AM, DM Smith
<a class="moz-txt-link-rfc2396E" href="mailto:dmsmith@crosswire.org"><dmsmith@crosswire.org></a> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div>Troy,<br>
<br>
I’ve narrowed it down to turning Auto Normalize off.<br>
<br>
In examples/cmdline/parseverselist.cpp, add
parser.setAutoNormalize(false) to see the error with
Gen.51.1. Note Gen.50.99 (last chapter with bad verse
number) works.<br>
<br>
DM<br>
<br>
<blockquote type="cite">On Jun 12, 2025, at 7:03 PM, DM
Smith <a class="moz-txt-link-rfc2396E" href="mailto:dmsmith@crosswire.org"><dmsmith@crosswire.org></a> wrote:<br>
<br>
Troy,<br>
<br>
I’m working on an infinite loop bug in osis2mod.<br>
<br>
I’ve narrowed it down to ListKey containing a verse
with a chapter which is beyond the end of a book.<br>
<br>
When this happens list.increment(1) never sets an
error.<br>
<br>
Simplest test case (bit incomplete):<br>
<br>
int i = 0;<br>
ListKey list = new ListKey();<br>
list.add(“Gen.51.1”);<br>
for (list = TOP; !list.popError(); list.increment(1))
{<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>if
(i++ > 5) break;<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>cout
<< i << list << endl;<br>
}<br>
<br>
If I change the verse reference to Gen.1.99 (valid
chapter, invalid verse), it works as expected.<br>
<br>
Can you figure out the problem?<br>
<br>
I’ve got a work around but I’d rather not do that.<br>
<br>
Thanks,<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>DM<br>
<br>
_______________________________________________<br>
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a><br>
<a class="moz-txt-link-freetext" href="http://crosswire.org/mailman/listinfo/sword-devel">http://crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at
above page<br>
</blockquote>
<br>
_______________________________________________<br>
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a><br>
<a class="moz-txt-link-freetext" href="http://crosswire.org/mailman/listinfo/sword-devel">http://crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at
above page<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre wrap="" class="moz-quote-pre">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://crosswire.org/mailman/listinfo/sword-devel">http://crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page
</pre>
</blockquote>
</body>
</html>