c-jo / cpython

RISC OS port of the Python programming language
https://www.python.org/
Other
7 stars 3 forks source link

Fix RISC OS FS enumeration terminating early. #17

Closed gerph closed 3 years ago

gerph commented 3 years ago

When enumerating files through the OS_GBPB interface there may be multiple files returned in the final block of files returned by the OS_GBPB enumeration of the files. That is, the returned 'next context' may be -1 and the number of objects read be greater than 0.

In the words of the PRM: "R4 contains the value which should be used on the next call (to read more names), or -1 if there are no more names after the ones read by this call."

The enumerator was terminating when the context indicated there were no further entries, but there are still entries in its buffer to be returned.

This change replaces the single check on the context, with a check that the number of entries remaining in the internal buffer is 0 as well.