systemd: fix various "-Wcast-align=strict" warnings

This will also be addressed (differently) in systemd ([1]).

[1] https://github.com/systemd/systemd/pull/25636
This commit is contained in:
Thomas Haller 2022-12-01 14:07:22 +01:00
parent 36f8de25c4
commit 68db517808
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
5 changed files with 5 additions and 5 deletions

View file

@ -1303,7 +1303,7 @@ static int client_receive_message(
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SO_TIMESTAMP &&
cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval)))
triple_timestamp_from_realtime(&t, timeval_load((struct timeval*) CMSG_DATA(cmsg)));
triple_timestamp_from_realtime(&t, timeval_load((struct timeval*) (void *) CMSG_DATA(cmsg)));
}
if (client->transaction_id != (message->transaction_id & htobe32(0x00ffffff)))

View file

@ -621,7 +621,7 @@ static int dhcp6_lease_parse_message(
return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL),
"Received information refresh time option with an invalid length (%zu).", optlen);
irt = unaligned_read_be32((be32_t *) optval) * USEC_PER_SEC;
irt = unaligned_read_be32(optval) * USEC_PER_SEC;
break;
}
}

View file

@ -479,7 +479,7 @@ void cmsg_close_all(struct msghdr *mh) {
CMSG_FOREACH(cmsg, mh)
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS)
close_many((int*) CMSG_DATA(cmsg), (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int));
close_many((int*) ((void*) CMSG_DATA(cmsg)), (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int));
}
bool fdname_is_valid(const char *s) {

View file

@ -374,7 +374,7 @@ static void get_hash_key(uint8_t hash_key[HASH_KEY_SIZE], bool reuse_is_ok) {
}
static struct hashmap_base_entry* bucket_at(HashmapBase *h, unsigned idx) {
return (struct hashmap_base_entry*)
return (struct hashmap_base_entry*) (void *)
((uint8_t*) storage_ptr(h) + idx * hashmap_type_info[h->type].entry_size);
}

View file

@ -133,7 +133,7 @@ uint8_t *sha256_finish_ctx(struct sha256_ctx *ctx, uint8_t resbuf[static SHA256_
if (UNALIGNED_P(resbuf))
memcpy(resbuf + i * sizeof(uint32_t), (uint32_t[]) { SWAP(ctx->H[i]) }, sizeof(uint32_t));
else
((uint32_t *) resbuf)[i] = SWAP(ctx->H[i]);
((uint32_t *) (void *) resbuf)[i] = SWAP(ctx->H[i]);
return resbuf;
}