1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-25 18:50:51 +03:00

Fix some unmatching sign comparation gcc warnings

Simple replacement for unsigned type - usually in for() loops.
This commit is contained in:
Zdenek Kabelac 2011-04-08 14:40:18 +00:00
parent 2c5827076b
commit a1eba521e3
18 changed files with 30 additions and 26 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.85 -
===================================
Fix some unmatching sign comparation gcc warnings in the code.
Allow lv_extend() to work on zero length intrinsically layered LVs.
Keep the cache content when the exported vg buffer is matching.
Extend the set of memory regions, that are not locked to memory.

View File

@ -377,7 +377,7 @@ static int restart_clvmd(void)
/* Propogate debug options */
if (clvmd_get_debug()) {
if (!(debug_arg = malloc(16)) ||
dm_snprintf(debug_arg, 16, "-d%d", (int)clvmd_get_debug()) < 0)
dm_snprintf(debug_arg, 16, "-d%u", clvmd_get_debug()) < 0)
goto_out;
argv[argc++] = debug_arg;
debug_arg = NULL;

View File

@ -2157,7 +2157,7 @@ static struct local_client *find_client(int clientid)
{
struct local_client *thisfd;
for (thisfd = &local_client_head; thisfd != NULL; thisfd = thisfd->next) {
if (thisfd->fd == ntohl(clientid))
if (thisfd->fd == (int)ntohl(clientid))
return thisfd;
}
return NULL;

View File

@ -80,7 +80,7 @@ static int _send_request(const char *inbuf, int inlen, char **retbuf, int no_res
char outbuf[PIPE_BUF];
struct clvm_header *outheader = (struct clvm_header *) outbuf;
int len;
int off;
unsigned off;
int buflen;
int err;

View File

@ -327,7 +327,7 @@ static void _del_fs_op(struct fs_op_parms *fsp)
/* Check if there is other the type of fs operation stacked */
static int _other_fs_ops(fs_op_t type)
{
int i;
unsigned i;
for (i = 0; i < NUM_FS_OPS; i++)
if (type != i && _count_fs_ops[i])

View File

@ -42,7 +42,8 @@ int dev_is_swap(struct device *dev, uint64_t *signature)
{
char buf[10];
uint64_t size;
int page, ret = 0;
unsigned page;
int ret = 0;
if (!dev_get_size(dev, &size)) {
stack;

View File

@ -100,7 +100,7 @@ static int _send_request(char *inbuf, int inlen, char **retbuf)
char outbuf[PIPE_BUF] __attribute__((aligned(8)));
struct clvm_header *outheader = (struct clvm_header *) outbuf;
int len;
int off;
unsigned off;
int buflen;
int err;

View File

@ -976,7 +976,7 @@ static int _for_each_pv(struct cmd_context *cmd, struct logical_volume *lv,
(le - seg->le) / area_multiple,
area_len, NULL, max_seg_len, 0,
(stripes_per_mimage == 1) && only_single_area_segments ? 1U : 0U,
top_level_area_index != -1 ? top_level_area_index : (int) s * stripes_per_mimage,
(top_level_area_index != -1) ? top_level_area_index : (int) (s * stripes_per_mimage),
only_single_area_segments, fn,
data)))
stack;

View File

@ -1987,7 +1987,7 @@ static int _lv_each_dependency(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
{
int i, s;
unsigned i, s;
struct lv_segment *lvseg;
struct logical_volume *deps[] = {
@ -2111,7 +2111,7 @@ static int _lv_mark_if_partial_collect(struct logical_volume *lv, void *data)
static int _lv_mark_if_partial_single(struct logical_volume *lv, void *data)
{
int s;
unsigned s;
struct _lv_mark_if_partial_baton baton;
struct lv_segment *lvseg;
@ -2200,7 +2200,7 @@ static int _lv_validate_references_single(struct logical_volume *lv, void *data)
struct validate_hash *vhash = data;
struct lv_segment *lvseg;
struct physical_volume *pv;
int s;
unsigned s;
int r = 1;
if (lv != dm_hash_lookup_binary(vhash->lvid, &lv->lvid.id[1],

View File

@ -200,7 +200,7 @@ uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
*/
int shift_mirror_images(struct lv_segment *mirrored_seg, unsigned mimage)
{
int i;
unsigned i;
struct lv_segment_area area;
if (mimage >= mirrored_seg->area_count) {
@ -1836,7 +1836,7 @@ int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
int in_sync;
struct logical_volume *log_lv;
struct lvinfo info;
int old_log_count;
unsigned old_log_count;
int r = 0;
if (dm_list_size(&lv->segments) != 1) {

View File

@ -144,7 +144,7 @@ static void _unquote_one_character(char *src, const char orig_char,
* process several characters in one go.
*/
static void _unquote_characters(char *src, const char *orig_chars,
const int num_orig_chars,
size_t num_orig_chars,
const char quote_char,
char *arr_substr_first_unquoted[])
{

View File

@ -151,7 +151,8 @@ static int _maps_line(const struct config_node *cn, lvmlock_t lock,
{
const struct config_value *cv;
long from, to;
int pos, i;
int pos;
unsigned i;
char fr, fw, fx, fp;
size_t sz;

View File

@ -149,7 +149,7 @@ retry_fcntl:
goto fail_close_unlink;
}
if ((write_out == 0) || (write_out < bufferlen)) {
if ((write_out == 0) || ((size_t)write_out < bufferlen)) {
log_error("Cannot write pid to pidfile [%s], shortwrite of"
"[%" PRIsize_t "] bytes, expected [%" PRIsize_t "]\n",
lockfile, write_out, bufferlen);

View File

@ -734,8 +734,8 @@ int dm_report_object(struct dm_report *rh, void *object)
return 0;
}
if ((strlen(field->report_string) > field->props->width))
field->props->width = strlen(field->report_string);
if (((int) strlen(field->report_string) > field->props->width))
field->props->width = (int) strlen(field->report_string);
if ((rh->flags & RH_SORT_REQUIRED) &&
(field->props->flags & FLD_SORT_KEY)) {
@ -775,8 +775,8 @@ static int _report_headings(struct dm_report *rh)
}
dm_list_iterate_items(fp, &rh->field_props) {
if (buf_size < fp->width)
buf_size = fp->width;
if ((int) buf_size < fp->width)
buf_size = (size_t) fp->width;
}
/* Including trailing '\0'! */
buf_size++;

View File

@ -100,7 +100,7 @@ static void _fill_table(struct dm_regex *m, struct rx_node *rx)
static void _create_bitsets(struct dm_regex *m)
{
int i;
unsigned i;
for (i = 0; i < m->num_nodes; i++) {
struct rx_node *n = m->nodes[i];
@ -112,7 +112,7 @@ static void _create_bitsets(struct dm_regex *m)
static void _calc_functions(struct dm_regex *m)
{
int i, j, final = 1;
unsigned i, j, final = 1;
struct rx_node *rx, *c1, *c2;
for (i = 0; i < m->num_nodes; i++) {
@ -253,7 +253,8 @@ static int _calc_states(struct dm_regex *m, struct rx_node *rx)
{
unsigned iwidth = (m->num_charsets / DM_BITS_PER_INT) + 1;
struct dfa_state *dfa;
int i, a;
unsigned i;
int a;
m->tt = ttree_create(m->scratch, iwidth);
if (!m->tt)
@ -314,7 +315,7 @@ struct dm_regex *dm_regex_create(struct dm_pool *mem, const char * const *patter
unsigned num_patterns)
{
char *all, *ptr;
int i;
unsigned i;
size_t len = 0;
struct rx_node *rx;
struct dm_regex *m;

View File

@ -2412,7 +2412,7 @@ static int _dm_deps_disp(struct dm_report *rh, struct dm_pool *mem,
void *private)
{
const struct dm_deps *deps = data;
int i;
unsigned i;
char buf[DM_MAX_TYPE_NAME], *repstr;
if (!dm_pool_begin_object(mem, 16)) {

View File

@ -555,7 +555,7 @@ static int _failed_mirrors_count(struct logical_volume *lv)
{
struct lv_segment *lvseg;
int ret = 0;
int s;
unsigned s;
dm_list_iterate_items(lvseg, &lv->segments) {
if (!seg_is_mirrored(lvseg))

View File

@ -1274,7 +1274,7 @@ static void _close_stray_fds(const char *command)
if (getenv("LVM_SUPPRESS_FD_WARNINGS"))
suppress_warnings = 1;
for (fd = 3; fd < rlim.rlim_cur; fd++)
for (fd = 3; fd < (int)rlim.rlim_cur; fd++)
_close_descriptor(fd, suppress_warnings, command, ppid,
parent_cmdline);
}