diff options
author | Hans Goudey <h.goudey@me.com> | 2022-02-13 22:15:53 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-13 22:15:53 +0300 |
commit | 7d5f6c330f1065f28d8e83eea41b151245b39bed (patch) | |
tree | e39c6c0a01463de2c0f9035869ab540701d675b4 /source/blender | |
parent | 7413c2feede68c45f13fa37ebdcbf325d8f32c10 (diff) |
Cleanup: Clang tidy
Use using instead of typedef, remove redundant string init,
use "empty", address qualified auto, use nullptr.
Diffstat (limited to 'source/blender')
5 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_gpencil.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_gpencil.cc index 6986ef7d9ee..c5def69a70f 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_gpencil.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_gpencil.cc @@ -35,7 +35,7 @@ void GPencilBackup::restore_to_gpencil(bGPdata *gpd) } /* Doing a copy-on-write copies the update cache pointer. Make sure to reset it * to NULL as we should never use the update cache from eval data. */ - gpd->runtime.update_cache = NULL; + gpd->runtime.update_cache = nullptr; /* Make sure to update the original runtime pointers in the eval data. */ BKE_gpencil_data_update_orig_pointers(gpd_orig, gpd); } diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc index 9d30ebca6d6..a355487057c 100644 --- a/source/blender/editors/space_node/node_select.cc +++ b/source/blender/editors/space_node/node_select.cc @@ -730,7 +730,7 @@ static int node_box_select_exec(bContext *C, wmOperator *op) /* Frame nodes are selectable by their borders (including their whole rect - as for other * nodes - would prevent selection of other nodes inside that frame. */ const rctf frame_inside = node_frame_rect_inside(*node); - if (BLI_rctf_isect(&rectf, &node->totr, NULL) && + if (BLI_rctf_isect(&rectf, &node->totr, nullptr) && !BLI_rctf_inside_rctf(&frame_inside, &rectf)) { nodeSetSelected(node, select); is_inside = true; @@ -932,7 +932,7 @@ static bool do_lasso_select_node(bContext *C, BLI_rctf_rcti_copy(&rectf, &rect); UI_view2d_region_to_view_rctf(®ion->v2d, &rectf, &rectf); const rctf frame_inside = node_frame_rect_inside(*node); - if (BLI_rctf_isect(&rectf, &node->totr, NULL) && + if (BLI_rctf_isect(&rectf, &node->totr, nullptr) && !BLI_rctf_inside_rctf(&frame_inside, &rectf)) { nodeSetSelected(node, select); changed = true; diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index f6b1f5184bd..31f657a63b2 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -499,7 +499,7 @@ static std::string main_function_wrapper(std::string &pre_main, std::string &pos std::string GLShader::vertex_interface_declare(const ShaderCreateInfo &info) const { std::stringstream ss; - std::string post_main = ""; + std::string post_main; ss << "\n/* Inputs. */\n"; for (const ShaderCreateInfo::VertIn &attr : info.vertex_inputs_) { @@ -532,7 +532,7 @@ std::string GLShader::vertex_interface_declare(const ShaderCreateInfo &info) con ss << "\n"; if (post_main.empty() == false) { - std::string pre_main = ""; + std::string pre_main; ss << main_function_wrapper(pre_main, post_main); } return ss.str(); @@ -541,7 +541,7 @@ std::string GLShader::vertex_interface_declare(const ShaderCreateInfo &info) con std::string GLShader::fragment_interface_declare(const ShaderCreateInfo &info) const { std::stringstream ss; - std::string pre_main = ""; + std::string pre_main; ss << "\n/* Interfaces. */\n"; const Vector<StageInterfaceInfo *> &in_interfaces = (info.geometry_source_.is_empty()) ? @@ -595,7 +595,7 @@ std::string GLShader::fragment_interface_declare(const ShaderCreateInfo &info) c ss << "\n"; if (pre_main.empty() == false) { - std::string post_main = ""; + std::string post_main; ss << main_function_wrapper(pre_main, post_main); } return ss.str(); @@ -715,7 +715,7 @@ std::string GLShader::workaround_geometry_shader_source_create( ss << " gl_Layer = gpu_Layer[0];\n"; } for (auto i : IndexRange(3)) { - for (auto iface : info_modified.vertex_out_interfaces_) { + for (StageInterfaceInfo *iface : info_modified.vertex_out_interfaces_) { for (auto &inout : iface->inouts) { ss << " " << iface->instance_name << "_out." << inout.name; ss << " = " << iface->instance_name << "_in[" << i << "]." << inout.name << ";\n"; diff --git a/source/blender/io/alembic/intern/abc_reader_archive.cc b/source/blender/io/alembic/intern/abc_reader_archive.cc index 73ed7a80e52..f826da0daa4 100644 --- a/source/blender/io/alembic/intern/abc_reader_archive.cc +++ b/source/blender/io/alembic/intern/abc_reader_archive.cc @@ -67,7 +67,7 @@ ArchiveReader *ArchiveReader::get(struct Main *bmain, const std::vector<const ch std::vector<ArchiveReader *> readers; for (const char *filename : filenames) { - auto reader = new ArchiveReader(bmain, filename); + ArchiveReader *reader = new ArchiveReader(bmain, filename); if (!reader->valid()) { delete reader; @@ -77,7 +77,7 @@ ArchiveReader *ArchiveReader::get(struct Main *bmain, const std::vector<const ch readers.push_back(reader); } - if (readers.size() == 0) { + if (readers.empty()) { return nullptr; } @@ -92,7 +92,7 @@ ArchiveReader::ArchiveReader(const std::vector<ArchiveReader *> &readers) : m_re { Alembic::AbcCoreLayer::ArchiveReaderPtrs archives; - for (auto &reader : readers) { + for (ArchiveReader *reader : readers) { archives.push_back(reader->m_archive.getPtr()); } diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc index 6cdf6cc3b19..09cb0d07493 100644 --- a/source/blender/io/usd/intern/usd_writer_material.cc +++ b/source/blender/io/usd/intern/usd_writer_material.cc @@ -82,7 +82,7 @@ struct InputSpec { }; /* Map Blender socket names to USD Preview Surface InputSpec structs. */ -typedef std::map<std::string, InputSpec> InputSpecMap; +using InputSpecMap = std::map<std::string, InputSpec>; /* Static function forward declarations. */ static pxr::UsdShadeShader create_usd_preview_shader(const USDExporterContext &usd_export_context, |