Because result is defined as unsigned, it will never be negative. So the code after if (result > 0) becomes always executed, even on negative error result from dlp_exec (sd, req, &res). So result should be defined signed int. Compare with similar function dlp_VFSVolumeEnumerate().
Additionally, the else part of the later if (result) will never be reached, as result will always be non-zero at this branch.
int
dlp_VFSDirEntryEnumerate(int sd, FileRef dirRefNum,
unsigned long *dirIterator, int *maxDirItems, struct VFSDirInfo *data)
{
unsigned int result,
[.....]
result = dlp_exec (sd, req, &res);
[.....]
if (result > 0) {
if (result) {
*dirIterator = get_long (DLP_RESPONSE_DATA (res, 0, 0));
entries = get_long (DLP_RESPONSE_DATA (res, 0, 4));
} else {
*dirIterator = vfsIteratorStop;
entries = 0;
}
[.....]
Because
result
is defined asunsigned
, it will never be negative. So the code afterif (result > 0)
becomes always executed, even on negative error result fromdlp_exec (sd, req, &res)
. Soresult
should be definedsigned int
. Compare with similar functiondlp_VFSVolumeEnumerate()
.Additionally, the
else
part of the laterif (result)
will never be reached, asresult
will always be non-zero at this branch.