Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-23 08:24:20 +0300
committerCampbell Barton <campbell@blender.org>2022-09-23 08:29:21 +0300
commitfbd78a8d78f460d1ae2972538139ac1602c012f6 (patch)
tree137e77868514388454cd597380db44d285005f39 /source/blender/io/wavefront_obj/importer
parentc655bdfa3156f612b01b55b4c6e24d89fad4c748 (diff)
Cleanup: use ELEM macro
Diffstat (limited to 'source/blender/io/wavefront_obj/importer')
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc2
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_mtl.cc2
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_string_utils.cc4
3 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index f92f9894f75..efa6473b494 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -103,7 +103,7 @@ static void geom_add_mrgb_colors(const char *p, const char *end, GlobalVertices
while (p + mrgb_length <= end) {
uint32_t value = 0;
std::from_chars_result res = std::from_chars(p, p + mrgb_length, value, 16);
- if (res.ec == std::errc::invalid_argument || res.ec == std::errc::result_out_of_range) {
+ if (ELEM(res.ec, std::errc::invalid_argument, std::errc::result_out_of_range)) {
return;
}
unsigned char srgb[4];
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
index c471b2002de..439a5fa8f05 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
@@ -123,7 +123,7 @@ static Image *load_texture_image(Main *bmain, const MTLTexMap &tex_map, bool rel
/* Try replacing underscores with spaces. */
std::string no_underscore_path{no_quote_path};
std::replace(no_underscore_path.begin(), no_underscore_path.end(), '_', ' ');
- if (no_underscore_path != no_quote_path && no_underscore_path != tex_path) {
+ if (!ELEM(no_underscore_path, no_quote_path, tex_path)) {
image = load_image_at_path(bmain, no_underscore_path, relative_paths);
if (image != nullptr) {
return image;
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_string_utils.cc b/source/blender/io/wavefront_obj/importer/obj_import_string_utils.cc
index 7e282b164b0..a69b4206db6 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_string_utils.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_string_utils.cc
@@ -94,7 +94,7 @@ const char *parse_float(const char *p,
}
p = drop_plus(p, end);
fast_float::from_chars_result res = fast_float::from_chars(p, end, dst);
- if (res.ec == std::errc::invalid_argument || res.ec == std::errc::result_out_of_range) {
+ if (ELEM(res.ec, std::errc::invalid_argument, std::errc::result_out_of_range)) {
dst = fallback;
}
else if (require_trailing_space && res.ptr < end && !is_whitespace(*res.ptr)) {
@@ -125,7 +125,7 @@ const char *parse_int(const char *p, const char *end, int fallback, int &dst, bo
}
p = drop_plus(p, end);
std::from_chars_result res = std::from_chars(p, end, dst);
- if (res.ec == std::errc::invalid_argument || res.ec == std::errc::result_out_of_range) {
+ if (ELEM(res.ec, std::errc::invalid_argument, std::errc::result_out_of_range)) {
dst = fallback;
}
return res.ptr;