commit 95e7507b0916f2f766e1440940075cad220b7e6a
parent b7d0735ed259172ff68294677d99f54cc0b839f2
Author: vaplv <vaplv@free.fr>
Date: Thu, 25 Sep 2014 12:22:10 +0200
Return R_IO_ERR rather than R_BAD_ARG if the loaded file cannot be opened
Diffstat:
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/aw_mtl.c b/src/aw_mtl.c
@@ -603,7 +603,7 @@ aw_mtl_load(struct aw_mtl* mtl, const char* filename)
file = fopen(filename, "r");
if(!file) {
logger_print(mtl->logger, LOG_ERROR, "Error opening `%s'\n", filename);
- return R_BAD_ARG;
+ return R_IO_ERR;
}
res = aw_mtl_load_stream(mtl, file);
diff --git a/src/aw_obj.c b/src/aw_obj.c
@@ -575,7 +575,7 @@ aw_obj_load(struct aw_obj* obj, const char* filename)
file = fopen(filename, "r");
if(!file) {
logger_print(obj->logger, LOG_ERROR, "Error opening `%s'\n", filename);
- return R_BAD_ARG;
+ return R_IO_ERR;
}
res = aw_obj_load_stream(obj, file);
diff --git a/src/test_aw_mtl.c b/src/test_aw_mtl.c
@@ -62,6 +62,7 @@ test_common(struct aw_mtl* mtl)
CHECK(aw_mtl_load(NULL, NULL), R_BAD_ARG);
CHECK(aw_mtl_load(mtl, NULL), R_BAD_ARG);
CHECK(aw_mtl_load(NULL, "test_mtl_common.mtl"), R_BAD_ARG);
+ CHECK(aw_mtl_load(mtl, "none.mtl"), R_IO_ERR);
CHECK(aw_mtl_load(mtl, "test_mtl_common.mtl"), R_OK);
CHECK(aw_mtl_materials_count_get(NULL, NULL), R_BAD_ARG);
diff --git a/src/test_aw_obj.c b/src/test_aw_obj.c
@@ -59,7 +59,7 @@ test_plane(struct aw_obj* obj)
CHECK(aw_obj_load(NULL, NULL), R_BAD_ARG);
CHECK(aw_obj_load(obj, NULL), R_BAD_ARG);
CHECK(aw_obj_load(NULL, "test_obj_plane.obj"), R_BAD_ARG);
- CHECK(aw_obj_load(obj, "none.obj"), R_BAD_ARG);
+ CHECK(aw_obj_load(obj, "none.obj"), R_IO_ERR);
CHECK(aw_obj_load(obj, "test_obj_plane.obj"), R_OK);
CHECK(aw_obj_desc_get(NULL, NULL), R_BAD_ARG);