Cleanup: various non-functional changes

- Use brief `uint` type name.
- Remove unnecessary "struct".
- Remove duplicate variable declaration.
- Pass arguments by const reference instead of value.
- Use const argument.
This commit is contained in:
Campbell Barton
2024-06-11 20:45:00 +10:00
parent a5d5979fb6
commit bdbd6598ad
12 changed files with 13 additions and 16 deletions

View File

@@ -1141,7 +1141,7 @@ CombinedKeyingResult insert_key_rna(PointerRNA *rna_pointer,
ListBase nla_cache = {nullptr, nullptr};
NlaKeyframingContext *nla_context = nullptr;
if (adt && adt->action == action) {
if (adt->action == action) {
PointerRNA id_pointer = RNA_id_pointer_create(id);
nla_context = BKE_animsys_get_nla_keyframing_context(
&nla_cache, &id_pointer, adt, &anim_eval_context);

View File

@@ -3906,9 +3906,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 31)) {
bool only_uses_eevee_legacy_or_workbench = true;
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
if (!(STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE) ||
STREQ(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH)))
{
if (!STR_ELEM(scene->r.engine, RE_engine_id_BLENDER_EEVEE, RE_engine_id_BLENDER_WORKBENCH)) {
only_uses_eevee_legacy_or_workbench = false;
}
}

View File

@@ -110,7 +110,7 @@ class AbstractView {
std::optional<rcti> get_bounds() const;
std::string get_context_menu_title() const;
void set_context_menu_title(std::string title);
void set_context_menu_title(const std::string &title);
protected:
AbstractView() = default;

View File

@@ -159,7 +159,7 @@ std::string AbstractView::get_context_menu_title() const
return context_menu_title;
}
void AbstractView::set_context_menu_title(std::string title)
void AbstractView::set_context_menu_title(const std::string &title)
{
context_menu_title = title;
}

View File

@@ -848,7 +848,7 @@ bool ED_sequencer_handle_is_selected(const Sequence *seq, eSeqHandle handle)
((handle == SEQ_HANDLE_RIGHT) && (seq->flag & SEQ_RIGHTSEL));
}
static bool element_already_selected(const StripSelection selection)
static bool element_already_selected(const StripSelection &selection)
{
if (selection.seq1 == nullptr) {
return false;

View File

@@ -683,7 +683,7 @@ static void sequencer_main_cursor(wmWindow *win, ScrArea *area, ARegion *region)
const Scene *scene = win->scene;
const Editing *ed = SEQ_editing_get(scene);
if (ed == NULL) {
if (ed == nullptr) {
WM_cursor_set(win, wmcursor);
return;
}

View File

@@ -331,7 +331,6 @@ static int transform_seq_slide_cursor_get(TransInfo *t)
return WM_CURSOR_NSEW_SCROLL;
}
const Scene *scene = t->scene;
if (SEQ_time_right_handle_frame_get(scene, seq1) !=
SEQ_time_left_handle_frame_get(scene, seq2))
{

View File

@@ -91,7 +91,7 @@ ImBuf *IMB_thumb_load_blend(const char *blen_path, const char *blen_group, const
ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned int y);
bool IMB_thumb_load_font_get_hash(char *r_hash);
ImBuf *IMB_font_preview(const char *filename, unsigned int width, float color[4]);
ImBuf *IMB_font_preview(const char *filename, unsigned int width, const float color[4]);
/* Threading */

View File

@@ -46,7 +46,7 @@ bool IMB_thumb_load_font_get_hash(char *r_hash)
return true;
}
ImBuf *IMB_font_preview(const char *filename, unsigned int width, float color[4])
ImBuf *IMB_font_preview(const char *filename, uint width, const float color[4])
{
int font_id = (filename[0] != '<') ? BLF_load(filename) : 0;
const char sample[] = "ABCDEFGH\nabcdefg123";

View File

@@ -206,12 +206,12 @@ static void process_usdz_textures(const ExportJobData *data, const char *path)
enum_value));
char texture_path[FILE_MAX];
BLI_strncpy(texture_path, path, FILE_MAX);
STRNCPY(texture_path, path);
BLI_path_append(texture_path, FILE_MAX, "textures");
BLI_path_slash_ensure(texture_path, sizeof(texture_path));
struct direntry *entries;
unsigned int num_files = BLI_filelist_dir_contents(texture_path, &entries);
direntry *entries;
uint num_files = BLI_filelist_dir_contents(texture_path, &entries);
for (int index = 0; index < num_files; index++) {
/* We can skip checking extensions as this folder is only created

View File

@@ -766,7 +766,7 @@ NodeItem NodeItem::create_node(const std::string &category, Type type) const
NodeItem res = empty();
/* Surface-shader nodes and materials are added directly to the document,
* otherwise to the node-graph. */
if (type == Type::SurfaceShader || type == Type::Material) {
if (ELEM(type, Type::SurfaceShader, Type::Material)) {
res.node = graph_->getDocument()->addNode(category, MaterialX::EMPTY_STRING, type_str);
}
else {

View File

@@ -331,7 +331,7 @@ int main(int argc,
#endif /* WIN32 */
#if defined(WITH_OPENGL_BACKEND) && defined(BLI_SUBPROCESS_SUPPORT)
if (strcmp(argv[0], "--compilation-subprocess") == 0) {
if (STREQ(argv[0], "--compilation-subprocess")) {
BLI_assert(argc == 2);
GPU_compilation_subprocess_run(argv[1]);
return 0;