summaryrefslogtreecommitdiff
path: root/drivers/unix
diff options
context:
space:
mode:
authorRafał Mikrut <mikrutrafal@protonmail.com>2022-10-01 21:09:22 +0200
committerRafał Mikrut <mikrutrafal@protonmail.com>2022-10-01 21:09:22 +0200
commit2233624152a3b041daeab8b0fd88a2061b7b8565 (patch)
tree27b6bc31c38e0629a23ea6142f54724045aa2bc5 /drivers/unix
parent24115beb3c69e648b1d48f969785b9b0729e1be8 (diff)
Remove usage of unitialized variables
Diffstat (limited to 'drivers/unix')
-rw-r--r--drivers/unix/dir_access_unix.cpp12
-rw-r--r--drivers/unix/file_access_unix.cpp8
2 files changed, 10 insertions, 10 deletions
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 55ea952696..3ad183a78e 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -74,7 +74,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)) {
@@ -93,7 +93,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));
@@ -128,7 +128,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) {
@@ -161,7 +161,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 {
@@ -415,7 +415,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;
}
@@ -434,7 +434,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 388ad479b9..9f85e894ff 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -96,7 +96,7 @@ Error FileAccessUnix::_open(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) {
@@ -267,7 +267,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?
@@ -299,7 +299,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) {
@@ -312,7 +312,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) {