jpilot
jpilot copied to clipboard
type mismatch in pi-dlp.h
The iterator constants are defined as signed int via enum (line 538):
/** @brief VFS file iterator constants */
enum dlpVFSFileIteratorConstants {
vfsIteratorStart = 0, /** < Indicates that iterator is beginning */
vfsIteratorStop = -1 /**< Indicate that iterator has gone through all items */
};
But the iterator function requires an unsigned long diriterator parameter (line 1596):
extern PI_ERR dlp_VFSDirEntryEnumerate
PI_ARGS((int sd, FileRef dirref, unsigned long *diriterator, int *maxitems, struct VFSDirInfo *diritems));
This causes an endless loop when using it straight forward (seen in Pics&Videos Plugin) like:
unsigned long dirIterator = vfsIteratorStart;
while (dirIterator != vfsIteratorStop) {
dlp_VFSDirEntryEnumerate(sd, dirRef, &dirIterator, &maxDirItems, dirInfo);
[.....]
}
Anyway, there is a workaround, but it's not smart:
unsigned long dirIterator = (unsigned long)vfsIteratorStart;
while ((enum dlpVFSFileIteratorConstants)dirIterator != vfsIteratorStop) {
dlp_VFSDirEntryEnumerate(sd, dirRef, &dirIterator, &maxDirItems, dirInfo);
[.....]
}
I've found a solution and provided a patch, see here: https://github.com/desrod/pilot-link/issues/7#issuecomment-1215743346