diff options
author | Theodore Ts'o <tytso@mit.edu> | 2021-01-23 00:57:18 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2021-01-23 00:57:18 -0500 |
commit | b3f288ed9fbb1b12c67fd00860f286a800427125 (patch) | |
tree | 1fb36d15dc32b562a5f5e6358121f78663931053 | |
parent | b1b864b398b2b7bc2ca54aca91b7abb1acee321d (diff) | |
download | e2fsprogs-b3f288ed9fbb1b12c67fd00860f286a800427125.tar.gz |
Fix clang warnings
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>
-rw-r--r-- | e2fsck/unix.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/mmp.c | 8 | ||||
-rw-r--r-- | misc/e2fuzz.c | 3 | ||||
-rw-r--r-- | misc/mke2fs.c | 4 |
4 files changed, 9 insertions, 8 deletions
diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 1b7ccea95..df3f4d772 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -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) diff --git a/lib/ext2fs/mmp.c b/lib/ext2fs/mmp.c index 223b617d9..c21ae272f 100644 --- a/lib/ext2fs/mmp.c +++ b/lib/ext2fs/mmp.c @@ -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); diff --git a/misc/e2fuzz.c b/misc/e2fuzz.c index 685cdbe29..8694aa861 100644 --- a/misc/e2fuzz.c +++ b/misc/e2fuzz.c @@ -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) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 0dffec330..edab06810 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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)); } |