summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authormarxin <mliska@suse.cz>2019-02-12 21:10:08 +0100
committerRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-20 19:44:12 +0100
commit8d51618949d5ea8a94e0f504401e8f852a393968 (patch)
tree6c0ab829b02aba47ff3dc27b9a14d3c3a0658a3b /drivers
parent132e2f458df7a3551a251d68afeccd0362ca6be2 (diff)
Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp42
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp10
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp2
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp22
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp26
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp6
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp2
7 files changed, 54 insertions, 56 deletions
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index a7345978e1..bf210ef2b2 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -851,11 +851,11 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
int indices[num_points * 3];
- for (int i = 0; i < num_points; i++) {
- points[i] = circle->pos + Vector2(Math::sin(i * Math_PI * 2.0 / num_points), Math::cos(i * Math_PI * 2.0 / num_points)) * circle->radius;
- indices[i * 3 + 0] = i;
- indices[i * 3 + 1] = (i + 1) % num_points;
- indices[i * 3 + 2] = num_points;
+ for (int j = 0; j < num_points; j++) {
+ points[j] = circle->pos + Vector2(Math::sin(j * Math_PI * 2.0 / num_points), Math::cos(j * Math_PI * 2.0 / num_points)) * circle->radius;
+ indices[j * 3 + 0] = j;
+ indices[j * 3 + 1] = (j + 1) % num_points;
+ indices[j * 3 + 2] = num_points;
}
_bind_canvas_texture(RID(), RID());
@@ -913,13 +913,13 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
}
- for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
- if (s->attribs[i].enabled) {
- glEnableVertexAttribArray(i);
- glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, (uint8_t *)0 + s->attribs[i].offset);
+ for (int k = 0; k < VS::ARRAY_MAX - 1; k++) {
+ if (s->attribs[k].enabled) {
+ glEnableVertexAttribArray(k);
+ glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, (uint8_t *)0 + s->attribs[k].offset);
} else {
- glDisableVertexAttribArray(i);
- switch (i) {
+ glDisableVertexAttribArray(k);
+ switch (k) {
case VS::ARRAY_NORMAL: {
glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
} break;
@@ -939,8 +939,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
}
}
- for (int i = 1; i < VS::ARRAY_MAX - 1; i++) {
- glDisableVertexAttribArray(i);
+ for (int j = 1; j < VS::ARRAY_MAX - 1; j++) {
+ glDisableVertexAttribArray(j);
}
}
@@ -1002,13 +1002,13 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
}
- for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
- if (s->attribs[i].enabled) {
- glEnableVertexAttribArray(i);
- glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, (uint8_t *)0 + s->attribs[i].offset);
+ for (int k = 0; k < VS::ARRAY_MAX - 1; k++) {
+ if (s->attribs[k].enabled) {
+ glEnableVertexAttribArray(k);
+ glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, (uint8_t *)0 + s->attribs[k].offset);
} else {
- glDisableVertexAttribArray(i);
- switch (i) {
+ glDisableVertexAttribArray(k);
+ switch (k) {
case VS::ARRAY_NORMAL: {
glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
} break;
@@ -1021,8 +1021,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
}
}
- for (int i = 0; i < amount; i++) {
- const float *buffer = base_buffer + i * stride;
+ for (int k = 0; k < amount; k++) {
+ const float *buffer = base_buffer + k * stride;
{
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 03e6c185ee..3920a5f96a 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -1120,10 +1120,10 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
int num_surfaces = mesh->surfaces.size();
- for (int i = 0; i < num_surfaces; i++) {
- int material_index = instance->materials[i].is_valid() ? i : -1;
+ for (int j = 0; j < num_surfaces; j++) {
+ int material_index = instance->materials[j].is_valid() ? j : -1;
- RasterizerStorageGLES2::Surface *surface = mesh->surfaces[i];
+ RasterizerStorageGLES2::Surface *surface = mesh->surfaces[j];
_add_geometry(surface, instance, NULL, material_index, p_depth_pass, p_shadow_pass);
}
@@ -1143,8 +1143,8 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
int ssize = mesh->surfaces.size();
- for (int i = 0; i < ssize; i++) {
- RasterizerStorageGLES2::Surface *s = mesh->surfaces[i];
+ for (int j = 0; j < ssize; j++) {
+ RasterizerStorageGLES2::Surface *s = mesh->surfaces[j];
_add_geometry(s, instance, multi_mesh, -1, p_depth_pass, p_shadow_pass);
}
} break;
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index d00d572ccf..0227cd2b34 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -4283,7 +4283,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
- GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
_render_target_clear(rt);
ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 0cda8acba8..227445ae5b 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -581,10 +581,10 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
#ifdef GLES_OVER_GL
if (line->antialiased) {
glEnable(GL_LINE_SMOOTH);
- for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
Vector2 vertsl[2] = {
- verts[i],
- verts[(i + 1) % 4],
+ verts[j],
+ verts[(j + 1) % 4],
};
_draw_gui_primitive(2, vertsl, NULL, NULL);
}
@@ -782,8 +782,8 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
}
if (primitive->colors.size() == 1 && primitive->points.size() > 1) {
- Color c = primitive->colors[0];
- glVertexAttrib4f(VS::ARRAY_COLOR, c.r, c.g, c.b, c.a);
+ Color col = primitive->colors[0];
+ glVertexAttrib4f(VS::ARRAY_COLOR, col.r, col.g, col.b, col.a);
} else if (primitive->colors.empty()) {
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
@@ -1035,8 +1035,6 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, amount);
} else {
//split
-
- int stride = sizeof(float) * 4 * 6;
int split = int(Math::ceil(particles->phase * particles->amount));
if (amount - split > 0) {
@@ -1099,12 +1097,12 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
points[numpoints] = circle->pos;
int indices[numpoints * 3];
- for (int i = 0; i < numpoints; i++) {
+ for (int j = 0; j < numpoints; j++) {
- points[i] = circle->pos + Vector2(Math::sin(i * Math_PI * 2.0 / numpoints), Math::cos(i * Math_PI * 2.0 / numpoints)) * circle->radius;
- indices[i * 3 + 0] = i;
- indices[i * 3 + 1] = (i + 1) % numpoints;
- indices[i * 3 + 2] = numpoints;
+ points[j] = circle->pos + Vector2(Math::sin(j * Math_PI * 2.0 / numpoints), Math::cos(j * Math_PI * 2.0 / numpoints)) * circle->radius;
+ indices[j * 3 + 0] = j;
+ indices[j * 3 + 1] = (j + 1) % numpoints;
+ indices[j * 3 + 2] = numpoints;
}
_bind_canvas_texture(RID(), RID());
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index d634f8ea76..c66f2ed6ec 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -3178,10 +3178,10 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
int ssize = mesh->surfaces.size();
- for (int i = 0; i < ssize; i++) {
+ for (int j = 0; j < ssize; j++) {
- int mat_idx = inst->materials[i].is_valid() ? i : -1;
- RasterizerStorageGLES3::Surface *s = mesh->surfaces[i];
+ int mat_idx = inst->materials[j].is_valid() ? j : -1;
+ RasterizerStorageGLES3::Surface *s = mesh->surfaces[j];
_add_geometry(s, inst, NULL, mat_idx, p_depth_pass, p_shadow_pass);
}
@@ -3202,9 +3202,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
int ssize = mesh->surfaces.size();
- for (int i = 0; i < ssize; i++) {
+ for (int j = 0; j < ssize; j++) {
- RasterizerStorageGLES3::Surface *s = mesh->surfaces[i];
+ RasterizerStorageGLES3::Surface *s = mesh->surfaces[j];
_add_geometry(s, inst, multi_mesh, -1, p_depth_pass, p_shadow_pass);
}
@@ -3222,9 +3222,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
RasterizerStorageGLES3::Particles *particles = storage->particles_owner.getptr(inst->base);
ERR_CONTINUE(!particles);
- for (int i = 0; i < particles->draw_passes.size(); i++) {
+ for (int j = 0; j < particles->draw_passes.size(); j++) {
- RID pmesh = particles->draw_passes[i];
+ RID pmesh = particles->draw_passes[j];
if (!pmesh.is_valid())
continue;
RasterizerStorageGLES3::Mesh *mesh = storage->mesh_owner.get(pmesh);
@@ -3233,9 +3233,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
int ssize = mesh->surfaces.size();
- for (int j = 0; j < ssize; j++) {
+ for (int k = 0; k < ssize; k++) {
- RasterizerStorageGLES3::Surface *s = mesh->surfaces[j];
+ RasterizerStorageGLES3::Surface *s = mesh->surfaces[k];
_add_geometry(s, inst, particles, -1, p_depth_pass, p_shadow_pass);
}
}
@@ -5059,7 +5059,7 @@ void RasterizerSceneGLES3::initialize() {
{ //reflection cubemaps
int max_reflection_cubemap_sampler_size = 512;
- int cube_size = max_reflection_cubemap_sampler_size;
+ int rcube_size = max_reflection_cubemap_sampler_size;
glActiveTexture(GL_TEXTURE0);
@@ -5069,10 +5069,10 @@ void RasterizerSceneGLES3::initialize() {
GLenum format = GL_RGBA;
GLenum type = use_float ? GL_HALF_FLOAT : GL_UNSIGNED_INT_2_10_10_10_REV;
- while (cube_size >= 32) {
+ while (rcube_size >= 32) {
ReflectionCubeMap cube;
- cube.size = cube_size;
+ cube.size = rcube_size;
glGenTextures(1, &cube.depth);
glBindTexture(GL_TEXTURE_2D, cube.depth);
@@ -5111,7 +5111,7 @@ void RasterizerSceneGLES3::initialize() {
reflection_cubemaps.push_back(cube);
- cube_size >>= 1;
+ rcube_size >>= 1;
}
}
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index ce34de1dd8..5189017437 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -6049,9 +6049,9 @@ void RasterizerStorageGLES3::particles_set_amount(RID p_particles, int p_amount)
glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[i]);
glBufferData(GL_ARRAY_BUFFER, floats * sizeof(float), data, GL_STATIC_DRAW);
- for (int i = 0; i < 6; i++) {
- glEnableVertexAttribArray(i);
- glVertexAttribPointer(i, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4 * 6, ((uint8_t *)0) + (i * 16));
+ for (int j = 0; j < 6; j++) {
+ glEnableVertexAttribArray(j);
+ glVertexAttribPointer(j, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4 * 6, ((uint8_t *)0) + (j * 16));
}
}
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 0d98b7fbc0..aec3d27d69 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -420,7 +420,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
pa_operation *pa_op = pa_context_get_server_info(ad->pa_ctx, &AudioDriverPulseAudio::pa_server_info_cb, (void *)ad);
if (pa_op) {
while (ad->pa_status == 0) {
- int ret = pa_mainloop_iterate(ad->pa_ml, 1, NULL);
+ ret = pa_mainloop_iterate(ad->pa_ml, 1, NULL);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}