diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-05 11:42:47 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-05 11:42:47 +0200 |
commit | 5b6ccf2fd2c0e01481bad47d4403e7173476bfe2 (patch) | |
tree | 9b12a6a603d21f6e0feee43a7c06f031e0fd284d /drivers | |
parent | 33f4c5282f3f6f64cd97c30978d130b6efbc94ce (diff) | |
parent | 2233624152a3b041daeab8b0fd88a2061b7b8565 (diff) |
Merge pull request #66720 from qarmin/unintialized_memory
Remove usage of unitialized variables
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.h | 4 | ||||
-rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.h | 4 | ||||
-rw-r--r-- | drivers/unix/dir_access_unix.cpp | 12 | ||||
-rw-r--r-- | drivers/unix/file_access_unix.cpp | 8 |
4 files changed, 14 insertions, 14 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h index 372ac00493..15556e3193 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.h +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -235,14 +235,14 @@ public: GLuint vertex_buffer; GLuint vertex_array; GLuint index_buffer; - int count; + int count = 0; bool color_disabled = false; Color color; }; struct { HashMap<PolygonID, PolygonBuffers> polygons; - PolygonID last_id; + PolygonID last_id = 0; } polygon_buffers; RendererCanvasRender::PolygonID request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>()) override; diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.h b/drivers/pulseaudio/audio_driver_pulseaudio.h index 85e328b49f..ae6e0acc97 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.h +++ b/drivers/pulseaudio/audio_driver_pulseaudio.h @@ -48,8 +48,8 @@ class AudioDriverPulseAudio : public AudioDriver { pa_context *pa_ctx = nullptr; pa_stream *pa_str = nullptr; pa_stream *pa_rec_str = nullptr; - pa_channel_map pa_map; - pa_channel_map pa_rec_map; + pa_channel_map pa_map = {}; + pa_channel_map pa_rec_map = {}; String device_name = "Default"; String new_device = "Default"; diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index c25ceba44d..d894ceba59 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -71,7 +71,7 @@ bool DirAccessUnix::file_exists(String p_file) { p_file = fix_path(p_file); - struct stat flags; + struct stat flags = {}; bool success = (stat(p_file.utf8().get_data(), &flags) == 0); if (success && S_ISDIR(flags.st_mode)) { @@ -90,7 +90,7 @@ bool DirAccessUnix::dir_exists(String p_dir) { p_dir = fix_path(p_dir); - struct stat flags; + struct stat flags = {}; bool success = (stat(p_dir.utf8().get_data(), &flags) == 0); return (success && S_ISDIR(flags.st_mode)); @@ -125,7 +125,7 @@ uint64_t DirAccessUnix::get_modified_time(String p_file) { p_file = fix_path(p_file); - struct stat flags; + struct stat flags = {}; bool success = (stat(p_file.utf8().get_data(), &flags) == 0); if (success) { @@ -158,7 +158,7 @@ String DirAccessUnix::get_next() { if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK) { String f = current_dir.path_join(fname); - struct stat flags; + struct stat flags = {}; if (stat(f.utf8().get_data(), &flags) == 0) { _cisdir = S_ISDIR(flags.st_mode); } else { @@ -412,7 +412,7 @@ Error DirAccessUnix::remove(String p_path) { p_path = fix_path(p_path); - struct stat flags; + struct stat flags = {}; if ((stat(p_path.utf8().get_data(), &flags) != 0)) { return FAILED; } @@ -431,7 +431,7 @@ bool DirAccessUnix::is_link(String p_file) { p_file = fix_path(p_file); - struct stat flags; + struct stat flags = {}; if ((lstat(p_file.utf8().get_data(), &flags) != 0)) { return FAILED; } diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 0df645c4e5..0b80fb1491 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -86,7 +86,7 @@ Error FileAccessUnix::open_internal(const String &p_path, int p_mode_flags) { backend (unix-compatible mostly) supports utf8 encoding */ //printf("opening %s as %s\n", p_path.utf8().get_data(), path.utf8().get_data()); - struct stat st; + struct stat st = {}; int err = stat(path.utf8().get_data(), &st); if (!err) { switch (st.st_mode & S_IFMT) { @@ -252,7 +252,7 @@ void FileAccessUnix::store_buffer(const uint8_t *p_src, uint64_t p_length) { bool FileAccessUnix::file_exists(const String &p_path) { int err; - struct stat st; + struct stat st = {}; String filename = fix_path(p_path); // Does the name exist at all? @@ -284,7 +284,7 @@ bool FileAccessUnix::file_exists(const String &p_path) { uint64_t FileAccessUnix::_get_modified_time(const String &p_file) { String file = fix_path(p_file); - struct stat flags; + struct stat flags = {}; int err = stat(file.utf8().get_data(), &flags); if (!err) { @@ -297,7 +297,7 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) { uint32_t FileAccessUnix::_get_unix_permissions(const String &p_file) { String file = fix_path(p_file); - struct stat flags; + struct stat flags = {}; int err = stat(file.utf8().get_data(), &flags); if (!err) { |