dbUtils/directory: traverseAllIn forEachSong returns -1 on error
Being consistent with most UNIX functions...
This commit is contained in:
parent
45334a23e1
commit
8be6026336
|
@ -83,7 +83,7 @@ static int searchInDirectory(Song * song, void *_data)
|
|||
LocateTagItemArray *array = &data->array;
|
||||
|
||||
if (strstrSearchTags(song, array->numItems, array->items))
|
||||
song_print_info(data->client, song);
|
||||
return song_print_info(data->client, song);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ static int findInDirectory(Song * song, void *_data)
|
|||
LocateTagItemArray *array = &data->array;
|
||||
|
||||
if (tagItemsFoundAndMatches(song, array->numItems, array->items))
|
||||
song_print_info(data->client, song);
|
||||
return song_print_info(data->client, song);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -974,14 +974,11 @@ static int traverseAllInSubDirectory(Directory * directory,
|
|||
void *data)
|
||||
{
|
||||
struct dirvec *dv = &directory->children;
|
||||
int errFlag = 0;
|
||||
int err = 0;
|
||||
size_t j;
|
||||
|
||||
if (forEachDir) {
|
||||
errFlag = forEachDir(directory, data);
|
||||
if (errFlag)
|
||||
return errFlag;
|
||||
}
|
||||
if (forEachDir && (err = forEachDir(directory, data)) < 0)
|
||||
return err;
|
||||
|
||||
if (forEachSong) {
|
||||
int i;
|
||||
|
@ -990,16 +987,16 @@ static int traverseAllInSubDirectory(Directory * directory,
|
|||
|
||||
for (i = sv->nr; --i >= 0; ) {
|
||||
Song *song = *sp++;
|
||||
if ((errFlag = forEachSong(song, data)))
|
||||
return errFlag;
|
||||
if ((err = forEachSong(song, data)) < 0)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; !errFlag && j < dv->nr; ++j)
|
||||
errFlag = traverseAllInSubDirectory(dv->base[j], forEachSong,
|
||||
forEachDir, data);
|
||||
for (j = 0; err >= 0 && j < dv->nr; ++j)
|
||||
err = traverseAllInSubDirectory(dv->base[j], forEachSong,
|
||||
forEachDir, data);
|
||||
|
||||
return errFlag;
|
||||
return err;
|
||||
}
|
||||
|
||||
int traverseAllIn(const char *name,
|
||||
|
|
Loading…
Reference in New Issue