Fix cppcheck const parameters

Convert method signature parameters to const where it is possible

# Conflicts:
#	drivers/gles3/rasterizer_canvas_gles3.cpp
#	drivers/gles3/rasterizer_canvas_gles3.h
#	editor/plugins/animation_state_machine_editor.cpp
#	editor/plugins/animation_state_machine_editor.h
This commit is contained in:
Markus Sauermann 2022-04-28 11:35:39 +02:00
parent d01e4124eb
commit a793960a10
14 changed files with 17 additions and 17 deletions

View File

@ -823,7 +823,7 @@ void RasterizerCanvasGLES3::_render_batch(uint32_t &r_index) {
} }
// TODO maybe dont use // TODO maybe dont use
void RasterizerCanvasGLES3::_end_batch(uint32_t p_index) { void RasterizerCanvasGLES3::_end_batch(const uint32_t p_index) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
state.instance_data_array[p_index].modulation[i] = 0.0; state.instance_data_array[p_index].modulation[i] = 0.0;
state.instance_data_array[p_index].ninepatch_margins[i] = 0.0; state.instance_data_array[p_index].ninepatch_margins[i] = 0.0;

View File

@ -270,7 +270,7 @@ public:
void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, bool p_to_backbuffer = false); void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, bool p_to_backbuffer = false);
void _render_item(RID p_render_target, const Item *p_item, const Transform2D &p_canvas_transform_inverse, Item *&current_clip, Light *p_lights, uint32_t &r_index); void _render_item(RID p_render_target, const Item *p_item, const Transform2D &p_canvas_transform_inverse, Item *&current_clip, Light *p_lights, uint32_t &r_index);
void _render_batch(uint32_t &p_max_index); void _render_batch(uint32_t &p_max_index);
void _end_batch(uint32_t p_index); void _end_batch(const uint32_t p_index);
void _allocate_instance_data_buffer(); void _allocate_instance_data_buffer();
void initialize(); void initialize();

View File

