Cleanup: remove redundant calls to strlen

This commit is contained in:
Campbell Barton
2024-04-25 12:02:12 +10:00
parent 9558aafafb
commit 29dd91815f
6 changed files with 7 additions and 7 deletions

View File

@@ -52,7 +52,7 @@ namespace blender::io::alembic {
/* Construct the depsgraph for exporting. */
static bool build_depsgraph(ExportJobData *job)
{
if (strlen(job->params.collection) > 0) {
if (job->params.collection[0]) {
Collection *collection = reinterpret_cast<Collection *>(
BKE_libblock_find_name(job->bmain, ID_GR, job->params.collection));
if (!collection) {

View File

@@ -36,7 +36,7 @@ void exporter_main(bContext *C, const PLYExportParams &export_params)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
if (strlen(export_params.collection) > 0) {
if (export_params.collection[0]) {
Collection *collection = reinterpret_cast<Collection *>(
BKE_libblock_find_name(bmain, ID_GR, export_params.collection));
if (!collection) {

View File

@@ -142,7 +142,7 @@ void exporter_main(bContext *C, const STLExportParams &export_params)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
if (strlen(export_params.collection) > 0) {
if (export_params.collection[0]) {
Collection *collection = reinterpret_cast<Collection *>(
BKE_libblock_find_name(bmain, ID_GR, export_params.collection));
if (!collection) {

View File

@@ -485,7 +485,7 @@ bool USD_export(bContext *C,
*
* Has to be done from main thread currently, as it may affect Main original data (e.g. when
* doing deferred update of the view-layers, see #112534 for details). */
if (strlen(job->params.collection) > 0) {
if (job->params.collection[0]) {
Collection *collection = reinterpret_cast<Collection *>(
BKE_libblock_find_name(job->bmain, ID_GR, job->params.collection));
if (!collection) {

View File

@@ -599,7 +599,7 @@ static void export_in_memory_texture(Image *ima,
char image_abs_path[FILE_MAX];
char file_name[FILE_MAX];
if (strlen(ima->filepath) > 0) {
if (ima->filepath[0]) {
get_absolute_path(ima, image_abs_path);
BLI_path_split_file_part(image_abs_path, file_name, FILE_MAX);
}
@@ -845,7 +845,7 @@ static std::string get_tex_image_asset_filepath(const USDExporterContext &usd_ex
std::string path;
if (strlen(ima->filepath) > 0) {
if (ima->filepath[0]) {
/* Get absolute path. */
path = get_tex_image_asset_filepath(ima);
}

View File

@@ -332,7 +332,7 @@ void exporter_main(bContext *C, const OBJExportParams &export_params)
ed::object::mode_set(C, OB_MODE_OBJECT);
Collection *collection = nullptr;
if (strlen(export_params.collection) > 0) {
if (export_params.collection[0]) {
Main *bmain = CTX_data_main(C);
collection = reinterpret_cast<Collection *>(
BKE_libblock_find_name(bmain, ID_GR, export_params.collection));