]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix clang warnings
authorTheodore Ts'o <tytso@mit.edu>
Sat, 23 Jan 2021 05:57:18 +0000 (00:57 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 23 Jan 2021 05:57:18 +0000 (00:57 -0500)
Clang gets unhappy when passing an unsigned char to string functions.
For better or for worse we use __u8[] in the definition of the
superblock.  So cast them these to "char *" to prevent clang
build-time warnings.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/unix.c
lib/ext2fs/mmp.c
misc/e2fuzz.c
misc/mke2fs.c

index 1b7ccea95189863db61a7ec6405e2dc10faaaa13..df3f4d77248c489afc4b5bbc1142d0582ec866a9 100644 (file)
@@ -1693,7 +1693,7 @@ failure:
         * or informational messages to the user.
         */
        if (ctx->device_name == 0 && sb->s_volume_name[0])
-               ctx->device_name = string_copy(ctx, sb->s_volume_name,
+               ctx->device_name = string_copy(ctx, (char *) sb->s_volume_name,
                                               sizeof(sb->s_volume_name));
 
        if (ctx->device_name == 0)
index 223b617d93139de8245adcc694258a2c589969bf..c21ae272f0e3b8ed2dde78ad426b3647e7e75d06 100644 (file)
@@ -212,11 +212,11 @@ static errcode_t ext2fs_mmp_reset(ext2_filsys fs)
        mmp_s->mmp_seq = EXT4_MMP_SEQ_CLEAN;
        mmp_s->mmp_time = 0;
 #ifdef HAVE_GETHOSTNAME
-       gethostname(mmp_s->mmp_nodename, sizeof(mmp_s->mmp_nodename));
+       gethostname((char *) mmp_s->mmp_nodename, sizeof(mmp_s->mmp_nodename));
 #else
        mmp_s->mmp_nodename[0] = '\0';
 #endif
-       strncpy(mmp_s->mmp_bdevname, fs->device_name,
+       strncpy((char *) mmp_s->mmp_bdevname, fs->device_name,
                sizeof(mmp_s->mmp_bdevname));
 
        mmp_s->mmp_check_interval = fs->super->s_mmp_update_interval;
@@ -354,11 +354,11 @@ clean_seq:
 
        mmp_s->mmp_seq = seq = ext2fs_mmp_new_seq();
 #ifdef HAVE_GETHOSTNAME
-       gethostname(mmp_s->mmp_nodename, sizeof(mmp_s->mmp_nodename));
+       gethostname((char *) mmp_s->mmp_nodename, sizeof(mmp_s->mmp_nodename));
 #else
        strcpy(mmp_s->mmp_nodename, "unknown host");
 #endif
-       strncpy(mmp_s->mmp_bdevname, fs->device_name,
+       strncpy((char *) mmp_s->mmp_bdevname, fs->device_name,
                sizeof(mmp_s->mmp_bdevname));
 
        retval = ext2fs_mmp_write(fs, fs->super->s_mmp_block, fs->mmp_buf);
index 685cdbe297bd954698920d1d59624f8cda181e4e..8694aa8615d1926ebfc77016feadc184389a362d 100644 (file)
@@ -173,7 +173,8 @@ static uint64_t rand_num(uint64_t min, uint64_t max)
        for (i = 0; i < sizeof(x); i++)
                px[i] = random();
 
-       return min + (uint64_t)((double)(max - min) * (x / (UINT64_MAX + 1.0)));
+       return min + (uint64_t)((double)(max - min) *
+                               (x / ((double) UINT64_MAX + 1.0)));
 }
 
 static int process_fs(const char *fsname)
index 0dffec33018f2b1c48d7e11073332350ce6664ca..edab068103a8df8d6c97fe1e1823ba0d36b399c2 100644 (file)
@@ -3174,7 +3174,7 @@ int main (int argc, char *argv[])
        if (volume_label) {
                memset(fs->super->s_volume_name, 0,
                       sizeof(fs->super->s_volume_name));
-               strncpy(fs->super->s_volume_name, volume_label,
+               strncpy((char *) fs->super->s_volume_name, volume_label,
                        sizeof(fs->super->s_volume_name));
        }
 
@@ -3184,7 +3184,7 @@ int main (int argc, char *argv[])
        if (mount_dir) {
                memset(fs->super->s_last_mounted, 0,
                       sizeof(fs->super->s_last_mounted));
-               strncpy(fs->super->s_last_mounted, mount_dir,
+               strncpy((char *) fs->super->s_last_mounted, mount_dir,
                        sizeof(fs->super->s_last_mounted));
        }