desrod / pilot-link

pilot-link is a suite of tools used to connect your Palm or PalmOS® compatible handheld with Unix, Linux, and any other POSIX-compatible machine.
GNU General Public License v2.0
11 stars 7 forks source link

Type mismatch in pi-dlp.h #7

Open CoSoCo opened 2 years ago

CoSoCo commented 2 years ago

I already reported this problem erroneously on the JPilot project.

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

CoSoCo commented 2 years ago

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