clang: fix -Wconditional-uninitialized warnings

../../../src/filemanager/file.c:2402:61: warning: variable 'attrs' may be uninitialized when used here [-Wconditional-uninitialized]
                while (attrs_ok && mc_fsetflags (dst_vpath, attrs) != 0 && !ctx->skip_all)
                                                            ^~~~~
../../../src/filemanager/file.c:2266:24: note: initialize the variable 'attrs' to silence this warning
    unsigned long attrs;
                       ^
                        = 0

../../../src/filemanager/file.c:3227:38: warning: variable 'attrs' may be uninitialized when used here [-Wconditional-uninitialized]
            mc_fsetflags (dst_vpath, attrs);
                                     ^~~~~
../../../src/filemanager/file.c:2942:24: note: initialize the variable 'attrs' to silence this warning
    unsigned long attrs;
                       ^
                        = 0

../../../lib/strutil/tokenize.c:163:44: warning: variable 'delimopen' may be uninitialized when used here [-Wconditional-uninitialized]
        if (nestdelim != 0 && string[i] == delimopen)
                                           ^~~~~~~~~
../../../lib/strutil/tokenize.c:72:19: note: initialize the variable 'delimopen' to silence this warning
    char delimopen;
                  ^
                   = '\0'

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Yury V. Zaytsev 2024-05-30 21:20:48 +02:00 committed by Andrew Borodin
parent b76569d5ee
commit 04496c6fc1
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ str_tokenize_word (const char *string, int start)
{
int i = start;
char delimiter = '\0';
char delimopen;
char delimopen = '\0';
int nestdelim = 0;
if (member (string[i], "()\n")) /* XXX - included \n, but why? been here forever */

View File

@ -2263,7 +2263,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
mode_t src_mode = 0; /* The mode of the source file */
struct stat src_stat, dst_stat;
mc_timesbuf_t times;
unsigned long attrs;
unsigned long attrs = 0;
gboolean attrs_ok = ctx->preserve;
gboolean dst_exists = FALSE, appending = FALSE;
off_t file_size = -1;
@ -2941,7 +2941,7 @@ copy_dir_dir (file_op_total_context_t * tctx, file_op_context_t * ctx, const cha
{
struct vfs_dirent *next;
struct stat dst_stat, src_stat;
unsigned long attrs;
unsigned long attrs = 0;
gboolean attrs_ok = ctx->preserve;
DIR *reading;
FileProgressStatus return_status = FILE_CONT;