[1.5] COMP: Fix warnings identified by clang31

openjpeg/libopenjpeg/tcd.c:1884 col 48: warning: comparison of unsigned expressi
on < 0 is always false

openjpeg/applications/codec/j2k_dump.c:362 col 29: warning: equality comparison
with extraneous parentheses

openjpeg/libopenjpeg/jpwl/jpwl_lib.c:680:19: warning: format specifies type 'int
' but the argument has type 'long long' [-Wformat]
    printf("Marker@%d: %X\n", cio_tell(cio) - 2, id);
                   ~^         ~~~~~~~~~~~~~~~~~
                   %lld

openjpeg/applications/jpip/libopenjpip/byte_manager.c:58:63: warning: format spe
cifies type 'long' but the argument has type 'OPJ_OFF_T' (aka 'long long') [-Wfo
rmat]
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %lu)\n", fd, offset
, size);

Author: Hans Johnson <hans-johnson@uiowa.edu>
This commit is contained in:
Mathieu Malaterre 2012-08-24 08:13:17 +00:00
parent bad9a71e77
commit 4935eaf773
4 changed files with 13 additions and 11 deletions

View File

@ -274,12 +274,12 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
fprintf(stderr, "Only one format allowed! Valid format PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA!!\n");
return 1;
}
if(!((parameters->outfile[0] == 0))){
if(!(parameters->outfile[0] == 0)){
fprintf(stderr, "Error: options -ImgDir and -o cannot be used together !!\n");
return 1;
}
}else{
if((parameters->infile[0] == 0) ) {
if( parameters->infile[0] == 0 ) {
fprintf(stderr, "Example: %s -i image.j2k\n",argv[0]);
fprintf(stderr, " Try: %s -h\n",argv[0]);
return 1;

View File

@ -76,13 +76,13 @@ Byte_t fetch_1byte( int fd, long offset)
if( lseek( fd, offset, SEEK_SET)==-1){
fprintf( FCGI_stdout, "Reason: Target broken (seek error)\r\n");
fprintf( FCGI_stderr, "Error: error in fetch_1byte( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_1byte( %d, %lld)\n", fd, offset);
return 0;
}
if( read( fd, &code, 1) != 1){
fprintf( FCGI_stdout, "Reason: Target broken (read error)\r\n");
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %lld)\n", fd, offset);
return 0;
}
return code;
@ -94,7 +94,7 @@ Byte2_t fetch_2bytebigendian( int fd, long offset)
Byte2_t code;
if(!(data = fetch_bytes( fd, offset, 2))){
fprintf( FCGI_stderr, "Error: error in fetch_2bytebigendian( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_2bytebigendian( %d, %lld)\n", fd, offset);
return 0;
}
code = big2(data);
@ -109,7 +109,7 @@ Byte4_t fetch_4bytebigendian( int fd, long offset)
Byte4_t code;
if(!(data = fetch_bytes( fd, offset, 4))){
fprintf( FCGI_stderr, "Error: error in fetch_4bytebigendian( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_4bytebigendian( %d, %lld)\n", fd, offset);
return 0;
}
code = big4(data);
@ -124,7 +124,7 @@ Byte8_t fetch_8bytebigendian( int fd, long offset)
Byte8_t code;
if(!(data = fetch_bytes( fd, offset, 8))){
fprintf( FCGI_stderr, "Error: error in fetch_8bytebigendian( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_8bytebigendian( %d, %lld)\n", fd, offset);
return 0;
}
code = big8(data);

View File

@ -677,7 +677,7 @@ opj_bool jpwl_correct(opj_j2k_t *j2k) {
id = cio_read(cio, 2);
/* details */
printf("Marker@%d: %X\n", cio_tell(cio) - 2, id);
printf("Marker@%lld: %X\n", cio_tell(cio) - 2, id);
/* do an action in response to the read marker */
switch (id) {

View File

@ -1418,13 +1418,15 @@ opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno
int numres2decode;
if (tcd->cp->reduce != 0) {
tcd->image->comps[compno].resno_decoded =
tile->comps[compno].numresolutions - tcd->cp->reduce - 1;
if (tcd->image->comps[compno].resno_decoded < 0) {
if ( tile->comps[compno].numresolutions < ( tcd->cp->reduce - 1 ) ) {
opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. The number of resolutions to remove [%d+1] is higher than the number "
" of resolutions in the original codestream [%d]\nModify the cp_reduce parameter.\n", tcd->cp->reduce, tile->comps[compno].numresolutions);
return OPJ_FALSE;
}
else {
tcd->image->comps[compno].resno_decoded =
tile->comps[compno].numresolutions - tcd->cp->reduce - 1;
}
}
numres2decode = tcd->image->comps[compno].resno_decoded + 1;