summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/animation.cpp11
-rw-r--r--scene/resources/color_ramp.h7
-rw-r--r--scene/resources/font.cpp5
3 files changed, 18 insertions, 5 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 1a2c8333ef..eae95d9247 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -970,7 +970,12 @@ int Animation::_find(const Vector<K> &p_keys, float p_time) const {
int low = 0;
int high = len - 1;
- int middle;
+ int middle = 0;
+
+#if DEBUG_ENABLED
+ if (low > high)
+ ERR_PRINT("low > high, this may be a bug");
+#endif
const K *keys = &p_keys[0];
@@ -1289,7 +1294,7 @@ Error Animation::transform_track_interpolate(int p_track, float p_time, Vector3
TransformTrack *tt = static_cast<TransformTrack *>(t);
- bool ok;
+ bool ok = false;
TransformKey tk = _interpolate(tt->transforms, p_time, tt->interpolation, tt->loop_wrap, &ok);
@@ -1315,7 +1320,7 @@ Variant Animation::value_track_interpolate(int p_track, float p_time) const {
ERR_FAIL_COND_V(t->type != TYPE_VALUE, Variant());
ValueTrack *vt = static_cast<ValueTrack *>(t);
- bool ok;
+ bool ok = false;
Variant res = _interpolate(vt->values, p_time, vt->update_mode == UPDATE_CONTINUOUS ? vt->interpolation : INTERPOLATION_NEAREST, vt->loop_wrap, &ok);
diff --git a/scene/resources/color_ramp.h b/scene/resources/color_ramp.h
index 816152d51f..316c188d59 100644
--- a/scene/resources/color_ramp.h
+++ b/scene/resources/color_ramp.h
@@ -88,7 +88,12 @@ public:
//binary search
int low = 0;
int high = points.size() - 1;
- int middle;
+ int middle = 0;
+
+#if DEBUG_ENABLED
+ if (low > high)
+ ERR_PRINT("low > high, this may be a bug");
+#endif
while (low <= high) {
middle = (low + high) / 2;
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index d9ccd31f88..ea75748b3d 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -40,7 +40,7 @@ void Font::draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, f
return;
}
- float ofs;
+ float ofs = 0.f;
switch (p_align) {
case HALIGN_LEFT: {
ofs = 0;
@@ -51,6 +51,9 @@ void Font::draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, f
case HALIGN_RIGHT: {
ofs = p_width - length;
} break;
+ default: {
+ ERR_PRINT("Unknown halignment type");
+ } break;
}
draw(p_canvas_item, p_pos + Point2(ofs, 0), p_text, p_modulate, p_width);
}