From a0f206aae81b44fb48cb74900b9831835da40327 Mon Sep 17 00:00:00 2001 From: karroffel Date: Thu, 4 Oct 2018 09:17:59 +0200 Subject: [PATCH] fix enum cast warnings on clang --- core/os/input.cpp | 2 +- scene/2d/camera_2d.cpp | 8 ++++---- scene/2d/collision_polygon_2d.cpp | 2 +- scene/3d/audio_stream_player_3d.cpp | 2 +- scene/gui/control.cpp | 4 ++-- scene/gui/label.cpp | 4 ++-- scene/gui/line_edit.cpp | 2 +- scene/gui/nine_patch_rect.cpp | 4 ++-- scene/gui/texture_progress.cpp | 4 ++-- scene/resources/animation.cpp | 2 +- scene/resources/style_box.cpp | 6 +++--- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/core/os/input.cpp b/core/os/input.cpp index 6830df7e812..4cd1f0b24af 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -42,7 +42,7 @@ Input *Input::get_singleton() { } void Input::set_mouse_mode(MouseMode p_mode) { - ERR_FAIL_INDEX(p_mode, 4); + ERR_FAIL_INDEX((int)p_mode, 4); OS::get_singleton()->set_mouse_mode((OS::MouseMode)p_mode); } diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 3b86ca76ea0..788a39d05d4 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -422,14 +422,14 @@ void Camera2D::clear_current() { void Camera2D::set_limit(Margin p_margin, int p_limit) { - ERR_FAIL_INDEX(p_margin, 4); + ERR_FAIL_INDEX((int)p_margin, 4); limit[p_margin] = p_limit; update(); } int Camera2D::get_limit(Margin p_margin) const { - ERR_FAIL_INDEX_V(p_margin, 4, 0); + ERR_FAIL_INDEX_V((int)p_margin, 4, 0); return limit[p_margin]; } @@ -446,14 +446,14 @@ bool Camera2D::is_limit_smoothing_enabled() const { void Camera2D::set_drag_margin(Margin p_margin, float p_drag_margin) { - ERR_FAIL_INDEX(p_margin, 4); + ERR_FAIL_INDEX((int)p_margin, 4); drag_margin[p_margin] = p_drag_margin; update(); } float Camera2D::get_drag_margin(Margin p_margin) const { - ERR_FAIL_INDEX_V(p_margin, 4, 0); + ERR_FAIL_INDEX_V((int)p_margin, 4, 0); return drag_margin[p_margin]; } diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 508ceeaaf90..410b27c6919 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -247,7 +247,7 @@ Vector CollisionPolygon2D::get_polygon() const { void CollisionPolygon2D::set_build_mode(BuildMode p_mode) { - ERR_FAIL_INDEX(p_mode, 2); + ERR_FAIL_INDEX((int)p_mode, 2); build_mode = p_mode; if (parent) { _build_polygon(); diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index b1f90b72e74..abf022ecb3a 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -814,7 +814,7 @@ AudioStreamPlayer3D::AttenuationModel AudioStreamPlayer3D::get_attenuation_model void AudioStreamPlayer3D::set_out_of_range_mode(OutOfRangeMode p_mode) { - ERR_FAIL_INDEX(p_mode, 2); + ERR_FAIL_INDEX((int)p_mode, 2); out_of_range_mode = p_mode; } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index dc188952987..b90a4c17f46 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2235,13 +2235,13 @@ String Control::_get_tooltip() const { void Control::set_focus_neighbour(Margin p_margin, const NodePath &p_neighbour) { - ERR_FAIL_INDEX(p_margin, 4); + ERR_FAIL_INDEX((int)p_margin, 4); data.focus_neighbour[p_margin] = p_neighbour; } NodePath Control::get_focus_neighbour(Margin p_margin) const { - ERR_FAIL_INDEX_V(p_margin, 4, NodePath()); + ERR_FAIL_INDEX_V((int)p_margin, 4, NodePath()); return data.focus_neighbour[p_margin]; } diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 91dab279303..6ff2d232f08 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -511,7 +511,7 @@ void Label::regenerate_word_cache() { void Label::set_align(Align p_align) { - ERR_FAIL_INDEX(p_align, 4); + ERR_FAIL_INDEX((int)p_align, 4); align = p_align; update(); } @@ -523,7 +523,7 @@ Label::Align Label::get_align() const { void Label::set_valign(VAlign p_align) { - ERR_FAIL_INDEX(p_align, 4); + ERR_FAIL_INDEX((int)p_align, 4); valign = p_align; update(); } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 9c43d5b308f..6f344f10284 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -527,7 +527,7 @@ void LineEdit::_gui_input(Ref p_event) { void LineEdit::set_align(Align p_align) { - ERR_FAIL_INDEX(p_align, 4); + ERR_FAIL_INDEX((int)p_align, 4); align = p_align; update(); } diff --git a/scene/gui/nine_patch_rect.cpp b/scene/gui/nine_patch_rect.cpp index b8f6ffe6d2c..c6a34921c7d 100644 --- a/scene/gui/nine_patch_rect.cpp +++ b/scene/gui/nine_patch_rect.cpp @@ -110,7 +110,7 @@ Ref NinePatchRect::get_texture() const { void NinePatchRect::set_patch_margin(Margin p_margin, int p_size) { - ERR_FAIL_INDEX(p_margin, 4); + ERR_FAIL_INDEX((int)p_margin, 4); margin[p_margin] = p_size; update(); minimum_size_changed(); @@ -132,7 +132,7 @@ void NinePatchRect::set_patch_margin(Margin p_margin, int p_size) { int NinePatchRect::get_patch_margin(Margin p_margin) const { - ERR_FAIL_INDEX_V(p_margin, 4, 0); + ERR_FAIL_INDEX_V((int)p_margin, 4, 0); return margin[p_margin]; } diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index d28b4065fbb..7ecdccb0e41 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -59,14 +59,14 @@ Ref TextureProgress::get_over_texture() const { } void TextureProgress::set_stretch_margin(Margin p_margin, int p_size) { - ERR_FAIL_INDEX(p_margin, 4); + ERR_FAIL_INDEX((int)p_margin, 4); stretch_margin[p_margin] = p_size; update(); minimum_size_changed(); } int TextureProgress::get_stretch_margin(Margin p_margin) const { - ERR_FAIL_INDEX_V(p_margin, 4, 0); + ERR_FAIL_INDEX_V((int)p_margin, 4, 0); return stretch_margin[p_margin]; } diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 80ad2ad7399..5c01cadcd55 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1901,7 +1901,7 @@ void Animation::value_track_set_update_mode(int p_track, UpdateMode p_mode) { ERR_FAIL_INDEX(p_track, tracks.size()); Track *t = tracks[p_track]; ERR_FAIL_COND(t->type != TYPE_VALUE); - ERR_FAIL_INDEX(p_mode, 4); + ERR_FAIL_INDEX((int)p_mode, 4); ValueTrack *vt = static_cast(t); vt->update_mode = p_mode; diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index fb81375b0a3..69d85eeef3f 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -136,7 +136,7 @@ Ref StyleBoxTexture::get_normal_map() const { void StyleBoxTexture::set_margin_size(Margin p_margin, float p_size) { - ERR_FAIL_INDEX(p_margin, 4); + ERR_FAIL_INDEX((int)p_margin, 4); margin[p_margin] = p_size; emit_changed(); @@ -200,7 +200,7 @@ Size2 StyleBoxTexture::get_center_size() const { void StyleBoxTexture::set_expand_margin_size(Margin p_expand_margin, float p_size) { - ERR_FAIL_INDEX(p_expand_margin, 4); + ERR_FAIL_INDEX((int)p_expand_margin, 4); expand_margin[p_expand_margin] = p_size; emit_changed(); } @@ -223,7 +223,7 @@ void StyleBoxTexture::set_expand_margin_size_all(float p_expand_margin_size) { float StyleBoxTexture::get_expand_margin_size(Margin p_expand_margin) const { - ERR_FAIL_INDEX_V(p_expand_margin, 4, 0); + ERR_FAIL_INDEX_V((int)p_expand_margin, 4, 0); return expand_margin[p_expand_margin]; }