@ -122,7 +122,7 @@ static Transform3D _read_transform_from_array(const Vector<float> &array, int of
/* STRUCTURES */ /* STRUCTURES */
Transform3D Collada::Node::compute_transform(Collada &state) const { Transform3D Collada::Node::compute_transform(const Collada &state) const {
Transform3D xform; Transform3D xform;
for (int i = 0; i < xform_list.size(); i++) { for (int i = 0; i < xform_list.size(); i++) {

View File

@ -348,7 +348,7 @@ public:
Node *parent = nullptr; Node *parent = nullptr;
Transform3D compute_transform(Collada &state) const; Transform3D compute_transform(const Collada &state) const;
Transform3D get_global_transform() const; Transform3D get_global_transform() const;
Transform3D get_transform() const; Transform3D get_transform() const;

View File

@ -476,7 +476,7 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
} }
} }
void EditorNode3DGizmo::add_solid_box(Ref<Material> &p_material, Vector3 p_size, Vector3 p_position, const Transform3D &p_xform) { void EditorNode3DGizmo::add_solid_box(const Ref<Material> &p_material, Vector3 p_size, Vector3 p_position, const Transform3D &p_xform) {
ERR_FAIL_COND(!spatial_node); ERR_FAIL_COND(!spatial_node);
BoxMesh box_mesh; BoxMesh box_mesh;

View File

@ -99,7 +99,7 @@ public:
void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh); void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh);
void add_unscaled_billboard(const Ref<Material> &p_material, real_t p_scale = 1, const Color &p_modulate = Color(1, 1, 1)); void add_unscaled_billboard(const Ref<Material> &p_material, real_t p_scale = 1, const Color &p_modulate = Color(1, 1, 1));
void add_handles(const Vector<Vector3> &p_handles, const Ref<Material> &p_material, const Vector<int> &p_ids = Vector<int>(), bool p_billboard = false, bool p_secondary = false); void add_handles(const Vector<Vector3> &p_handles, const Ref<Material> &p_material, const Vector<int> &p_ids = Vector<int>(), bool p_billboard = false, bool p_secondary = false);
void add_solid_box(Ref<Material> &p_material, Vector3 p_size, Vector3 p_position = Vector3(), const Transform3D &p_xform = Transform3D()); void add_solid_box(const Ref<Material> &p_material, Vector3 p_size, Vector3 p_position = Vector3(), const Transform3D &p_xform = Transform3D());
virtual bool is_handle_highlighted(int p_id, bool p_secondary) const; virtual bool is_handle_highlighted(int p_id, bool p_secondary) const;
virtual String get_handle_name(int p_id, bool p_secondary) const; virtual String get_handle_name(int p_id, bool p_secondary) const;

View File

@ -1140,7 +1140,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
} }
} }
static void _find_identifiers(GDScriptParser::CompletionContext &p_context, bool p_only_functions, Map<String, ScriptLanguage::CodeCompletionOption> &r_result, int p_recursion_depth) { static void _find_identifiers(const GDScriptParser::CompletionContext &p_context, bool p_only_functions, Map<String, ScriptLanguage::CodeCompletionOption> &r_result, int p_recursion_depth) {
if (!p_only_functions && p_context.current_suite) { if (!p_only_functions && p_context.current_suite) {
// This includes function parameters, since they are also locals. // This includes function parameters, since they are also locals.
_find_identifiers_in_suite(p_context.current_suite, r_result); _find_identifiers_in_suite(p_context.current_suite, r_result);

View File

@ -1096,7 +1096,7 @@ Size2 OpenXRAPI::get_recommended_target_size() {
return target_size; return target_size;
} }
XRPose::TrackingConfidence OpenXRAPI::get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity) { XRPose::TrackingConfidence OpenXRAPI::get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, const Vector3 &r_angular_velocity) {
XrResult result; XrResult result;
ERR_FAIL_COND_V(!running, XRPose::XR_TRACKING_CONFIDENCE_NONE); ERR_FAIL_COND_V(!running, XRPose::XR_TRACKING_CONFIDENCE_NONE);
@ -2297,7 +2297,7 @@ Vector2 OpenXRAPI::get_action_vector2(RID p_action, RID p_tracker) {
return result_state.isActive ? Vector2(result_state.currentState.x, result_state.currentState.y) : Vector2(); return result_state.isActive ? Vector2(result_state.currentState.x, result_state.currentState.y) : Vector2();
} }
XRPose::TrackingConfidence OpenXRAPI::get_action_pose(RID p_action, RID p_tracker, Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity) { XRPose::TrackingConfidence OpenXRAPI::get_action_pose(RID p_action, RID p_tracker, Transform3D &r_transform, Vector3 &r_linear_velocity, const Vector3 &r_angular_velocity) {
ERR_FAIL_COND_V(session == XR_NULL_HANDLE, XRPose::XR_TRACKING_CONFIDENCE_NONE); ERR_FAIL_COND_V(session == XR_NULL_HANDLE, XRPose::XR_TRACKING_CONFIDENCE_NONE);
Action *action = action_owner.get_or_null(p_action); Action *action = action_owner.get_or_null(p_action);
ERR_FAIL_NULL_V(action, XRPose::XR_TRACKING_CONFIDENCE_NONE); ERR_FAIL_NULL_V(action, XRPose::XR_TRACKING_CONFIDENCE_NONE);

View File

@ -247,7 +247,7 @@ public:
bool can_render() { return instance != XR_NULL_HANDLE && session != XR_NULL_HANDLE && running && view_pose_valid && frame_state.shouldRender; }; bool can_render() { return instance != XR_NULL_HANDLE && session != XR_NULL_HANDLE && running && view_pose_valid && frame_state.shouldRender; };
Size2 get_recommended_target_size(); Size2 get_recommended_target_size();
XRPose::TrackingConfidence get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity); XRPose::TrackingConfidence get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, const Vector3 &r_angular_velocity);
bool get_view_transform(uint32_t p_view, Transform3D &r_transform); bool get_view_transform(uint32_t p_view, Transform3D &r_transform);
bool get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, CameraMatrix &p_camera_matrix); bool get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, CameraMatrix &p_camera_matrix);
bool process(); bool process();
@ -285,7 +285,7 @@ public:
bool get_action_bool(RID p_action, RID p_tracker); bool get_action_bool(RID p_action, RID p_tracker);
float get_action_float(RID p_action, RID p_tracker); float get_action_float(RID p_action, RID p_tracker);
Vector2 get_action_vector2(RID p_action, RID p_tracker); Vector2 get_action_vector2(RID p_action, RID p_tracker);
XRPose::TrackingConfidence get_action_pose(RID p_action, RID p_tracker, Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity); XRPose::TrackingConfidence get_action_pose(RID p_action, RID p_tracker, Transform3D &r_transform, Vector3 &r_linear_velocity, const Vector3 &r_angular_velocity);
bool trigger_haptic_pulse(RID p_action, RID p_tracker, float p_frequency, float p_amplitude, XrDuration p_duration_ns); bool trigger_haptic_pulse(RID p_action, RID p_tracker, float p_frequency, float p_amplitude, XrDuration p_duration_ns);
OpenXRAPI(); OpenXRAPI();

