[sword-devel] sword changes and 1.5.8

Troy A. Griffitts sword-devel@crosswire.org
Fri, 06 Feb 2004 12:23:56 -0700


Ugh.  Sorry 'bout that.  Horrible code.  Right, now that we have SWBuf, 
we sould probably just do something like:

SWBuf buf;

buf = path;
buf += ".idx";
...

or

buf = "";
buf.appendFormatted("%s.idx", path);

the second looks more like the existing code, but the first is probably 
faster.

You're welcome to commit your changes.

If we're just storing a char *, which isn't to be manipulated (like path 
in the above code), we have a library of standard string functions. 
stdstr(&path, "value") will delete the pointer if it is not null, 
allocate the necessary space, then copy "value" to the string.  You can 
call stdstr to change the value of char * pointers all you'd like, but 
at the end of the day, you'll have to, eg.  delete [] path in your d-tor.

Hope that helps.  Thanks for tracking this down!

Oh, one more thing.  Per Daniel's discovery of static initialization 
ambiguities, we're planning to change access to our 3 major system 
statics to a common get/set interface:

systemFileMgr
systemLog
systemLocaleMgr

will all be like:

SWLog::setSystemLog(new MyMacintoshOSXDialogBoxSWLog());
SWLog::getSystemLog()->logError("You have not installed any books!");


currently you have to:

delete SWLog::systemLog;
SWLog::systemLog = new MyMacintoshOSXDialogBoxSWLog();
SWLog::systemLog->logError("You have not installed any books!");


Changing it to a property syntax with normal get/set names allows us to 
be sure the statics are ready to be used before they are accessed by the 
API client.

All this to say.  We hope to have a 1.5.8 release out shortly with these 
minory API changes, and it would be nice to have your new release work 
against it.  (shortly = likely, 1-2 weeks)

	-Troy.


William Thimbleby wrote:
> Right fixed Casey's bug now (I think). Some classes such as rawstr make 
> use of a short buffer for file paths. I've converted all the relevant 
> ones to SWBuf. Is this the best way to do this the rawgenbook makes use 
> of a char buffer it creates itself. A standard way of doing this is 
> probably a good idea, then it can be committed to CVS.
> 
> http://www.heathmoor.plus.com/downloads/MacSword0.4beta3.dmg
> 
> Christian: can you expand on your problems opening the book/chapter 
> pop-ups, I've never heard of this or seen any problems.
> 
> Cheers -Will
> 
> _______________________________________________
> sword-devel mailing list
> sword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel