Commit 9ca1ac5a authored by Milan Broz's avatar Milan Broz

Remove another compile warnings.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@515 36d66b0a-2a48-0410-832c-cd162a569da5
parent da784ff5
......@@ -159,7 +159,7 @@ static int _dm_check_versions(void)
(unsigned)target->version[1],
(unsigned)target->version[2]);
}
target = (void *) target + target->next;
target = (struct dm_versions *)((char *) target + target->next);
} while (last_target != target);
dm_task_destroy(dmt);
......@@ -645,7 +645,8 @@ int dm_query_device(const char *name,
struct dm_task *dmt;
struct dm_info dmi;
uint64_t start, length, val64;
char *target_type, *params, *rcipher, *key_, *rdevice, *endp, buffer[3], *tmp_uuid;
char *target_type, *params, *rcipher, *key_, *rdevice, *endp, buffer[3];
const char *tmp_uuid;
void *next = NULL;
int i, r = -EINVAL;
......@@ -738,7 +739,7 @@ int dm_query_device(const char *name,
if (suspended)
*suspended = dmi.suspended;
if (uuid && (tmp_uuid = (char*)dm_task_get_uuid(dmt)) &&
if (uuid && (tmp_uuid = dm_task_get_uuid(dmt)) &&
!strncmp(tmp_uuid, DM_UUID_PREFIX, DM_UUID_PREFIX_LEN))
*uuid = strdup(tmp_uuid + DM_UUID_PREFIX_LEN);
......
......@@ -907,14 +907,14 @@ int crypt_luksAddKey(struct crypt_options *options)
int crypt_luksUUID(struct crypt_options *options)
{
struct crypt_device *cd = NULL;
char *uuid;
const char *uuid;
int r;
r = _crypt_init(&cd, CRYPT_LUKS1, options, 1, 0);
if (r)
return r;
uuid = (char *)crypt_get_uuid(cd);
uuid = crypt_get_uuid(cd);
log_std(cd, "%s\n", uuid ?: "");
crypt_free(cd);
return 0;
......
......@@ -92,7 +92,8 @@ void crypt_safe_free(void *data)
if (!data)
return;
alloc = data - offsetof(struct safe_allocation, data);
alloc = (struct safe_allocation *)
((char *)data - offsetof(struct safe_allocation, data));
memset(data, 0, alloc->size);
......@@ -109,7 +110,8 @@ void *crypt_safe_realloc(void *data, size_t size)
if (new_data && data) {
alloc = data - offsetof(struct safe_allocation, data);
alloc = (struct safe_allocation *)
((char *)data - offsetof(struct safe_allocation, data));
if (size > alloc->size)
size = alloc->size;
......@@ -273,11 +275,6 @@ int crypt_get_key(const char *prompt,
if(read_stdin && isatty(STDIN_FILENO))
return crypt_get_key_tty(prompt, key, key_size, timeout, verify, cd);
if (keyfile_size_max < 0) {
log_err(cd, _("Negative keyfile size not permitted.\n"));
return -EINVAL;
}
if (read_stdin)
log_dbg("STDIN descriptor passphrase entry requested.");
else
......@@ -306,7 +303,7 @@ int crypt_get_key(const char *prompt,
if(S_ISREG(st.st_mode)) {
regular_file = 1;
/* known keyfile size, alloc it in one step */
if (st.st_size >= keyfile_size_max)
if ((size_t)st.st_size >= keyfile_size_max)
buflen = keyfile_size_max;
else
buflen = st.st_size;
......
......@@ -36,13 +36,13 @@
static int opt_verbose = 0;
static int opt_debug = 0;
static char *opt_cipher = NULL;
static char *opt_hash = NULL;
static const char *opt_cipher = NULL;
static const char *opt_hash = NULL;
static int opt_verify_passphrase = 0;
static char *opt_key_file = NULL;
static char *opt_master_key_file = NULL;
static char *opt_header_backup_file = NULL;
static char *opt_uuid = NULL;
static const char *opt_key_file = NULL;
static const char *opt_master_key_file = NULL;
static const char *opt_header_backup_file = NULL;
static const char *opt_uuid = NULL;
static int opt_key_size = 0;
static long opt_keyfile_size = 0;
static long opt_new_keyfile_size = 0;
......@@ -1041,7 +1041,7 @@ static void help(poptContext popt_context,
usage(popt_context, EXIT_SUCCESS, NULL, NULL);
}
static void _dbg_version_and_cmd(int argc, char **argv)
static void _dbg_version_and_cmd(int argc, const char **argv)
{
int i;
......@@ -1091,7 +1091,7 @@ static int run_action(struct action_type *action)
return r;
}
int main(int argc, char **argv)
int main(int argc, const char **argv)
{
static char *popt_tmp;
static struct poptOption popt_help_options[] = {
......@@ -1132,7 +1132,7 @@ int main(int argc, char **argv)
};
poptContext popt_context;
struct action_type *action;
char *aname;
const char *aname;
int r;
const char *null_action_argv[] = {NULL};
......@@ -1142,8 +1142,7 @@ int main(int argc, char **argv)
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
popt_context = poptGetContext(PACKAGE, argc, (const char **)argv,
popt_options, 0);
popt_context = poptGetContext(PACKAGE, argc, argv, popt_options, 0);
poptSetOtherOptionHelp(popt_context,
N_("[OPTION...] <action> <action-specific>]"));
......@@ -1180,7 +1179,7 @@ int main(int argc, char **argv)
exit(EXIT_SUCCESS);
}
if (!(aname = (char *)poptGetArg(popt_context)))
if (!(aname = poptGetArg(popt_context)))
usage(popt_context, EXIT_FAILURE, _("Argument <action> missing."),
poptGetInvocationName(popt_context));
for(action = action_types; action->type; action++)
......@@ -1237,7 +1236,7 @@ int main(int argc, char **argv)
if (opt_key_file)
log_err(_("Option --key-file takes precedence over specified key file argument.\n"));
else
opt_key_file = (char*)action_argv[1];
opt_key_file = action_argv[1];
}
if (opt_keyfile_size < 0 || opt_new_keyfile_size < 0 || opt_key_size < 0) {
......
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