[Tellico] Export to PilotDB broken?
Jens Seidel
jensseidel at users.sf.net
Wed Feb 21 01:59:56 MST 2007
On Tue, Feb 20, 2007 at 06:40:00PM -0800, Robby Stephenson wrote:
> On Tuesday 20 February 2007, Jens Seidel wrote:
> > The following patch fixes it but I'm not sure whether it caused any
> > problem except reading bogus data which is probably ignored:
> >
> > - memcpy(buf, name().c_str(), 32);
> > + for (int i=0; i<32; ++i)
> > + buf[i] = 0;
> > + memcpy(buf, name().c_str(), std::min(32-1,
> > static_cast<int>(name().length()))); set_short(buf + 32, flags());
Without conversion the template based min() does not work (int vs.
unsigned int) but now I see that std::min(31U, name().length()) is
much easier.
> > set_short(buf + 34, version());
> > set_long(buf + 36, creation_time());
> >
> > (I'm not sure whether the beginning of buf needs to be a null terminated
> > character string, that's why I subtract 1 to ensure it.)
>
> Most of the code in the PilotDB wrapper is taken from the pilotdb source
> itself, so I'm not very familiar with it. I replaced some of the buffers
> with QBuffer, etc, which is about all.
>
> Your quick patch looks fine, thanks for taking such a detailed look. Do you
> have a Palm to test it against?
No, I don't have a Palm (but two nice Mips workstations which are maybe
useful for tests too :-). Please note that the bug occurred in tellico
while writing to a file, so it should be independant of such a device!?
Nevertheless it is unlikely that it produced an out of memory error. A
normal segmentation fault is more likely for a bug of this kind.
Jens
More information about the tellico-users
mailing list