[libbluray-devel] _scan_dir(): separate error indication from result
Petri Hintukainen
git at videolan.org
Sat Jun 24 14:41:48 CEST 2017
libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Thu Jun 22 16:20:04 2017 +0300| [6e987195a021da5770532401f28f459962bac77f] | committer: Petri Hintukainen
_scan_dir(): separate error indication from result
> http://git.videolan.org/gitweb.cgi/libudfread.git/?a=commit;h=6e987195a021da5770532401f28f459962bac77f
---
src/udfread.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/udfread.c b/src/udfread.c
index 0cfdac2..ce51e1d 100644
--- a/src/udfread.c
+++ b/src/udfread.c
@@ -1086,13 +1086,14 @@ static struct udf_dir *_read_subdir(udfread *udf, struct udf_dir *dir, uint32_t
return dir->subdirs[index];
}
-static int _scan_dir(const struct udf_dir *dir, const char *filename)
+static int _scan_dir(const struct udf_dir *dir, const char *filename, uint32_t *index)
{
uint32_t i;
for (i = 0; i < dir->num_entries; i++) {
if (!strcmp(filename, dir->files[i].filename)) {
- return i;
+ *index = i;
+ return 0;
}
}
@@ -1124,9 +1125,8 @@ static int _find_file(udfread *udf, const char *path,
}
while (token) {
-
- int index = _scan_dir(current_dir, token);
- if (index < 0) {
+ uint32_t index;
+ if (_scan_dir(current_dir, token, &index) < 0) {
udf_log("_find_file: entry %s not found\n", token);
goto error;
}
More information about the libbluray-devel
mailing list