[sword-devel] Use of SWBuf for config paths
Scribe
sword-devel@crosswire.org
Fri, 5 Sep 2003 22:53:52 -0700 (MST)
Will,
Yeah, sorry bout that. Just poor code on my part. Using SWBuf is
a good and safe alternative. Don't remember if we ever set you up with
cvs access, but if not please email me privately and we take care of you.
Thanks for all the cool Mac stuff.
-Troy.
On Sat, 6 Sep 2003, Will Thimbleby wrote:
> Hi,
>
> I use modules in a funny way in MacSword, they can be placed anywhere
> on the disk. (Allows drag and drop installation and makes it easier for
> novices) And because of this I've run into problems in some of the
> sword lib code, namely that the library uses char[127] to store path
> names in the files listed below. My config paths exceed the 127 limit
> and MacSword crashes.
>
> treekeyidx.cpp
> rawstr.cpp
> rawstr4.cpp
> zstr.cpp
> zverse.cpp
>
> I reworked the code so that it used SWBuf instead.
>
> Changing
>
> > RawStr::RawStr(const char *ipath, int fileMode)
> > {
> > char buf[127];
> >
> > ...
> >
> > sprintf(buf, "%s.idx", path);
> > idxfd = FileMgr::systemFileMgr.open(buf, fileMode|O_BINARY, true);
>
> into:
>
> > RawStr::RawStr(const char *ipath, int fileMode)
> > {
> > SWBuf buf;
> >
> > ...
> >
> > buf = path;
> > buf += ".idx";
> > idxfd = FileMgr::systemFileMgr.open(buf, fileMode|O_BINARY, true);
>
> This fixes my problems, would it be possible if these changes could be
> incorporated into the sword library. If you are happy letting me do it
> my user name is willthimbleby.
>
> Also whilst I'm at it, it would be usefull if the augmentModules method
> for SWMgr could be made public (unless someone tells me I really
> shouldn't touch it).
>
> Cheers -Will
>
> _______________________________________________
> sword-devel mailing list
> sword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
>