[sword-devel] breakage in verse management at -r2785?

Karl Kleinpaste karl at kleinpaste.org
Mon Mar 11 17:31:05 MST 2013


Regrets for not following up until this evening; I can send mail here
only from home, being firewalled at the office these days.

"Troy A. Griffitts" <scribe at crosswire.org> writes:
> Do you have an idea of how you are using versekey? 
> When you display a chapter, are you iterating on the key or on the module? 

The essential code is:

    VerseKey *key = (VerseKey *)(SWKey *)imodule;
    int curVerse = key->getVerse();
    int curChapter = key->getChapter();
    int curBook = key->getBook();

    for (key->setVerse(1);
	 (key->getBook()    == curBook)    &&
	 (key->getChapter() == curChapter) &&
	 !imodule.popError();
	 imodule++) {
	 /* ... lots of hacking based on current key ... */
    }

I've been wondering literally for years why key is typecast twice, from
module through SWKey to VerseKey, but this code predates my presence and
there's actually quite a lot that I've learned to accept somewhat
uncritically.  If there is a better way to loop through this, by all
means re-educate me.

--karl



More information about the sword-devel mailing list