Merge pull request #18853 from YeldhamDev/gui_cppcheck_fixes
Fixed some warnings found with Cppcheck
This commit is contained in:
commit
dd2aba021c
8 changed files with 8 additions and 25 deletions
|
@ -120,7 +120,6 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, float p_sc
|
||||||
|
|
||||||
if (mirroring.x) {
|
if (mirroring.x) {
|
||||||
double den = mirroring.x * p_scale;
|
double den = mirroring.x * p_scale;
|
||||||
double before = new_ofs.x;
|
|
||||||
new_ofs.x -= den * ceil(new_ofs.x / den);
|
new_ofs.x -= den * ceil(new_ofs.x / den);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -672,13 +672,8 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
||||||
m_forwardImpulse.resize(numWheel);
|
m_forwardImpulse.resize(numWheel);
|
||||||
m_sideImpulse.resize(numWheel);
|
m_sideImpulse.resize(numWheel);
|
||||||
|
|
||||||
int numWheelsOnGround = 0;
|
|
||||||
|
|
||||||
//collapse all those loops into one!
|
//collapse all those loops into one!
|
||||||
for (int i = 0; i < wheels.size(); i++) {
|
for (int i = 0; i < wheels.size(); i++) {
|
||||||
VehicleWheel &wheelInfo = *wheels[i];
|
|
||||||
if (wheelInfo.m_raycastInfo.m_isInContact)
|
|
||||||
numWheelsOnGround++;
|
|
||||||
m_sideImpulse[i] = real_t(0.);
|
m_sideImpulse[i] = real_t(0.);
|
||||||
m_forwardImpulse[i] = real_t(0.);
|
m_forwardImpulse[i] = real_t(0.);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2316,13 +2316,10 @@ Ref<MultiMesh> VoxelLightBaker::create_debug_multimesh(DebugMode p_mode) {
|
||||||
|
|
||||||
PoolVector<Vector3> vertices;
|
PoolVector<Vector3> vertices;
|
||||||
PoolVector<Color> colors;
|
PoolVector<Color> colors;
|
||||||
|
|
||||||
int vtx_idx = 0;
|
|
||||||
#define ADD_VTX(m_idx) \
|
#define ADD_VTX(m_idx) \
|
||||||
; \
|
; \
|
||||||
vertices.push_back(face_points[m_idx]); \
|
vertices.push_back(face_points[m_idx]); \
|
||||||
colors.push_back(Color(1, 1, 1, 1)); \
|
colors.push_back(Color(1, 1, 1, 1));
|
||||||
vtx_idx++;
|
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
|
|
||||||
|
|
|
@ -507,7 +507,6 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
|
||||||
void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, float p_blend) {
|
void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, float p_blend) {
|
||||||
|
|
||||||
float delta = p_delta * speed_scale * cd.speed_scale;
|
float delta = p_delta * speed_scale * cd.speed_scale;
|
||||||
bool backwards = delta < 0;
|
|
||||||
float next_pos = cd.pos + delta;
|
float next_pos = cd.pos + delta;
|
||||||
|
|
||||||
float len = cd.from->animation->get_length();
|
float len = cd.from->animation->get_length();
|
||||||
|
@ -525,6 +524,8 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f
|
||||||
|
|
||||||
if (&cd == &playback.current) {
|
if (&cd == &playback.current) {
|
||||||
|
|
||||||
|
bool backwards = delta < 0;
|
||||||
|
|
||||||
if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) {
|
if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) {
|
||||||
//playback finished
|
//playback finished
|
||||||
end_reached = true;
|
end_reached = true;
|
||||||
|
|
|
@ -190,7 +190,6 @@ private:
|
||||||
|
|
||||||
struct ItemNewline : public Item {
|
struct ItemNewline : public Item {
|
||||||
|
|
||||||
int line; // FIXME: Overriding base's line ?
|
|
||||||
ItemNewline() { type = ITEM_NEWLINE; }
|
ItemNewline() { type = ITEM_NEWLINE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,6 @@
|
||||||
#include "label.h"
|
#include "label.h"
|
||||||
#include "margin_container.h"
|
#include "margin_container.h"
|
||||||
|
|
||||||
struct _MinSizeCache {
|
|
||||||
|
|
||||||
int min_size;
|
|
||||||
bool will_stretch;
|
|
||||||
int final_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
Control *SplitContainer::_getch(int p_idx) const {
|
Control *SplitContainer::_getch(int p_idx) const {
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
|
@ -302,7 +302,6 @@ void TextEdit::_update_scrollbars() {
|
||||||
|
|
||||||
int hscroll_rows = ((hmin.height - 1) / get_row_height()) + 1;
|
int hscroll_rows = ((hmin.height - 1) / get_row_height()) + 1;
|
||||||
int visible_rows = get_visible_rows();
|
int visible_rows = get_visible_rows();
|
||||||
int num_rows = MAX(visible_rows, num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(visible_rows, text.size() - 1 - cursor.line_ofs)));
|
|
||||||
|
|
||||||
int total_rows = (is_hiding_enabled() ? get_total_unhidden_rows() : text.size());
|
int total_rows = (is_hiding_enabled() ? get_total_unhidden_rows() : text.size());
|
||||||
if (scroll_past_end_of_file_enabled) {
|
if (scroll_past_end_of_file_enabled) {
|
||||||
|
@ -2453,13 +2452,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
break;
|
break;
|
||||||
} else if (k->get_command()) {
|
} else if (k->get_command()) {
|
||||||
#endif
|
#endif
|
||||||
bool prev_char = false;
|
|
||||||
int cc = cursor.column;
|
int cc = cursor.column;
|
||||||
|
|
||||||
if (cc == 0 && cursor.line > 0) {
|
if (cc == 0 && cursor.line > 0) {
|
||||||
cursor_set_line(cursor.line - 1);
|
cursor_set_line(cursor.line - 1);
|
||||||
cursor_set_column(text[cursor.line].length());
|
cursor_set_column(text[cursor.line].length());
|
||||||
} else {
|
} else {
|
||||||
|
bool prev_char = false;
|
||||||
|
|
||||||
while (cc > 0) {
|
while (cc > 0) {
|
||||||
bool ischar = _is_text_char(text[cursor.line][cc - 1]);
|
bool ischar = _is_text_char(text[cursor.line][cc - 1]);
|
||||||
|
|
||||||
|
@ -2514,13 +2514,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
break;
|
break;
|
||||||
} else if (k->get_command()) {
|
} else if (k->get_command()) {
|
||||||
#endif
|
#endif
|
||||||
bool prev_char = false;
|
|
||||||
int cc = cursor.column;
|
int cc = cursor.column;
|
||||||
|
|
||||||
if (cc == text[cursor.line].length() && cursor.line < text.size() - 1) {
|
if (cc == text[cursor.line].length() && cursor.line < text.size() - 1) {
|
||||||
cursor_set_line(cursor.line + 1);
|
cursor_set_line(cursor.line + 1);
|
||||||
cursor_set_column(0);
|
cursor_set_column(0);
|
||||||
} else {
|
} else {
|
||||||
|
bool prev_char = false;
|
||||||
|
|
||||||
while (cc < text[cursor.line].length()) {
|
while (cc < text[cursor.line].length()) {
|
||||||
bool ischar = _is_text_char(text[cursor.line][cc]);
|
bool ischar = _is_text_char(text[cursor.line][cc]);
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,6 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Array a = surface_get_arrays(i);
|
Array a = surface_get_arrays(i);
|
||||||
int vcount = 0;
|
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
arrays = a;
|
arrays = a;
|
||||||
|
@ -230,6 +229,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
|
||||||
index_accum += v.size();
|
index_accum += v.size();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
int vcount = 0;
|
||||||
for (int j = 0; j < arrays.size(); j++) {
|
for (int j = 0; j < arrays.size(); j++) {
|
||||||
|
|
||||||
if (arrays[j].get_type() == Variant::NIL || a[j].get_type() == Variant::NIL) {
|
if (arrays[j].get_type() == Variant::NIL || a[j].get_type() == Variant::NIL) {
|
||||||
|
@ -1194,8 +1194,6 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
|
||||||
|
|
||||||
for (int j = 0; j < 3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
|
|
||||||
int vertex_idx = gen_vertices[gen_indices[i + j]];
|
|
||||||
|
|
||||||
SurfaceTool::Vertex v = surfaces[surface].vertices[uv_index[gen_vertices[gen_indices[i + j]]].second];
|
SurfaceTool::Vertex v = surfaces[surface].vertices[uv_index[gen_vertices[gen_indices[i + j]]].second];
|
||||||
|
|
||||||
if (surfaces[surface].format & ARRAY_FORMAT_COLOR) {
|
if (surfaces[surface].format & ARRAY_FORMAT_COLOR) {
|
||||||
|
|
Loading…
Reference in a new issue