jpilot icon indicating copy to clipboard operation
jpilot copied to clipboard

Wrong iterator value returned from `dlp_VFSDirEntryEnumerate`

Open CoSoCo opened this issue 3 years ago • 2 comments

The description of dlp_VFSDirEntryEnumerate says:

  • Supported on Palm OS 4.0 and later. At the beginning you set
  • @p dirIterator to #vfsIteratorStart, then call this function
  • repeatedly until it returns an error code or the iterator becomes
  • #vfsIteratorStop

This does not work. After the first invocation diriterator becomes always vfsIteratorStop, even if there are more than diritems files in the directory. In rare cases, diriterator even becomes 1888 when enumerating few items from the SDCard volume.

Please see my small plugin code in the attachment !

picsnvideos.c.zip

From the while loop in function backupMedia() I get only 4 of 9 file entries:

  Opened root '/Photos & Videos' on volume 1
  Enumerate root '/Photos & Videos', dirRef=682033264, itr=0, dirItems=4
  Enumerate OK: bytes=196, dirRef=682033264, itr=-1, dirItems=4
  Now search for albums to fetch ...
   Found album candidate 'AllAlbum.db'
   Found album candidate 'CollectData.db'
   Found album candidate 'Foto_120820_001.jpg'
   Found album candidate '#Thumbnail'

From the for loop as a workaround in function fetchAlbum() all 9 files are found:

   Fetching album 'Unfiled' in '/Photos & Videos' on volume 1 ...
    Enumerate album '/Photos & Videos', dirRef=681640048, itr=0, dirItems=4
    Enumerate OK: bytes=196, dirRef=681640048, itr=-1, dirItems=4
    Enumerate album '/Photos & Videos', dirRef=681640048, itr=0, dirItems=8
    Enumerate OK: bytes=196, dirRef=681640048, itr=-1, dirItems=8
    Enumerate album '/Photos & Videos', dirRef=681640048, itr=0, dirItems=16
    Enumerate OK: bytes=196, dirRef=681640048, itr=-1, dirItems=9
    Now search of 9 files, which to fetch ...
     Found file 'AllAlbum.db' attribute 20
     Found file 'CollectData.db' attribute 20
     Found file 'Foto_120820_001.jpg' attribute 20
     File '/home/ich/PalmPictures/Device/Unfiled/Foto_120820_001.jpg' already exists, not copying it
     Found file '#Thumbnail' attribute 10
     Found file 'Foto_060321_001.jpg' attribute 20
     File '/home/ich/PalmPictures/Device/Unfiled/Foto_060321_001.jpg' already exists, not copying it
     Found file 'Album.db' attribute 20
     Found file 'Foto_060321_002.jpg' attribute 20
     File '/home/ich/PalmPictures/Device/Unfiled/Foto_060321_002.jpg' already exists, not copying it
     Found file 'Foto_091621_001.jpg' attribute 20
     File '/home/ich/PalmPictures/Device/Unfiled/Foto_091621_001.jpg' already exists, not copying it
     Found file 'Video_080822_001.3gp' attribute 20
     Fetching /home/ich/PalmPictures/Device/Unfiled/Video_080822_001.3gp ...

From enummeration on SDCard volume I even get 1888 for itr:

   Fetching album '137DSCIM' in '/DCIM' on volume 2 ...
    Enumerate album '/DCIM/137DSCIM', dirRef=682229880, itr=0, dirItems=4
    Enumerate OK: bytes=1034, dirRef=682229880, itr=1888, dirItems=4
    Enumerate album '/DCIM/137DSCIM', dirRef=682229880, itr=0, dirItems=8
    Enumerate OK: bytes=1466, dirRef=682229880, itr=-1, dirItems=8
    Enumerate album '/DCIM/137DSCIM', dirRef=682229880, itr=0, dirItems=16
    Enumerate OK: bytes=1466, dirRef=682229880, itr=-1, dirItems=16
    Enumerate album '/DCIM/137DSCIM', dirRef=682229880, itr=0, dirItems=32
    Enumerate OK: bytes=1466, dirRef=682229880, itr=-1, dirItems=32
    Enumerate album '/DCIM/137DSCIM', dirRef=682229880, itr=0, dirItems=64
    Enumerate OK: bytes=1466, dirRef=682229880, itr=-1, dirItems=64
    Enumerate album '/DCIM/137DSCIM', dirRef=682229880, itr=0, dirItems=128
    Enumerate OK: bytes=1466, dirRef=682229880, itr=-1, dirItems=81
    Now search of 81 files, which to fetch ...
     Found file 'BILD2172.JPG' attribute 0
     File '/home/ich/PalmPictures/SDCard/137DSCIM/BILD2172.JPG' already exists, not copying it
     Found file 'CLIP2173.AVI' attribute 0
     Found file 'CLIP2174.AVI' attribute 0
     Found file 'CLIP2175.AVI' attribute 0
     Found file 'BILD2176.JPG' attribute 0
     File '/home/ich/PalmPictures/SDCard/137DSCIM/BILD2176.JPG' already exists, not copying it
     [.....]

CoSoCo avatar Aug 08 '22 18:08 CoSoCo

Is there anyway you can commit a PR for this? I don't have a working Palm to test this with.

juddmon avatar Dec 12 '22 02:12 juddmon

Is there anyway you can commit a PR for this? I don't have a working Palm to test this with.

I plan to develop some patches to fix this and other bugs in libpisock / pilot-link, and then to clean-up my workarounds in JPilotMediaPlugin ... some day ;-)

CoSoCo avatar Dec 14 '22 23:12 CoSoCo