Cleanup: use const arguments & variables
This commit is contained in:
parent
e086e88e37
commit
52ce8d408f
|
@ -115,10 +115,10 @@ void *MEM_lockfree_dupallocN(const void *vmemh)
|
|||
{
|
||||
void *newp = NULL;
|
||||
if (vmemh) {
|
||||
MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
|
||||
const MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
|
||||
const size_t prev_size = MEM_lockfree_allocN_len(vmemh);
|
||||
if (UNLIKELY(MEMHEAD_IS_ALIGNED(memh))) {
|
||||
MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
const MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
newp = MEM_lockfree_mallocN_aligned(
|
||||
prev_size, (size_t)memh_aligned->alignment, "dupli_malloc");
|
||||
}
|
||||
|
@ -135,14 +135,14 @@ void *MEM_lockfree_reallocN_id(void *vmemh, size_t len, const char *str)
|
|||
void *newp = NULL;
|
||||
|
||||
if (vmemh) {
|
||||
MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
|
||||
size_t old_len = MEM_lockfree_allocN_len(vmemh);
|
||||
const MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
|
||||
const size_t old_len = MEM_lockfree_allocN_len(vmemh);
|
||||
|
||||
if (LIKELY(!MEMHEAD_IS_ALIGNED(memh))) {
|
||||
newp = MEM_lockfree_mallocN(len, "realloc");
|
||||
}
|
||||
else {
|
||||
MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
const MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
newp = MEM_lockfree_mallocN_aligned(len, (size_t)memh_aligned->alignment, "realloc");
|
||||
}
|
||||
|
||||
|
@ -171,14 +171,14 @@ void *MEM_lockfree_recallocN_id(void *vmemh, size_t len, const char *str)
|
|||
void *newp = NULL;
|
||||
|
||||
if (vmemh) {
|
||||
MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
|
||||
size_t old_len = MEM_lockfree_allocN_len(vmemh);
|
||||
const MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
|
||||
const size_t old_len = MEM_lockfree_allocN_len(vmemh);
|
||||
|
||||
if (LIKELY(!MEMHEAD_IS_ALIGNED(memh))) {
|
||||
newp = MEM_lockfree_mallocN(len, "recalloc");
|
||||
}
|
||||
else {
|
||||
MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
const MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
newp = MEM_lockfree_mallocN_aligned(len, (size_t)memh_aligned->alignment, "recalloc");
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void BKE_addon_pref_type_init(void);
|
|||
void BKE_addon_pref_type_free(void);
|
||||
|
||||
struct bAddon *BKE_addon_new(void);
|
||||
struct bAddon *BKE_addon_find(struct ListBase *addon_list, const char *module);
|
||||
struct bAddon *BKE_addon_find(const struct ListBase *addon_list, const char *module);
|
||||
struct bAddon *BKE_addon_ensure(struct ListBase *addon_list, const char *module);
|
||||
bool BKE_addon_remove_safe(struct ListBase *addon_list, const char *module);
|
||||
void BKE_addon_free(struct bAddon *addon);
|
||||
|
|
|
@ -280,17 +280,17 @@ void BKE_pose_where_is_bone_tail(bPoseChannel *pchan);
|
|||
*/
|
||||
void BKE_pose_apply_action_selected_bones(Object *ob,
|
||||
bAction *action,
|
||||
AnimationEvalContext *anim_eval_context);
|
||||
const AnimationEvalContext *anim_eval_context);
|
||||
/**
|
||||
* Evaluate the action and apply it to the pose. Ignore selection state of the bones.
|
||||
*/
|
||||
void BKE_pose_apply_action_all_bones(Object *ob,
|
||||
bAction *action,
|
||||
AnimationEvalContext *anim_eval_context);
|
||||
const AnimationEvalContext *anim_eval_context);
|
||||
|
||||
void BKE_pose_apply_action_blend(Object *ob,
|
||||
bAction *action,
|
||||
AnimationEvalContext *anim_eval_context,
|
||||
const AnimationEvalContext *anim_eval_context,
|
||||
float blend_factor);
|
||||
|
||||
void vec_roll_to_mat3(const float vec[3], float roll, float r_mat[3][3]);
|
||||
|
|
|
@ -38,7 +38,7 @@ bAddon *BKE_addon_new()
|
|||
return addon;
|
||||
}
|
||||
|
||||
bAddon *BKE_addon_find(ListBase *addon_list, const char *module)
|
||||
bAddon *BKE_addon_find(const ListBase *addon_list, const char *module)
|
||||
{
|
||||
return static_cast<bAddon *>(BLI_findstring(addon_list, module, offsetof(bAddon, module)));
|
||||
}
|
||||
|
|
|
@ -34,14 +34,14 @@ void pose_apply_restore_fcurves(bAction *action);
|
|||
|
||||
void pose_apply(Object *ob,
|
||||
bAction *action,
|
||||
AnimationEvalContext *anim_eval_context,
|
||||
const AnimationEvalContext *anim_eval_context,
|
||||
ActionApplier applier);
|
||||
|
||||
} // namespace
|
||||
|
||||
void BKE_pose_apply_action_selected_bones(Object *ob,
|
||||
bAction *action,
|
||||
AnimationEvalContext *anim_eval_context)
|
||||
const AnimationEvalContext *anim_eval_context)
|
||||
{
|
||||
auto evaluate_and_apply =
|
||||
[](PointerRNA *ptr, bAction *act, const AnimationEvalContext *anim_eval_context) {
|
||||
|
@ -53,7 +53,7 @@ void BKE_pose_apply_action_selected_bones(Object *ob,
|
|||
|
||||
void BKE_pose_apply_action_all_bones(Object *ob,
|
||||
bAction *action,
|
||||
AnimationEvalContext *anim_eval_context)
|
||||
const AnimationEvalContext *anim_eval_context)
|
||||
{
|
||||
PointerRNA pose_owner_ptr = RNA_id_pointer_create(&ob->id);
|
||||
animsys_evaluate_action(&pose_owner_ptr, action, anim_eval_context, false);
|
||||
|
@ -61,7 +61,7 @@ void BKE_pose_apply_action_all_bones(Object *ob,
|
|||
|
||||
void BKE_pose_apply_action_blend(Object *ob,
|
||||
bAction *action,
|
||||
AnimationEvalContext *anim_eval_context,
|
||||
const AnimationEvalContext *anim_eval_context,
|
||||
const float blend_factor)
|
||||
{
|
||||
auto evaluate_and_blend = [blend_factor](PointerRNA *ptr,
|
||||
|
@ -76,7 +76,7 @@ void BKE_pose_apply_action_blend(Object *ob,
|
|||
namespace {
|
||||
void pose_apply(Object *ob,
|
||||
bAction *action,
|
||||
AnimationEvalContext *anim_eval_context,
|
||||
const AnimationEvalContext *anim_eval_context,
|
||||
ActionApplier applier)
|
||||
{
|
||||
bPose *pose = ob->pose;
|
||||
|
|
|
@ -312,7 +312,7 @@ UVVertex *UVEdge::get_other_uv_vertex(const int vertex)
|
|||
UVVertex *UVIsland::lookup(const UVVertex &vertex)
|
||||
{
|
||||
const int vert_index = vertex.vertex;
|
||||
Vector<UVVertex *> &vertices = uv_vertex_lookup.lookup_or_add_default(vert_index);
|
||||
const Vector<UVVertex *> &vertices = uv_vertex_lookup.lookup_or_add_default(vert_index);
|
||||
for (UVVertex *v : vertices) {
|
||||
if (v->uv == vertex.uv) {
|
||||
return v;
|
||||
|
|
|
@ -560,7 +560,7 @@ CCGKey BKE_subdiv_ccg_key_top_level(const SubdivCCG &subdiv_ccg)
|
|||
* {(x, y), {x + 1, y}, {x + 1, y + 1}, {x, y + 1}}
|
||||
*
|
||||
* The result is stored in normals storage from TLS. */
|
||||
static void subdiv_ccg_recalc_inner_face_normals(SubdivCCG &subdiv_ccg,
|
||||
static void subdiv_ccg_recalc_inner_face_normals(const SubdivCCG &subdiv_ccg,
|
||||
const CCGKey &key,
|
||||
MutableSpan<float3> face_normals,
|
||||
const int corner)
|
||||
|
@ -590,7 +590,7 @@ static void subdiv_ccg_recalc_inner_face_normals(SubdivCCG &subdiv_ccg,
|
|||
}
|
||||
|
||||
/* Average normals at every grid element, using adjacent faces normals. */
|
||||
static void subdiv_ccg_average_inner_face_normals(SubdivCCG &subdiv_ccg,
|
||||
static void subdiv_ccg_average_inner_face_normals(const SubdivCCG &subdiv_ccg,
|
||||
const CCGKey &key,
|
||||
const Span<float3> face_normals,
|
||||
const int corner)
|
||||
|
@ -690,7 +690,7 @@ static void average_grid_element_value_v3(float a[3], float b[3])
|
|||
copy_v3_v3(b, a);
|
||||
}
|
||||
|
||||
static void average_grid_element(SubdivCCG &subdiv_ccg,
|
||||
static void average_grid_element(const SubdivCCG &subdiv_ccg,
|
||||
const CCGKey &key,
|
||||
CCGElem *grid_element_a,
|
||||
CCGElem *grid_element_b)
|
||||
|
@ -744,7 +744,7 @@ static void element_accumulator_mul_fl(GridElementAccumulator &accumulator, cons
|
|||
accumulator.mask *= f;
|
||||
}
|
||||
|
||||
static void element_accumulator_copy(SubdivCCG &subdiv_ccg,
|
||||
static void element_accumulator_copy(const SubdivCCG &subdiv_ccg,
|
||||
const CCGKey &key,
|
||||
CCGElem &destination,
|
||||
const GridElementAccumulator &accumulator)
|
||||
|
|
|
@ -2705,7 +2705,7 @@ static bool raycast_test_remove(BoolOpType op, Array<int> &winding, int shape, b
|
|||
}
|
||||
|
||||
/** Add triangle a flipped version of tri to out_faces. */
|
||||
static void raycast_add_flipped(Vector<Face *> &out_faces, Face &tri, IMeshArena *arena)
|
||||
static void raycast_add_flipped(Vector<Face *> &out_faces, const Face &tri, IMeshArena *arena)
|
||||
{
|
||||
|
||||
Array<const Vert *> flipped_vs = {tri[0], tri[2], tri[1]};
|
||||
|
|
|
@ -348,7 +348,7 @@ static ScanFillVertLink *addedgetoscanlist(ScanFillVertLink *scdata, ScanFillEdg
|
|||
/**
|
||||
* Return true if `eve` inside the bound-box of `eed`.
|
||||
*/
|
||||
static bool boundinsideEV(ScanFillEdge *eed, ScanFillVert *eve)
|
||||
static bool boundinsideEV(const ScanFillEdge *eed, const ScanFillVert *eve)
|
||||
{
|
||||
float minx, maxx, miny, maxy;
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ class GPUShaderCreator : public OCIO::GpuShaderCreator {
|
|||
|
||||
/* Don't use the name argument directly since ShaderCreateInfo only stores references to
|
||||
* resource names, instead, use the name that is stored in resource_names_. */
|
||||
std::string &resource_name = *resource_names_[resource_names_.size() - 1];
|
||||
const std::string &resource_name = *resource_names_[resource_names_.size() - 1];
|
||||
shader_create_info_.push_constant(Type::BOOL, resource_name);
|
||||
|
||||
boolean_uniforms_.add(name, get_bool);
|
||||
|
@ -228,7 +228,7 @@ class GPUShaderCreator : public OCIO::GpuShaderCreator {
|
|||
|
||||
/* Don't use the name argument directly since ShaderCreateInfo only stores references to
|
||||
* resource names, instead, use the name that is stored in resource_names_. */
|
||||
std::string &resource_name = *resource_names_[resource_names_.size() - 1];
|
||||
const std::string &resource_name = *resource_names_[resource_names_.size() - 1];
|
||||
|
||||
GPUTexture *texture;
|
||||
const ResultType result_type = (channel == TEXTURE_RGB_CHANNEL) ? ResultType::Float3 :
|
||||
|
@ -267,7 +267,7 @@ class GPUShaderCreator : public OCIO::GpuShaderCreator {
|
|||
|
||||
/* Don't use the name argument directly since ShaderCreateInfo only stores references to
|
||||
* resource names, instead, use the name that is stored in resource_names_. */
|
||||
std::string &resource_name = *resource_names_[resource_names_.size() - 1];
|
||||
const std::string &resource_name = *resource_names_[resource_names_.size() - 1];
|
||||
shader_create_info_.sampler(textures_.size() + 1, ImageType::FLOAT_3D, resource_name);
|
||||
|
||||
GPUTexture *texture = GPU_texture_create_3d(
|
||||
|
|
|
@ -209,9 +209,9 @@ bool VelocityModule::step_object_sync(Object *ob,
|
|||
|
||||
/* Avoid drawing object that has no motions but were tagged as such. */
|
||||
if (step_ == STEP_CURRENT && has_motion == true && has_deform == false) {
|
||||
float4x4 &obmat_curr = (*object_steps[STEP_CURRENT])[vel.obj.ofs[STEP_CURRENT]];
|
||||
float4x4 &obmat_prev = (*object_steps[STEP_PREVIOUS])[vel.obj.ofs[STEP_PREVIOUS]];
|
||||
float4x4 &obmat_next = (*object_steps[STEP_NEXT])[vel.obj.ofs[STEP_NEXT]];
|
||||
const float4x4 &obmat_curr = (*object_steps[STEP_CURRENT])[vel.obj.ofs[STEP_CURRENT]];
|
||||
const float4x4 &obmat_prev = (*object_steps[STEP_PREVIOUS])[vel.obj.ofs[STEP_PREVIOUS]];
|
||||
const float4x4 &obmat_next = (*object_steps[STEP_NEXT])[vel.obj.ofs[STEP_NEXT]];
|
||||
if (inst_.is_viewport()) {
|
||||
has_motion = (obmat_curr != obmat_prev);
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ class AssetIndexFile : public AbstractFile {
|
|||
/**
|
||||
* Returns whether the index file is older than the given asset file.
|
||||
*/
|
||||
bool is_older_than(BlendFile &asset_file) const
|
||||
bool is_older_than(const BlendFile &asset_file) const
|
||||
{
|
||||
return BLI_file_older(this->get_file_path(), asset_file.get_file_path());
|
||||
}
|
||||
|
|
|
@ -1216,7 +1216,7 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto
|
|||
static void do_movie_proxy(void *pjv,
|
||||
int * /*build_sizes*/,
|
||||
int /*build_count*/,
|
||||
int *build_undistort_sizes,
|
||||
const int *build_undistort_sizes,
|
||||
int build_undistort_count,
|
||||
bool *stop,
|
||||
bool *do_update,
|
||||
|
|
|
@ -769,7 +769,7 @@ int sequencer_retiming_key_select_exec(bContext *C, wmOperator *op)
|
|||
return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static void realize_fake_keys_in_rect(bContext *C, Sequence *seq, rctf &rectf)
|
||||
static void realize_fake_keys_in_rect(bContext *C, Sequence *seq, const rctf &rectf)
|
||||
{
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ static void invert_snap(eSnapMode &snap_mode)
|
|||
/* WORKAROUND: The source position is based on the transformed elements.
|
||||
* However, at this stage, the transformation has not yet been applied.
|
||||
* So apply the transformation here. */
|
||||
static float2 nla_transform_apply(TransInfo *t, const float *vec, float2 &ival)
|
||||
static float2 nla_transform_apply(TransInfo *t, const float *vec, const float2 &ival)
|
||||
{
|
||||
float4x4 mat = float4x4::identity();
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ static void collection_filter_channel_up_to_incl(VectorSet<Sequence *> &strips,
|
|||
|
||||
/* Check if seq must be rendered. This depends on whole stack in some cases, not only seq itself.
|
||||
* Order of applying these conditions is important. */
|
||||
static bool must_render_strip(VectorSet<Sequence *> &strips, Sequence *strip)
|
||||
static bool must_render_strip(const VectorSet<Sequence *> &strips, Sequence *strip)
|
||||
{
|
||||
bool seq_have_effect_in_stack = false;
|
||||
for (Sequence *strip_iter : strips) {
|
||||
|
|
|
@ -346,12 +346,12 @@ static void make_cb_table_float_sop(
|
|||
}
|
||||
|
||||
static void color_balance_byte_byte(
|
||||
StripColorBalance *cb_, uchar *rect, uchar *mask_rect, int width, int height, float mul)
|
||||
StripColorBalance *cb_, uchar *rect, const uchar *mask_rect, int width, int height, float mul)
|
||||
{
|
||||
// uchar cb_tab[3][256];
|
||||
uchar *cp = rect;
|
||||
uchar *e = cp + width * 4 * height;
|
||||
uchar *m = mask_rect;
|
||||
const uchar *m = mask_rect;
|
||||
|
||||
StripColorBalance cb = calc_cb(cb_);
|
||||
|
||||
|
@ -392,7 +392,7 @@ static void color_balance_byte_byte(
|
|||
static void color_balance_byte_float(StripColorBalance *cb_,
|
||||
uchar *rect,
|
||||
float *rect_float,
|
||||
uchar *mask_rect,
|
||||
const uchar *mask_rect,
|
||||
int width,
|
||||
int height,
|
||||
float mul)
|
||||
|
@ -401,7 +401,7 @@ static void color_balance_byte_float(StripColorBalance *cb_,
|
|||
int c, i;
|
||||
uchar *p = rect;
|
||||
uchar *e = p + width * 4 * height;
|
||||
uchar *m = mask_rect;
|
||||
const uchar *m = mask_rect;
|
||||
float *o;
|
||||
StripColorBalance cb;
|
||||
|
||||
|
@ -552,9 +552,9 @@ static void *color_balance_do_thread(void *thread_data_v)
|
|||
StripColorBalance *cb = thread_data->cb;
|
||||
int width = thread_data->width, height = thread_data->height;
|
||||
uchar *rect = thread_data->rect;
|
||||
uchar *mask_rect = thread_data->mask_rect;
|
||||
const uchar *mask_rect = thread_data->mask_rect;
|
||||
float *rect_float = thread_data->rect_float;
|
||||
float *mask_rect_float = thread_data->mask_rect_float;
|
||||
const float *mask_rect_float = thread_data->mask_rect_float;
|
||||
float mul = thread_data->mul;
|
||||
|
||||
if (rect_float) {
|
||||
|
|
Loading…
Reference in New Issue