summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-09-26 17:38:02 +0200
committerRémi Verschelde <rverschelde@gmail.com>2018-09-27 16:25:23 +0200
commite5bbcb8bcf8180a54fdcc5c4291b153246d861ce (patch)
tree9e7ebc806269d2c9d4c417b40f396d5c9da763ba
parentd8b30d42f579acfaa352402154111eb39160fea1 (diff)
Fix warnings for comparison between signed and unsigned integers [-Wsign-compare]
Also turn off -Wsign-compare warnings in the future, we do not consider them important. Fixes the following GCC 5 warnings: ``` core/node_path.cpp:279:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] core/oa_hash_map.h:169:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] core/oa_hash_map.h:314:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] drivers/gles2/shader_gles2.cpp:985:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] drivers/gles3/rasterizer_storage_gles3.cpp:1075:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] drivers/pulseaudio/audio_driver_pulseaudio.cpp:343:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] editor/editor_plugin.cpp:525:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] editor/editor_properties_array_dict.cpp:747:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] editor/plugins/spatial_editor_plugin.cpp:2078:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] editor/plugins/spatial_editor_plugin.cpp:4096:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] editor/plugins/sprite_editor_plugin.cpp:100:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/cvtt/image_compress_cvtt.cpp:122:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/cvtt/image_compress_cvtt.cpp:134:77: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/cvtt/image_compress_cvtt.cpp:339:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/etc/image_etc.cpp:222:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/gdnative/register_types.cpp:242:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/gdnative/register_types.cpp:258:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/opensimplex/simplex_noise.cpp:200:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/opensimplex/simplex_noise.cpp:222:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] modules/opensimplex/simplex_noise.cpp:246:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] platform/android/export/export.cpp:1085:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] platform/android/export/export.cpp:1489:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] platform/android/export/export.cpp:1623:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] platform/iphone/export/export.cpp:206:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] platform/iphone/export/export.cpp:356:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] platform/iphone/export/export.cpp:406:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] platform/iphone/export/export.cpp:493:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] scene/3d/audio_stream_player_3d.cpp:420:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] scene/resources/audio_stream_sample.cpp:565:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] scene/resources/audio_stream_sample.cpp:571:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] servers/audio/audio_rb_resampler.cpp:156:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ``` The following warnings were not fixed, as they implied casting for no gain: ``` core/io/packet_peer.cpp:228:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] core/io/resource_format_binary.cpp:109:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] drivers/gles2/rasterizer_scene_gles2.cpp:144:57: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] drivers/unix/file_access_unix.cpp:249:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] scene/3d/voxel_light_baker.cpp:889:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] scene/3d/voxel_light_baker.cpp:1020:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] scene/3d/voxel_light_baker.cpp:1154:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] scene/3d/voxel_light_baker.cpp:2255:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] scene/resources/bit_mask.cpp:336:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] servers/audio/audio_stream.cpp:141:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] servers/audio/audio_stream.cpp:150:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] servers/audio/audio_stream.cpp:154:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] servers/audio_server.cpp:86:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] servers/audio_server.cpp:89:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ```
-rw-r--r--SConstruct5
-rw-r--r--core/node_path.cpp2
-rw-r--r--core/oa_hash_map.h4
-rw-r--r--drivers/gles2/shader_gles2.cpp2
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp2
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp2
-rw-r--r--editor/editor_plugin.cpp3
-rw-r--r--editor/editor_properties_array_dict.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp4
-rw-r--r--editor/plugins/sprite_editor_plugin.cpp2
-rw-r--r--modules/cvtt/image_compress_cvtt.cpp6
-rw-r--r--modules/etc/image_etc.cpp2
-rw-r--r--modules/gdnative/register_types.cpp4
-rw-r--r--modules/opensimplex/simplex_noise.cpp6
-rw-r--r--platform/android/export/export.cpp6
-rw-r--r--platform/iphone/export/export.cpp8
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/resources/audio_stream_sample.cpp4
-rw-r--r--servers/audio/audio_rb_resampler.cpp2
19 files changed, 35 insertions, 33 deletions
diff --git a/SConstruct b/SConstruct
index 1c55e0be93..17518706aa 100644
--- a/SConstruct
+++ b/SConstruct
@@ -333,12 +333,13 @@ if selected_platform in platform_list:
# Set exception handling model to avoid warnings caused by Windows system headers.
env.Append(CCFLAGS=['/EHsc'])
else: # Rest of the world
+ disable_nonessential_warnings = ['-Wno-sign-compare']
if (env["warnings"] == 'extra'):
env.Append(CCFLAGS=['-Wall', '-Wextra'])
elif (env["warnings"] == 'all' or env["warnings"] == 'yes'):
- env.Append(CCFLAGS=['-Wall'])
+ env.Append(CCFLAGS=['-Wall'] + disable_nonessential_warnings)
elif (env["warnings"] == 'moderate'):
- env.Append(CCFLAGS=['-Wall', '-Wno-unused'])
+ env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + disable_nonessential_warnings)
else: # 'no'
env.Append(CCFLAGS=['-w'])
env.Append(CCFLAGS=['-Werror=return-type'])
diff --git a/core/node_path.cpp b/core/node_path.cpp
index 35d6fdcf10..91e2aa5f4e 100644
--- a/core/node_path.cpp
+++ b/core/node_path.cpp
@@ -276,7 +276,7 @@ NodePath NodePath::get_as_property_path() const {
String initial_subname = data->path[0];
- for (size_t i = 1; i < data->path.size(); i++) {
+ for (int i = 1; i < data->path.size(); i++) {
initial_subname += "/" + data->path[i];
}
new_path.insert(0, initial_subname);
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
index a2d76381ca..3705762d6c 100644
--- a/core/oa_hash_map.h
+++ b/core/oa_hash_map.h
@@ -166,7 +166,7 @@ private:
values = memnew_arr(TValue, capacity);
hashes = memnew_arr(uint32_t, capacity);
- for (int i = 0; i < capacity; i++) {
+ for (uint32_t i = 0; i < capacity; i++) {
hashes[i] = 0;
}
@@ -311,7 +311,7 @@ public:
values = memnew_arr(TValue, p_initial_capacity);
hashes = memnew_arr(uint32_t, p_initial_capacity);
- for (int i = 0; i < p_initial_capacity; i++) {
+ for (uint32_t i = 0; i < p_initial_capacity; i++) {
hashes[i] = 0;
}
}
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index 650e8f7c42..216c911a6c 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -982,7 +982,7 @@ void ShaderGLES2::use_material(void *p_material) {
value.second.resize(default_arg_size);
- for (int i = 0; i < default_arg_size; i++) {
+ for (size_t i = 0; i < default_arg_size; i++) {
if (is_float) {
value.second.write[i].real = 0.0;
} else {
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 25e7bd0424..67863ac63e 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1072,7 +1072,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
uint32_t *ptr = (uint32_t *)wb.ptr();
uint32_t num_pixels = data_size / 4;
- for (int ofs = 0; ofs < num_pixels; ofs++) {
+ for (uint32_t ofs = 0; ofs < num_pixels; ofs++) {
uint32_t px = ptr[ofs];
uint32_t a = px >> 30 & 0xFF;
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 7578fbc0a0..5ca9e79ab9 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -340,7 +340,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
unsigned int out_idx = 0;
for (unsigned int i = 0; i < ad->buffer_frames; i++) {
- for (unsigned int j = 0; j < ad->pa_map.channels - 1; j++) {
+ for (int j = 0; j < ad->pa_map.channels - 1; j++) {
ad->samples_out.write[out_idx++] = ad->samples_in[in_idx++] >> 16;
}
uint32_t l = ad->samples_in[in_idx++];
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 1ad23963a9..dd3a8aa307 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -39,6 +39,7 @@
#include "scene/3d/camera.h"
#include "scene/gui/popup_menu.h"
#include "servers/visual_server.h"
+
Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_size) {
Vector<Ref<Mesh> > meshes;
@@ -522,7 +523,7 @@ int EditorPlugin::update_overlays() const {
if (SpatialEditor::get_singleton()->is_visible()) {
int count = 0;
- for (int i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
SpatialEditorViewport *vp = SpatialEditor::get_singleton()->get_editor_viewport(i);
if (vp->is_visible()) {
vp->update_surface();
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 808a8ac2f8..20c34e9092 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -744,7 +744,7 @@ void EditorPropertyDictionary::update_property() {
page->connect("value_changed", this, "_page_changed");
} else {
// Queue childs for deletion, delete immediately might cause errors.
- for (size_t i = 1; i < vbox->get_child_count(); i++) {
+ for (int i = 1; i < vbox->get_child_count(); i++) {
vbox->get_child(i)->queue_delete();
}
}
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 54e187e7bb..356bfbe2b2 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -2075,7 +2075,7 @@ void SpatialEditorViewport::set_message(String p_message, float p_time) {
}
void SpatialEditorPlugin::edited_scene_changed() {
- for (int i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
+ for (uint32_t i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
SpatialEditorViewport *viewport = SpatialEditor::get_singleton()->get_editor_viewport(i);
if (viewport->is_visible()) {
viewport->notification(Control::NOTIFICATION_VISIBILITY_CHANGED);
@@ -4093,7 +4093,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
for (int j = 0; j < gizmo_plugins.size(); ++j) {
if (!gizmo_plugins[j]->can_be_hidden()) continue;
int state = EditorSpatialGizmoPlugin::ON_TOP;
- for (uint32_t i = 0; i < keys.size(); i++) {
+ for (int i = 0; i < keys.size(); i++) {
if (gizmo_plugins.write[j]->get_name() == keys[i]) {
state = gizmos_status[keys[i]];
}
diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp
index 58a1835e68..c574b5e8ba 100644
--- a/editor/plugins/sprite_editor_plugin.cpp
+++ b/editor/plugins/sprite_editor_plugin.cpp
@@ -97,7 +97,7 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
int lasti = p2->Contour.size() - 1;
Vector2 prev = Vector2(p2->Contour[lasti].X / PRECISION, p2->Contour[lasti].Y / PRECISION);
- for (int i = 0; i < p2->Contour.size(); i++) {
+ for (unsigned int i = 0; i < p2->Contour.size(); i++) {
Vector2 cur = Vector2(p2->Contour[i].X / PRECISION, p2->Contour[i].Y / PRECISION);
if (cur.distance_to(prev) > 0.5) {
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp
index 17af6bff09..425d8db183 100644
--- a/modules/cvtt/image_compress_cvtt.cpp
+++ b/modules/cvtt/image_compress_cvtt.cpp
@@ -118,7 +118,7 @@ static void _digest_row_task(const CVTTCompressionJobParams &p_job_params, const
cvtt::Kernels::EncodeBC7(output_blocks, input_blocks_ldr, p_job_params.options);
}
- int num_real_blocks = ((w - x_start) + 3) / 4;
+ unsigned int num_real_blocks = ((w - x_start) + 3) / 4;
if (num_real_blocks > cvtt::NumParallelBlocks) {
num_real_blocks = cvtt::NumParallelBlocks;
}
@@ -131,7 +131,7 @@ static void _digest_row_task(const CVTTCompressionJobParams &p_job_params, const
static void _digest_job_queue(void *p_job_queue) {
CVTTCompressionJobQueue *job_queue = static_cast<CVTTCompressionJobQueue *>(p_job_queue);
- for (int next_task = atomic_increment(&job_queue->current_task); next_task <= job_queue->num_tasks; next_task = atomic_increment(&job_queue->current_task)) {
+ for (uint32_t next_task = atomic_increment(&job_queue->current_task); next_task <= job_queue->num_tasks; next_task = atomic_increment(&job_queue->current_task)) {
_digest_row_task(job_queue->job_params, job_queue->job_tasks[next_task - 1]);
}
}
@@ -335,7 +335,7 @@ void image_decompress_cvtt(Image *p_image) {
uint8_t input_blocks[16 * cvtt::NumParallelBlocks];
memset(input_blocks, 0, sizeof(input_blocks));
- int num_real_blocks = ((w - x_start) + 3) / 4;
+ unsigned int num_real_blocks = ((w - x_start) + 3) / 4;
if (num_real_blocks > cvtt::NumParallelBlocks) {
num_real_blocks = cvtt::NumParallelBlocks;
}
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index a534aec11b..fd17c7b81f 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -174,7 +174,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
PoolVector<uint8_t>::Read r = img->get_data().read();
- int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps());
+ unsigned int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps());
int mmc = 1 + (p_img->has_mipmaps() ? Image::get_image_required_mipmaps(imgw, imgh, etc_format) : 0);
PoolVector<uint8_t> dst_data;
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 48c0fc8aef..f56778b296 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -239,7 +239,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
String additional_code = "extern void register_dynamic_symbol(char *name, void *address);\n"
"extern void add_ios_init_callback(void (*cb)());\n";
String linker_flags = "";
- for (int i = 0; i < sizeof(expected_symbols) / sizeof(expected_symbols[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(expected_symbols) / sizeof(expected_symbols[0]); ++i) {
String full_name = lib->get_symbol_prefix() + expected_symbols[i].name;
String code = declare_pattern.replace("$name", full_name);
code = code.replace("$weak", expected_symbols[i].is_required ? "" : " __attribute__((weak))");
@@ -255,7 +255,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
additional_code += String("void $prefixinit() {\n").replace("$prefix", lib->get_symbol_prefix());
String register_pattern = " if (&$name) register_dynamic_symbol((char *)\"$name\", (void *)$name);\n";
- for (int i = 0; i < sizeof(expected_symbols) / sizeof(expected_symbols[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(expected_symbols) / sizeof(expected_symbols[0]); ++i) {
String full_name = lib->get_symbol_prefix() + expected_symbols[i].name;
additional_code += register_pattern.replace("$name", full_name);
}
diff --git a/modules/opensimplex/simplex_noise.cpp b/modules/opensimplex/simplex_noise.cpp
index e489b7f6f0..c99fd7b123 100644
--- a/modules/opensimplex/simplex_noise.cpp
+++ b/modules/opensimplex/simplex_noise.cpp
@@ -196,7 +196,7 @@ float SimplexNoise::get_noise_2d(float x, float y) {
float max = 1.0;
float sum = _get_octave_noise_2d(0, x, y);
- unsigned int i = 0;
+ int i = 0;
while (++i < octaves) {
x *= lacunarity;
y *= lacunarity;
@@ -218,7 +218,7 @@ float SimplexNoise::get_noise_3d(float x, float y, float z) {
float max = 1.0;
float sum = _get_octave_noise_3d(0, x, y, z);
- unsigned int i = 0;
+ int i = 0;
while (++i < octaves) {
x *= lacunarity;
y *= lacunarity;
@@ -242,7 +242,7 @@ float SimplexNoise::get_noise_4d(float x, float y, float z, float w) {
float max = 1.0;
float sum = _get_octave_noise_4d(0, x, y, z, w);
- unsigned int i = 0;
+ int i = 0;
while (++i < octaves) {
x *= lacunarity;
y *= lacunarity;
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 6ec7d27464..4fba811cc2 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1082,7 +1082,7 @@ public:
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_large"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_xlarge"), true));
- for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icons[i].option_id, PROPERTY_HINT_FILE, "*.png"), ""));
}
@@ -1486,7 +1486,7 @@ public:
if (file == "res/drawable/icon.png") {
bool found = false;
- for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges();
if (icon_path != "" && icon_path.ends_with(".png")) {
FileAccess *f = FileAccess::open(icon_path, FileAccess::READ);
@@ -1620,7 +1620,7 @@ public:
APKExportData ed;
ed.ep = &ep;
ed.apk = unaligned_apk;
- for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges();
if (icon_path != "" && icon_path.ends_with(".png") && FileAccess::exists(icon_path)) {
Vector<uint8_t> data = FileAccess::get_file_as_array(icon_path);
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index aae9d97a28..63bc4a519b 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -203,7 +203,7 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_40x40", PROPERTY_HINT_FILE, "*.png"), "")); // Spotlight
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_80x80", PROPERTY_HINT_FILE, "*.png"), "")); // Spotlight on devices with retina display
- for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, loading_screen_infos[i].preset_key, PROPERTY_HINT_FILE, "*.png"), ""));
}
@@ -353,7 +353,7 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr
DirAccess *da = DirAccess::open(p_iconset_dir);
ERR_FAIL_COND_V(!da, ERR_CANT_OPEN);
- for (int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) {
+ for (unsigned int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) {
IconInfo info = icon_infos[i];
String icon_path = p_preset->get(info.preset_key);
if (icon_path.length() == 0) {
@@ -403,7 +403,7 @@ Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPre
DirAccess *da = DirAccess::open(p_dest_dir);
ERR_FAIL_COND_V(!da, ERR_CANT_OPEN);
- for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
LoadingScreenInfo info = loading_screen_infos[i];
String loading_screen_file = p_preset->get(info.preset_key);
if (loading_screen_file.size() > 0) {
@@ -490,7 +490,7 @@ private:
static String _hex_pad(uint32_t num) {
Vector<char> ret;
ret.resize(sizeof(num) * 2);
- for (int i = 0; i < sizeof(num) * 2; ++i) {
+ for (unsigned int i = 0; i < sizeof(num) * 2; ++i) {
uint8_t four_bits = (num >> (sizeof(num) * 8 - (i + 1) * 4)) & 0xF;
ret.write[i] = _hex_char(four_bits);
}
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 386f2a4348..b1f90b72e7 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -417,7 +417,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
}
}
- for (int k = 0; k < cc; k++) {
+ for (unsigned int k = 0; k < cc; k++) {
output.vol[k] *= multiplier;
}
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 57d0deeb78..9ee85b64b6 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -562,13 +562,13 @@ void AudioStreamSample::save_to_wav(String p_path) {
PoolVector<uint8_t>::Read read_data = get_data().read();
switch (format) {
case AudioStreamSample::FORMAT_8_BITS:
- for (int i = 0; i < data_bytes; i++) {
+ for (unsigned int i = 0; i < data_bytes; i++) {
uint8_t data_point = (read_data[i] + 128);
file->store_8(data_point);
}
break;
case AudioStreamSample::FORMAT_16_BITS:
- for (int i = 0; i < data_bytes / 2; i++) {
+ for (unsigned int i = 0; i < data_bytes / 2; i++) {
uint16_t data_point = decode_uint16(&read_data[i * 2]);
file->store_16(data_point);
}
diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp
index 3ae897c299..38c00f6106 100644
--- a/servers/audio/audio_rb_resampler.cpp
+++ b/servers/audio/audio_rb_resampler.cpp
@@ -153,7 +153,7 @@ bool AudioRBResampler::mix(AudioFrame *p_dest, int p_frames) {
}
// Fill zeros (silence) for the rest of frames
- for (uint32_t i = target_todo; i < p_frames; i++) {
+ for (int i = target_todo; i < p_frames; i++) {
p_dest[i] = AudioFrame(0, 0);
}
}