pilot-link icon indicating copy to clipboard operation
pilot-link copied to clipboard

Type mismatch in pi-dlp.h

Open CoSoCo opened this issue 3 years ago • 1 comments

I already reported this problem erroneously on the JPilot project.

Please see https://github.com/juddmon/jpilot/issues/39 for the details.

CoSoCo avatar Jul 29 '22 12:07 CoSoCo

This bug lead to a complicated question here: https://stackoverflow.com/questions/73210048/how-can-a-function-change-the-original-variable-when-it-is-passed-as-value-argu/73266886#73266886

It appears, that the value retrieved from dlp_exec (sd, req, &res) in dlp.c is only 32 bit, so we can use unsigned int for diriterator. Because emum dlpVFSFileIteratorConstants are of type int, user should use casts like:

unsigned itr = (unsigned)vfsIteratorStart;
while ((emum dlpVFSFileIteratorConstants)itr != vfsIteratorStop) {
    PI_ERR result = dlp_VFSDirEntryEnumerate(sd, dirRef, &itr, &maxItems, &dirItems)
    [.....]

So here is a patch to solve the problem: 0003-Fix-type-mismatch-of-iterator-in-dlp_VFSDirEntryEnum.patch.zip

CoSoCo avatar Aug 15 '22 20:08 CoSoCo