Fix gcc warnings in tests.

This commit is contained in:
Milan Broz
2022-02-24 15:40:26 +01:00
parent 12c35da768
commit 0085985419
3 changed files with 6 additions and 3 deletions

View File

@@ -96,6 +96,9 @@ void xlog(const char *msg, const char *tst, const char *func, int line, const ch
#define CRYPT_FREE(x) do { crypt_free(x); x = NULL; } while (0) #define CRYPT_FREE(x) do { crypt_free(x); x = NULL; } while (0)
/* to silent clang -Wcast-align when working with byte arrays */
#define VOIDP_CAST(x) (x)(void*)
#define DMDIR "/dev/mapper/" #define DMDIR "/dev/mapper/"
#define TST_SECTOR_SHIFT 9L #define TST_SECTOR_SHIFT 9L

View File

@@ -1370,7 +1370,7 @@ static int check_hash(const char *hash)
static int base64_test(void) static int base64_test(void)
{ {
int i; unsigned int i;
char *s; char *s;
size_t s_len; size_t s_len;

View File

@@ -459,7 +459,7 @@ int t_dm_check_versions(void)
(unsigned)target->version[1], (unsigned)target->version[1],
(unsigned)target->version[2]); (unsigned)target->version[2]);
} }
target = (struct dm_versions *)((char *) target + target->next); target = VOIDP_CAST(struct dm_versions *)((char *) target + target->next);
} while (last_target != target); } while (last_target != target);
r = 0; r = 0;
@@ -518,7 +518,7 @@ int loop_device(const char *loop)
static char *crypt_loop_get_device_old(void) static char *crypt_loop_get_device_old(void)
{ {
char dev[20]; char dev[64];
int i, loop_fd; int i, loop_fd;
struct loop_info64 lo64 = {0}; struct loop_info64 lo64 = {0};