1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

gcc: use apropriate type for reading and printing values

This commit is contained in:
Zdenek Kabelac 2020-08-28 19:35:25 +02:00
parent b918afb693
commit ee0cb17608
12 changed files with 16 additions and 16 deletions

View File

@ -205,7 +205,7 @@ static int _get_proc_number(const char *file, const char *name,
}
while (getline(&line, &len, fl) != -1) {
if (sscanf(line, "%d %255s\n", &num, &nm[0]) == 2) {
if (sscanf(line, "%u %255s\n", &num, &nm[0]) == 2) {
if (!strcmp(name, nm)) {
if (number) {
*number = num;

View File

@ -512,7 +512,7 @@ int unmangle_string(const char *str, const char *str_name, size_t len,
int strict = mode != DM_STRING_MANGLING_NONE;
char str_rest[DM_NAME_LEN];
size_t i, j;
int code;
unsigned int code;
int r = 0;
if (!str || !buf)

View File

@ -98,7 +98,7 @@ void dm_pools_check_leaks(void)
p->orig_pool,
p->name, p->stats.bytes);
#else
log_error(" [%p] %s", p, p->name);
log_error(" [%p] %s", (void *)p, p->name);
#endif
}
pthread_mutex_unlock(&_dm_pools_mutex);

View File

@ -737,7 +737,7 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int *
keylen = strlen("scan_lvs:");
if (!strncmp(_hint_line, "scan_lvs:", keylen)) {
int scan_lvs = 0;
unsigned scan_lvs = 0;
if ((sscanf(_hint_line + keylen, "%u", &scan_lvs) != 1) ||
scan_lvs != cmd->scan_lvs) {
log_debug("ignore hints with different or unreadable scan_lvs");

View File

@ -716,7 +716,7 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
dev_name(devl->dev),
(int)MAJOR(devl->dev->dev),
(int)MINOR(devl->dev->dev),
devl->dev->bcache_fd, bb);
devl->dev->bcache_fd, (void *)bb);
ret = _process_block(cmd, f, devl->dev, bb, 0, 0, &is_lvm_device);

View File

@ -5239,9 +5239,9 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
dm_config_destroy(cft);
} else {
if (vg->vg_precommitted)
log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", vg, vg->vg_precommitted);
log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", (void *)vg, (void *)vg->vg_precommitted);
if (vg->vg_committed)
log_error(INTERNAL_ERROR "vg_read vg %p vg_committed %p", vg, vg->vg_committed);
log_error(INTERNAL_ERROR "vg_read vg %p vg_committed %p", (void *)vg, (void *)vg->vg_committed);
}
out:
/* We return with the VG lock held when read is successful. */
@ -5265,9 +5265,9 @@ bad:
*/
if (error_vg && vg) {
if (vg->vg_precommitted)
log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", vg, vg->vg_precommitted);
log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", (void *)vg, (void *)vg->vg_precommitted);
if (vg->vg_committed)
log_error(INTERNAL_ERROR "vg_read vg %p vg_committed %p", vg, vg->vg_committed);
log_error(INTERNAL_ERROR "vg_read vg %p vg_committed %p", (void *)vg, (void *)vg->vg_committed);
/* caller must unlock_vg and release_vg */
*error_vg = vg;

View File

@ -61,7 +61,7 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
dm_list_init(&vg->removed_historical_lvs);
dm_list_init(&vg->removed_pvs);
log_debug_mem("Allocated VG %s at %p.", vg->name ? : "<no name>", vg);
log_debug_mem("Allocated VG %s at %p.", vg->name ? : "<no name>", (void *)vg);
return vg;
}
@ -76,7 +76,7 @@ static void _free_vg(struct volume_group *vg)
return;
}
log_debug_mem("Freeing VG %s at %p.", vg->name ? : "<no name>", vg);
log_debug_mem("Freeing VG %s at %p.", vg->name ? : "<no name>", (void *)vg);
dm_hash_destroy(vg->hostnames);
dm_pool_destroy(vg->vgmem);

View File

@ -232,7 +232,7 @@ static int _maps_line(const struct dm_config_node *cn, lvmlock_t lock,
const char *line, size_t *mstats)
{
const struct dm_config_value *cv;
long from, to;
unsigned long from, to;
int pos;
unsigned i;
char fr, fw, fx, fp;

View File

@ -204,7 +204,7 @@ static int _get_proc_number(const char *file, const char *name,
}
while (getline(&line, &len, fl) != -1) {
if (sscanf(line, "%d %255s\n", &num, &nm[0]) == 2) {
if (sscanf(line, "%u %255s\n", &num, &nm[0]) == 2) {
if (!strcmp(name, nm)) {
if (number) {
*number = num;

View File

@ -510,7 +510,7 @@ int unmangle_string(const char *str, const char *str_name, size_t len,
int strict = mode != DM_STRING_MANGLING_NONE;
char str_rest[DM_NAME_LEN];
size_t i, j;
int code;
unsigned int code;
int r = 0;
if (!str || !buf)

View File

@ -403,7 +403,7 @@ static int _stats_bound(const struct dm_stats *dms)
if (dms->bind_major > 0 || dms->bind_name || dms->bind_uuid)
return 1;
/* %p format specifier expects a void pointer. */
log_error("Stats handle at %p is not bound.", dms);
log_error("Stats handle at %p is not bound.", (const void *)dms);
return 0;
}

View File

@ -98,7 +98,7 @@ void dm_pools_check_leaks(void)
p->orig_pool,
p->name, p->stats.bytes);
#else
log_error(" [%p] %s", p, p->name);
log_error(" [%p] %s", (void *)p, p->name);
#endif
}
pthread_mutex_unlock(&_dm_pools_mutex);