Reacted on -Wsign-compare warnings of gcc

This commit is contained in:
Thomas Schmitt 2011-05-09 18:12:16 +00:00
parent 31300231df
commit 37987ecfe6
14 changed files with 52 additions and 48 deletions

View File

@ -429,7 +429,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
if(xorriso->img_read_error_mode==2)
sev= "FATAL";
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, sev, 0);
if(read_ret == ISO_SB_TREE_CORRUPTED && (xorriso->do_md5 & 1)) {
if(read_ret == (int) ISO_SB_TREE_CORRUPTED && (xorriso->do_md5 & 1)) {
Xorriso_msgs_submit(xorriso, 0,
"This might be false MD5 alarm if an add-on session was written by growisofs.",
0, "HINT", 0);
@ -1113,14 +1113,14 @@ int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
sprintf(xorriso->info_text, "-----------------------------------------------------------------------------\n");
Xorriso_info(xorriso,0);
respt= xorriso->result_line;
for(i= 0; i < drive_count && !(xorriso->request_to_abort); i++) {
for(i= 0; i < (int) drive_count && !(xorriso->request_to_abort); i++) {
if(burn_drive_get_adr(&(drive_list[i]), adr)<=0)
strcpy(adr, "-get_adr_failed-");
Xorriso_process_msg_queues(xorriso,0);
if(strlen(adr)>max_dev_len)
if((int) strlen(adr) > max_dev_len)
max_dev_len= strlen(adr);
}
for(i= 0; i < drive_count && !(xorriso->request_to_abort); i++) {
for(i= 0; i < (int) drive_count && !(xorriso->request_to_abort); i++) {
if(burn_drive_get_adr(&(drive_list[i]), adr)<=0)
strcpy(adr, "-get_adr_failed-");
Xorriso_process_msg_queues(xorriso,0);
@ -1865,21 +1865,23 @@ abort_check:;
if(ctx != NULL) {
for(j= 0; j < to_read; j++) {
lba= i + j + from_lba;
if(lba < md5_start)
if(lba < (uint32_t) md5_start)
continue;
ret= 0;
if(lba > md5_start + 16 &&
if(lba > (uint32_t) (md5_start) + 16 &&
(next_tag == 0 || chain_broken || lba == next_tag)) {
ret= iso_util_decode_md5_tag(data + j * 2048, &tag_type,
&pos, &range_start, &range_size,
&next_tag, tag_md5, !!chain_broken);
}
valid= (ret == 1 || ret == ISO_MD5_AREA_CORRUPTED) && pos == lba;
if(valid && tag_type == 2 && (lba < md5_start + 32 || in_track_gap)) {
valid= (ret == 1 || ret == (int) ISO_MD5_AREA_CORRUPTED) &&
pos == lba;
if(valid && tag_type == 2 && (lba < ((uint32_t) md5_start) + 32 ||
in_track_gap)) {
tag_type_name= "superblock";
was_sb_tag= 1;
if(in_track_gap && range_start != md5_start && range_start < lba &&
lba - range_start <= j) {
if(in_track_gap && range_start != ((uint32_t) md5_start) &&
range_start < lba && lba - range_start <= (uint32_t) j) {
/* Looking for next session : start computing in hindsight.
Session start and superblock tag are supposed to be in the
same 64 kB chunk.
@ -1908,7 +1910,7 @@ abort_check:;
tag_type_name= "";
}
if (tag_type_name[0]) {
if(range_start != md5_start) {
if(range_start != (uint32_t) md5_start) {
sprintf(xorriso->info_text,
"Found MD5 %s tag which covers different data range",
tag_type_name);
@ -1927,7 +1929,7 @@ abort_check:;
}
iso_md5_end(&cloned_ctx, md5);
if(ret == ISO_MD5_AREA_CORRUPTED) {
if(ret == (int) ISO_MD5_AREA_CORRUPTED) {
comparison= "CORRUPTED";
sev_text= "WARNING";
md5_spot_value= Xorriso_read_quality_md5_mismatcH;

View File

@ -377,7 +377,7 @@ int Xorriso_set_filter(struct XorrisO *xorriso, void *in_node,
filter_ret = iso_file_add_zisofs_filter(file, 1 | (internal_filter & 2));
if(filter_ret < 0) {
Xorriso_process_msg_queues(xorriso,0);
if(!(internal_filter == 2 && filter_ret == ISO_ZISOFS_WRONG_INPUT))
if(!(internal_filter == 2 && filter_ret == (int) ISO_ZISOFS_WRONG_INPUT))
Xorriso_report_iso_error(xorriso, "", filter_ret,
"Error when setting filter to ISO node", 0, "FAILURE", 1);
}
@ -600,13 +600,13 @@ int Xorriso_status_extf(struct XorrisO *xorriso, char *filter, FILE *fp,
strcpy(xorriso->result_line, "-external_filter ");
Text_shellsafe(extf->cmd->name, line, 1);
if(strlen(line) > maxl)
if((int) strlen(line) > maxl)
continue;
strcat(line, " ");
if(extf->cmd->suffix[0]) {
strcat(line, "suffix=");
Text_shellsafe(extf->cmd->suffix, line, 1);
if(strlen(line) > maxl)
if((int) strlen(line) > maxl)
continue;
strcat(line, ":");
}
@ -619,15 +619,15 @@ int Xorriso_status_extf(struct XorrisO *xorriso, char *filter, FILE *fp,
if(extf->cmd->behavior & 4)
strcat(line, "if_block_reduction:");
sprintf(line + strlen(line), "used=%.f ", (double) extf->cmd->refcount);
if(strlen(line) > maxl)
if((int) strlen(line) > maxl)
continue;
Text_shellsafe(extf->cmd->path, line, 1);
if(strlen(line) > maxl)
if((int) strlen(line) > maxl)
continue;
for(i= 1; i < extf->cmd->argc; i++) {
strcat(line, " ");
Text_shellsafe(extf->cmd->argv[i], line, 1);
if(strlen(line) > maxl)
if((int) strlen(line) > maxl)
break;
}
if(i < extf->cmd->argc)

View File

@ -95,7 +95,7 @@ int Exprnode_new(struct ExprnodE **fnode, struct FindjoB *job,
*fnode= n= TSOB_FELD(struct ExprnodE,1);
if(n == NULL)
return(-1);
for(i= 0; i < sizeof(n->origin); i++)
for(i= 0; i < (int) sizeof(n->origin); i++)
n->origin[i]= 0;
strncpy(n->origin, origin, sizeof(n->origin) - 1);
n->up= up;

View File

@ -770,7 +770,7 @@ no_boot:;
has_isolinux_mbr= 0;
mbr_lba= lb0[432] | (lb0[433] << 8) | (lb0[434] << 16) | (lb0[435] << 24);
mbr_lba/= 4;
if(mbr_lba != xorriso->loaded_boot_bin_lba)
if(mbr_lba != (unsigned int) xorriso->loaded_boot_bin_lba)
has_isolinux_mbr= 0;
if(has_isolinux_mbr) {
for(i= 0; i < 426; i++)

View File

@ -235,12 +235,13 @@ int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume,
ex:;
if(ret<0) {
if(ret == ISO_NODE_NAME_NOT_UNIQUE && (flag & 1)) {
if(ret == (int) ISO_NODE_NAME_NOT_UNIQUE && (flag & 1)) {
iso_dir_get_node(dir, img_name, node);
} else {
Xorriso_process_msg_queues(xorriso,0);
if(ret == ISO_RR_NAME_TOO_LONG || ret == ISO_RR_NAME_RESERVED ||
ret == ISO_RR_PATH_TOO_LONG)
if(ret == (int) ISO_RR_NAME_TOO_LONG ||
ret == (int) ISO_RR_NAME_RESERVED ||
ret == (int) ISO_RR_PATH_TOO_LONG)
namept= nominal_target;
else
namept= nominal_source;
@ -495,7 +496,7 @@ cannot_lstat:;
ret= Xorriso_tree_graft_node(xorriso, volume, dir, srcpt, img_name,
"", img_path, (off_t) 0, (off_t) 0,
&node, 1 | (hide_attrs << 8));
if(ret == ISO_NODE_NAME_NOT_UNIQUE) {
if(ret == (int) ISO_NODE_NAME_NOT_UNIQUE) {
ret= Xoriso_handle_collision(xorriso, NULL, &node, img_path, img_path,
srcpt, img_path,
(!!source_is_dir) | (flag & (64 | 128)));
@ -970,7 +971,7 @@ attach_source:;
ret= Xorriso_tree_graft_node(xorriso, volume, dir, disk_path_pt, apt,
disk_path, img_path, offset, cut_size,
&node, 1 | (flag & 8) | (hide_attrs << 8));
if(ret == ISO_NODE_NAME_NOT_UNIQUE) {
if(ret == (int) ISO_NODE_NAME_NOT_UNIQUE) {
ret= Xoriso_handle_collision(xorriso, boss_iter, &node, img_path,
img_path, disk_path,
disk_path[0] ? disk_path : img_path,
@ -2123,14 +2124,14 @@ int Xorriso_record_dev_inode(struct XorrisO *xorriso, char *disk_path,
hdev= hdev >> 8;
l= i;
*(wpt++)= l;
for(i= 0; i < l; i++)
for(i= 0; i < (int) l; i++)
*(wpt++)= dev >> (8 * (l - i - 1));
hino= ino;
for(i= 0; hino != 0; i++)
hino= hino >> 8;
l= i;
*(wpt++)= l;
for(i= 0; i < l; i++)
for(i= 0; i < (int) l; i++)
*(wpt++)= ino >> (8 * (l - i - 1));
l= wpt - buf;
bufpt= buf;
@ -2147,14 +2148,15 @@ int Xorriso_record_dev_inode(struct XorrisO *xorriso, char *disk_path,
if(di_l <= 0)
{ret= 1; goto ex;}
hino= 0;
for(i= di[0] + 2; i < di_l && i - di[0] - 2 < di[(int) di[0] + 1]; i++)
for(i= di[0] + 2; i < (int) di_l && i - di[0] - 2 < di[(int) di[0] + 1];
i++)
hino= (hino << 8) | ((unsigned char *) di)[i];
if(hino != ino)
{ret= 1; goto ex;}
} else {
if(l != di_l)
{ret= 1; goto ex;}
for(i= 0; i < l; i++)
for(i= 0; i < (int) l; i++)
if(di[i] != buf[i])
{ret= 1; goto ex;}
}

View File

@ -783,7 +783,7 @@ int Xorriso_getfattr(struct XorrisO *xorriso, void *in_node, char *path,
ret= -1; goto ex;
}
}
for(i= 0; i < num_attrs; i++) {
for(i= 0; i < (int) num_attrs; i++) {
if(strlen(names[i]) + value_lengths[i] >= SfileadrL) {
sprintf(xorriso->result_line, "# oversized: name %d , value %d bytes\n",
(int) strlen(names[i]), (int) value_lengths[i]);
@ -948,7 +948,7 @@ int Xorriso_get_attrs(struct XorrisO *xorriso, void *in_node, char *path,
if(!(flag & 8)) {
/* Filter away any non-userspace xattr */;
widx= 0;
for(i= 0; i < *num_attrs; i++) {
for(i= 0; i < (int) *num_attrs; i++) {
if(strncmp((*names)[i], "user.", 5) != 0) {
free((*names)[i]);
(*names)[i]= NULL;

View File

@ -52,7 +52,7 @@ int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag)
if(xorriso->search_mode>=2 && xorriso->search_mode<=4) {
if(xorriso->search_mode==3 || xorriso->search_mode==4) {
l= strlen(adr)+strlen(wd)+1;
if(l*2+2>sizeof(xorriso->reg_expr) || l * 2 + 2 > adr_size) {
if(l * 2 + 2 > ((int) sizeof(xorriso->reg_expr)) || l * 2 + 2 > adr_size){
sprintf(xorriso->info_text,"Search pattern too long");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
@ -101,7 +101,7 @@ int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag)
for(i= 0;i<count;i++) {
npt= strchr(cpt,'/');
if(npt==NULL) {
if(strlen(cpt) >= adr_size)
if((int) strlen(cpt) >= adr_size)
{ret= -1; goto ex;}
strcpy(adr_part,cpt);
} else {

View File

@ -212,7 +212,7 @@ int Decode_date_input_format(struct tm *erg, char *text, int flag)
current_time= time(0);
now= localtime(&current_time);
for(i=0;i<sizeof(struct tm);i++)
for(i= 0; i < (int) sizeof(struct tm); i++)
((char *) erg)[i]= ((char *) now)[i];
l= strlen(text);
@ -890,7 +890,7 @@ int Sregex_resolve_var(char *form, char *vars[][2], int num_vars,
/* look for start mark */
spt= strstr(rpt, start);
if(spt == NULL) {
if((wpt - result) + strlen(rpt) >= result_size)
if((wpt - result) + (int) strlen(rpt) >= result_size)
return(0);
strcpy(wpt, rpt);
wpt+= strlen(wpt);
@ -948,7 +948,7 @@ int Sregex_resolve_var(char *form, char *vars[][2], int num_vars,
if(i < num_vars) {
/* substitute found variable */
l_v= strlen(vars[i][0]);
if((wpt - result) + strlen(vars[i][1]) >= result_size)
if((wpt - result) + (int) strlen(vars[i][1]) >= result_size)
return(0);
strcpy(wpt, vars[i][1]);
rpt= npt + strlen(vars[i][0]) + l_e;

View File

@ -390,7 +390,7 @@ int Xorriso_decode_load_adr(struct XorrisO *xorriso, char *cmd,
int Xorriso_check_name_len(struct XorrisO *xorriso, char *name, int size,
char *cmd, int flag)
{
if(strlen(name) >= size) {
if((int) strlen(name) >= size) {
sprintf(xorriso->info_text,
"Name too long with option %s (%d > %d)", cmd,
(int) strlen(name), size - 1);
@ -411,7 +411,7 @@ int Xorriso_normalize_command(struct XorrisO *xorriso, char *original_cmd,
int was_dashed= 0;
char *dash_pt;
if(strlen(original_cmd)>= sizeof_cmd_data) {
if((int) strlen(original_cmd) >= sizeof_cmd_data) {
if(argno>=0)
sprintf(xorriso->info_text, "Oversized argument #%d (length %d)\n",
argno, (int) strlen(original_cmd));

View File

@ -337,7 +337,7 @@ int Sfile_scale(double value, char *result, int siz, double thresh, int flag)
avail_siz= siz-1;
sprintf(form,"%%.f");
sprintf(result,"%.f",value);
if(strlen(result)<=avail_siz-2)
if(((int) strlen(result)) <= avail_siz - 2)
dec_siz= 1; /* we are very modest */
}
if(scale_c=='b' && (flag&1)) {
@ -548,7 +548,7 @@ int Sfile_bsl_encoder(char **result, char *text, size_t text_len, int flag)
int count, sq_open= 0, dq_open= 0;
count= 0;
for(rpt= text; rpt - text < text_len; rpt++) {
for(rpt= text; (size_t) (rpt - text) < text_len; rpt++) {
count++;
if(flag & 8) {
if(!(*rpt <= 42 || (*rpt >= 59 && *rpt <= 63) ||
@ -564,7 +564,7 @@ int Sfile_bsl_encoder(char **result, char *text, size_t text_len, int flag)
(*result)= wpt= calloc(count + 1, 1);
if(wpt == NULL)
return(-1);
for(rpt= text; rpt - text < text_len; rpt++) {
for(rpt= text; (size_t) (rpt - text) < text_len; rpt++) {
if(*rpt == '\'')
sq_open= !(sq_open || dq_open);
if(*rpt == '"')
@ -827,7 +827,7 @@ int Sfile_home_adr_s(char *filename, char *fileadr, int fa_size, int flag)
home= getenv("HOME");
if(home==NULL)
return(0);
if(strlen(home)+strlen(filename)+1>=fa_size)
if((int) (strlen(home) + strlen(filename) + 1) >= fa_size)
return(-1);
strcpy(fileadr,home);
if(filename[0]!=0){
@ -857,7 +857,7 @@ int Sfile_decode_datestr(struct tm *reply, char *text, int flag)
current_time= time(0);
now= localtime(&current_time);
for(i=0;i<sizeof(struct tm);i++)
for(i=0; i < (int) sizeof(struct tm); i++)
((char *) reply)[i]= ((char *) now)[i];
if(text[0]<'0'|| (text[0]>'9' && text[0]<'A') || text[0]>'Z')

View File

@ -167,10 +167,10 @@ int Xorriso__get_di(IsoNode *node, dev_t *dev, ino_t *ino, int flag)
goto ex;
}
vpt= (unsigned char *) value;
for(i= 1; i <= vpt[0] && i < value_length; i++)
for(i= 1; i <= vpt[0] && i < (int) value_length; i++)
*dev= ((*dev) << 8) | vpt[i];
i_end= i + vpt[i] + 1;
for(i++; i < i_end && i < value_length; i++)
for(i++; i < i_end && i < (int) value_length; i++)
*ino= ((*ino) << 8) | vpt[i];
free(value);
ret= 1;

View File

@ -939,7 +939,7 @@ int Xorriso_msgs_submit(struct XorrisO *xorriso,
sprintf(prefix,"%s%s : ", pfx_list[(flag>>2)&15], sev_text);
li= strlen(prefix);
lt= strlen(msg_text);
if(lt>sizeof(xorriso->info_text)-li-2)
if(lt > ((int) sizeof(xorriso->info_text)) - li - 2)
lt= sizeof(xorriso->info_text)-li-2;
if(msg_text==xorriso->info_text) {
for(i= lt; i>=0; i--)

View File

@ -833,7 +833,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
/* Padding to be done by libisofs, not by libburn.
*/
padding= xorriso->padding / 2048;
if(xorriso->padding > padding * 2048)
if((uint32_t) xorriso->padding > padding * 2048)
padding++;
/*
fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n",

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.05.09.155010"
#define Xorriso_timestamP "2011.05.09.181239"