View File

@ -140,7 +140,7 @@ void FabrikInverseKinematic::solve_simple(Task *p_task, bool p_solve_magnet, Vec
} }
} }
void FabrikInverseKinematic::solve_simple_backwards(Chain &r_chain, bool p_solve_magnet) { void FabrikInverseKinematic::solve_simple_backwards(const Chain &r_chain, bool p_solve_magnet) {
if (p_solve_magnet && !r_chain.middle_chain_item) { if (p_solve_magnet && !r_chain.middle_chain_item) {
return; return;
} }

View File

@ -103,7 +103,7 @@ private:
static void solve_simple(Task *p_task, bool p_solve_magnet, Vector3 p_origin_pos); static void solve_simple(Task *p_task, bool p_solve_magnet, Vector3 p_origin_pos);
/// Special solvers that solve only chains with one end effector /// Special solvers that solve only chains with one end effector
static void solve_simple_backwards(Chain &r_chain, bool p_solve_magnet); static void solve_simple_backwards(const Chain &r_chain, bool p_solve_magnet);
static void solve_simple_forwards(Chain &r_chain, bool p_solve_magnet, Vector3 p_origin_pos); static void solve_simple_forwards(Chain &r_chain, bool p_solve_magnet, Vector3 p_origin_pos);
public: public:

View File

@ -157,7 +157,7 @@ void Gradient::reverse() {
emit_signal(CoreStringNames::get_singleton()->changed); emit_signal(CoreStringNames::get_singleton()->changed);
} }
void Gradient::set_points(Vector<Gradient::Point> &p_points) { void Gradient::set_points(const Vector<Gradient::Point> &p_points) {
points = p_points; points = p_points;
is_sorted = false; is_sorted = false;
emit_signal(CoreStringNames::get_singleton()->changed); emit_signal(CoreStringNames::get_singleton()->changed);

View File

@ -73,7 +73,7 @@ public:
void add_point(float p_offset, const Color &p_color); void add_point(float p_offset, const Color &p_color);
void remove_point(int p_index); void remove_point(int p_index);
void set_points(Vector<Point> &p_points); void set_points(const Vector<Point> &p_points);
Vector<Point> &get_points(); Vector<Point> &get_points();
void reverse(); void reverse();

View File

@ -138,11 +138,11 @@ static Object *obj_to_obj(Object *d) {
return d; return d;
} }
static StringName sn_to_sn(StringName &d) { static StringName sn_to_sn(const StringName &d) {
return d; return d;
} }
static Variant var_to_var(Variant &d) { static Variant var_to_var(const Variant &d) {
return d; return d;
} }