summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-07 13:23:40 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-20 10:34:00 +0300
commitde4c97758af117af97fad58e4a80ffeba0154ba8 (patch)
tree2139631cc24a59900a840b9371d5043183558fbd /drivers
parentf4b0c7a1ea8d86c1dfd96478ca12ad1360903d9d (diff)
Fix more issues found by cppcheck.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp32
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h2
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp2
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp2
4 files changed, 19 insertions, 19 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 441b049b50..ebf538351e 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -823,24 +823,24 @@ void RasterizerCanvasGLES3::_render_batch(uint32_t &r_index) {
}
// TODO maybe dont use
-void RasterizerCanvasGLES3::_end_batch(uint32_t &r_index) {
+void RasterizerCanvasGLES3::_end_batch(uint32_t p_index) {
for (int i = 0; i < 4; i++) {
- state.instance_data_array[r_index].modulation[i] = 0.0;
- state.instance_data_array[r_index].ninepatch_margins[i] = 0.0;
- state.instance_data_array[r_index].src_rect[i] = 0.0;
- state.instance_data_array[r_index].dst_rect[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].src_rect[i] = 0.0;
+ state.instance_data_array[p_index].dst_rect[i] = 0.0;
}
- state.instance_data_array[r_index].flags = uint32_t(0);
- state.instance_data_array[r_index].color_texture_pixel_size[0] = 0.0;
- state.instance_data_array[r_index].color_texture_pixel_size[1] = 0.0;
+ state.instance_data_array[p_index].flags = uint32_t(0);
+ state.instance_data_array[p_index].color_texture_pixel_size[0] = 0.0;
+ state.instance_data_array[p_index].color_texture_pixel_size[1] = 0.0;
- state.instance_data_array[r_index].pad[0] = 0.0;
- state.instance_data_array[r_index].pad[1] = 0.0;
+ state.instance_data_array[p_index].pad[0] = 0.0;
+ state.instance_data_array[p_index].pad[1] = 0.0;
- state.instance_data_array[r_index].lights[0] = uint32_t(0);
- state.instance_data_array[r_index].lights[1] = uint32_t(0);
- state.instance_data_array[r_index].lights[2] = uint32_t(0);
- state.instance_data_array[r_index].lights[3] = uint32_t(0);
+ state.instance_data_array[p_index].lights[0] = uint32_t(0);
+ state.instance_data_array[p_index].lights[1] = uint32_t(0);
+ state.instance_data_array[p_index].lights[2] = uint32_t(0);
+ state.instance_data_array[p_index].lights[3] = uint32_t(0);
}
RID RasterizerCanvasGLES3::light_create() {
@@ -1102,8 +1102,8 @@ RendererCanvasRender::PolygonID RasterizerCanvasGLES3::request_polygon(const Vec
{
glBindBuffer(GL_ARRAY_BUFFER, pb.vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, stride * vertex_count * sizeof(float), nullptr, GL_STATIC_DRAW); // TODO may not be necessary
- const uint8_t *r = polygon_buffer.ptr();
- float *fptr = (float *)r;
+ uint8_t *r = polygon_buffer.ptrw();
+ float *fptr = reinterpret_cast<float *>(r);
uint32_t *uptr = (uint32_t *)r;
uint32_t base_offset = 0;
{
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index a962796b2f..99b079b8bb 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -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_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 _end_batch(uint32_t &p_max_index);
+ void _end_batch(uint32_t p_index);
void _allocate_instance_data_buffer();
void initialize();
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 0c27b76ed8..a6c35b6837 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -379,7 +379,7 @@ float AudioDriverPulseAudio::get_latency() {
}
void AudioDriverPulseAudio::thread_func(void *p_udata) {
- AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)p_udata;
+ AudioDriverPulseAudio *ad = static_cast<AudioDriverPulseAudio *>(p_udata);
unsigned int write_ofs = 0;
size_t avail_bytes = 0;
uint64_t default_device_msec = OS::get_singleton()->get_ticks_msec();
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 400802686e..59b4c34c3f 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -6255,7 +6255,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
//validate with inputs
for (uint32_t i = 0; i < 32; i++) {
- if (!(shader->vertex_input_mask & (1 << i))) {
+ if (!(shader->vertex_input_mask & (1UL << i))) {
continue;
}
bool found = false;