Commit 54c7a2b0 by Milan Broz

Fix signed/unsigned compiler warnings.

parent 9cabc9bf
......@@ -46,7 +46,7 @@ struct crypt_cipher {
struct cipher_alg {
const char *name;
unsigned int blocksize;
int blocksize;
};
/* FIXME: Getting block size should be dynamic from cipher backend. */
......
......@@ -85,7 +85,7 @@ static int crypt_sector_iv_init(struct crypt_sector_iv *ctx,
return -EINVAL;
hash_size = crypt_hash_size(++hash_name);
if (hash_size < 0 || hash_size > sizeof(tmp))
if (hash_size < 0 || (unsigned)hash_size > sizeof(tmp))
return -EINVAL;
if (crypt_hash_init(&h, hash_name))
......@@ -227,7 +227,8 @@ int crypt_storage_decrypt(struct crypt_storage *ctx,
uint64_t sector, size_t count,
char *buffer)
{
int i, r = 0;
unsigned int i;
int r = 0;
for (i = 0; i < count; i++) {
r = crypt_sector_iv_generate(&ctx->cipher_iv, sector + i);
......@@ -250,7 +251,8 @@ int crypt_storage_encrypt(struct crypt_storage *ctx,
uint64_t sector, size_t count,
char *buffer)
{
int i, r = 0;
unsigned int i;
int r = 0;
for (i = 0; i < count; i++) {
r = crypt_sector_iv_generate(&ctx->cipher_iv, sector + i);
......
......@@ -161,7 +161,7 @@ static int device_check(struct reenc_ctx *rc, header_magic set_magic)
}
s = read(devfd, buf, buf_size);
if (s < 0 || s != buf_size) {
if (s < 0 || s != (ssize_t)buf_size) {
log_err(_("Cannot read device %s.\n"), rc->device);
r = -EIO;
goto out;
......@@ -193,7 +193,7 @@ static int device_check(struct reenc_ctx *rc, header_magic set_magic)
if (lseek(devfd, 0, SEEK_SET) == -1)
goto out;
s = write(devfd, buf, buf_size);
if (s < 0 || s != buf_size) {
if (s < 0 || s != (ssize_t)buf_size) {
log_err(_("Cannot write device %s.\n"), rc->device);
r = -EIO;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment