Cleanup: various non-functional changes for C++

This commit is contained in:
Campbell Barton 2024-02-21 10:33:56 +11:00
parent b0fb693e1b
commit b6b00b61cb
4 changed files with 10 additions and 10 deletions

View File

@ -538,7 +538,7 @@ void layer_adjustments_to_modifiers(Main &bmain,
STRNCPY(tmd->influence.layer_name, gpl->info);
char modifier_name[64];
BLI_snprintf(modifier_name, 64, "Tint %s", gpl->info);
SNPRINTF(modifier_name, "Tint %s", gpl->info);
STRNCPY(md->name, modifier_name);
BKE_modifier_unique_name(&dst_object.modifiers, md);
@ -558,7 +558,7 @@ void layer_adjustments_to_modifiers(Main &bmain,
auto *md = reinterpret_cast<NodesModifierData *>(BKE_modifier_new(eModifierType_Nodes));
char modifier_name[64];
BLI_snprintf(modifier_name, 64, "Thickness %s", gpl->info);
SNPRINTF(modifier_name, "Thickness %s", gpl->info);
STRNCPY(md->modifier.name, modifier_name);
BKE_modifier_unique_name(&dst_object.modifiers, &md->modifier);
md->node_group = offset_radius_node_tree;

View File

@ -596,7 +596,7 @@ void GPU_shader_constant_bool_ex(GPUShader *sh, int location, bool value)
Shader &shader = *unwrap(sh);
BLI_assert(shader.constants.types[location] == gpu::shader::Type::BOOL);
shader.constants.is_dirty |= assign_if_different(shader.constants.values[location].u,
static_cast<uint32_t>(value));
uint32_t(value));
}
void GPU_shader_constant_int(GPUShader *sh, const char *name, int value)

View File

@ -356,5 +356,5 @@ ImbAnimType imb_get_anim_type(const char *filepath)
bool IMB_isanim(const char *filepath)
{
ImbAnimType type = imb_get_anim_type(filepath);
return (type != ImbAnimType::NotAnim && type != ImbAnimType::Sequence);
return !ELEM(type, ImbAnimType::NotAnim, ImbAnimType::Sequence);
}

View File

@ -31,7 +31,7 @@ static void __cpuid(
}
#endif
static int cpu_supports_sse42(void)
static int cpu_supports_sse42()
{
int result[4], num;
__cpuid(result, 0);
@ -39,17 +39,17 @@ static int cpu_supports_sse42(void)
if (num >= 1) {
__cpuid(result, 0x00000001);
return (result[2] & ((int)1 << 20)) != 0;
return (result[2] & (int(1) << 20)) != 0;
}
return 0;
}
static const char *cpu_brand_string(void)
static const char *cpu_brand_string()
{
static char buf[49] = {0};
int result[4] = {0};
__cpuid(result, 0x80000000);
if (result[0] >= (int)0x80000004) {
if (result[0] >= int(0x80000004)) {
__cpuid((int *)(buf + 0), 0x80000002);
__cpuid((int *)(buf + 16), 0x80000003);
__cpuid((int *)(buf + 32), 0x80000004);
@ -60,7 +60,7 @@ static const char *cpu_brand_string(void)
}
return buf_ptr;
}
return NULL;
return nullptr;
}
#ifdef _MSC_VER
@ -91,7 +91,7 @@ BOOL WINAPI DllMain(HINSTANCE /* hinstDLL */, DWORD fdwReason, LPVOID /* lpvRese
# include <cstdio>
# include <cstdlib>
static __attribute__((constructor)) void cpu_check(void)
static __attribute__((constructor)) void cpu_check()
{
# ifdef __x86_64
if (!cpu_supports_sse42()) {