[1.5] Fix a bunch of comparison between signed and unsigned integer expressions. Some are still left to decide.

This commit is contained in:
Mathieu Malaterre 2012-03-02 08:44:04 +00:00
parent 24ab49a363
commit 6f314ae48e
20 changed files with 104 additions and 98 deletions

View File

@ -161,7 +161,7 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset)
} }
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[]) box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, const char TBox[])
{ {
Byte8_t pos; Byte8_t pos;
Byte_t *data; Byte_t *data;
@ -221,7 +221,7 @@ box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[
return NULL; return NULL;
} }
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, char TBox[]) box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, const char TBox[])
{ {
Byte8_t pos; Byte8_t pos;
Byte_t *data; Byte_t *data;
@ -272,7 +272,7 @@ box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset)
return gene_boxbyOffset( superbox->fd, get_DBoxoff( superbox)+offset); return gene_boxbyOffset( superbox->fd, get_DBoxoff( superbox)+offset);
} }
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, char TBox[]) box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, const char TBox[])
{ {
return gene_boxbyType( superbox->fd, get_DBoxoff( superbox)+offset, get_DBoxlen( superbox)-offset, TBox); return gene_boxbyType( superbox->fd, get_DBoxoff( superbox)+offset, get_DBoxlen( superbox)-offset, TBox);
} }
@ -317,7 +317,7 @@ Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset)
return fetch_8bytebigendian( box->fd, get_DBoxoff( box)+offset); return fetch_8bytebigendian( box->fd, get_DBoxoff( box)+offset);
} }
box_param_t * search_box( char type[], boxlist_param_t *boxlist) box_param_t * search_box( const char type[], boxlist_param_t *boxlist)
{ {
box_param_t *foundbox; box_param_t *foundbox;

View File

@ -97,7 +97,7 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset);
* @param[in] TBox Box Type * @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters * @return pointer to the structure of generate/found box parameters
*/ */
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[]); box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, const char TBox[]);
/** /**
* generate(search) box from code stream * generate(search) box from code stream
@ -108,7 +108,7 @@ box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[
* @param[in] TBox Box Type * @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters * @return pointer to the structure of generate/found box parameters
*/ */
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, char TBox[]); box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, const char TBox[]);
/** /**
* generate child box from JP2 file at the given offset * generate child box from JP2 file at the given offset
@ -127,7 +127,7 @@ box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset);
* @param[in] TBox Box Type * @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters * @return pointer to the structure of generate/found box parameters
*/ */
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, char TBox[]); box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, const char TBox[]);
/** /**
* get DBox offset * get DBox offset
@ -210,7 +210,7 @@ Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset);
* @param[in] boxlist box list pointer * @param[in] boxlist box list pointer
* @return found box pointer * @return found box pointer
*/ */
box_param_t * search_box( char type[], boxlist_param_t *boxlist); box_param_t * search_box( const char type[], boxlist_param_t *boxlist);
/** /**
* print box parameters * print box parameters

View File

@ -41,7 +41,7 @@
#define FCGI_stdout stdout #define FCGI_stdout stdout
#define FCGI_stderr stderr #define FCGI_stderr stderr
#define logstream stderr #define logstream stderr
#endif //SERVER #endif /*SERVER*/
boxheader_param_t * gene_boxheader( int fd, Byte8_t offset) boxheader_param_t * gene_boxheader( int fd, Byte8_t offset)
@ -55,7 +55,7 @@ boxheader_param_t * gene_boxheader( int fd, Byte8_t offset)
boxtype = (char *)fetch_bytes( fd, offset+4, 4); boxtype = (char *)fetch_bytes( fd, offset+4, 4);
headlen = 8; headlen = 8;
if( boxlen == 1){ // read XLBox if( boxlen == 1){ /* read XLBox */
boxlen = fetch_8bytebigendian( fd, offset+8); boxlen = fetch_8bytebigendian( fd, offset+8);
headlen = 16; headlen = 16;
} }

View File

@ -38,7 +38,7 @@ typedef unsigned char Byte_t;
typedef unsigned short int Byte2_t; typedef unsigned short int Byte2_t;
/** 4Byte parameter type*/ /** 4Byte parameter type*/
typedef unsigned int Byte4_t; typedef unsigned int Byte4_t; /* FIXME: Is this portable ? */
/** 8Byte parameter type*/ /** 8Byte parameter type*/
typedef unsigned long long int Byte8_t; typedef unsigned long long int Byte8_t;

View File

@ -40,10 +40,10 @@
#define FCGI_stdout stdout #define FCGI_stdout stdout
#define FCGI_stderr stderr #define FCGI_stderr stderr
#define logstream stderr #define logstream stderr
#endif //SERVER #endif /*SERVER*/
cachemodellist_param_t * gene_cachemodellist() cachemodellist_param_t * gene_cachemodellist(void)
{ {
cachemodellist_param_t *cachemodellist; cachemodellist_param_t *cachemodellist;
@ -73,7 +73,7 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
cachemodel->jppstream = true; cachemodel->jppstream = true;
else else
cachemodel->jppstream = false; cachemodel->jppstream = false;
} else{ // reqJPT } else{ /* reqJPT */
if( target->jptstream) if( target->jptstream)
cachemodel->jppstream = false; cachemodel->jppstream = false;
else else
@ -95,9 +95,9 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
cachemodel->next = NULL; cachemodel->next = NULL;
if( cachemodellist){ if( cachemodellist){
if( cachemodellist->first) // there are one or more entries if( cachemodellist->first) /* there are one or more entries */
cachemodellist->last->next = cachemodel; cachemodellist->last->next = cachemodel;
else // first entry else /* first entry */
cachemodellist->first = cachemodel; cachemodellist->first = cachemodel;
cachemodellist->last = cachemodel; cachemodellist->last = cachemodel;
} }
@ -112,9 +112,10 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
void print_cachemodel( cachemodel_param_t cachemodel) void print_cachemodel( cachemodel_param_t cachemodel)
{ {
target_param_t *target; target_param_t *target;
Byte8_t TPnum; // num of tile parts in each tile Byte8_t TPnum; /* num of tile parts in each tile */
Byte8_t Pmax; // max num of packets per tile Byte8_t Pmax; /* max num of packets per tile */
int i, j, k, n; Byte8_t i, j, k;
int n; /* FIXME: Is this large enough ? */
target = cachemodel.target; target = cachemodel.target;
@ -135,9 +136,9 @@ void print_cachemodel( cachemodel_param_t cachemodel)
fprintf( logstream, "\t tile header and precinct packet model:\n"); fprintf( logstream, "\t tile header and precinct packet model:\n");
for( i=0; i<target->codeidx->SIZ.XTnum*target->codeidx->SIZ.YTnum; i++){ for( i=0; i<target->codeidx->SIZ.XTnum*target->codeidx->SIZ.YTnum; i++){
fprintf( logstream, "\t tile.%d %d\n", i, cachemodel.th_model[i]); fprintf( logstream, "\t tile.%llud %d\n", i, cachemodel.th_model[i]);
for( j=0; j<target->codeidx->SIZ.Csiz; j++){ for( j=0; j<target->codeidx->SIZ.Csiz; j++){
fprintf( logstream, "\t compo.%d: ", j); fprintf( logstream, "\t compo.%llud: ", j);
Pmax = get_nmax( target->codeidx->precpacket[j]); Pmax = get_nmax( target->codeidx->precpacket[j]);
for( k=0; k<Pmax; k++) for( k=0; k<Pmax; k++)
fprintf( logstream, "%d", cachemodel.pp_model[j][i*Pmax+k]); fprintf( logstream, "%d", cachemodel.pp_model[j][i*Pmax+k]);
@ -197,9 +198,10 @@ void delete_cachemodel( cachemodel_param_t **cachemodel)
bool is_allsent( cachemodel_param_t cachemodel) bool is_allsent( cachemodel_param_t cachemodel)
{ {
target_param_t *target; target_param_t *target;
Byte8_t TPnum; // num of tile parts in each tile Byte8_t TPnum; /* num of tile parts in each tile */
Byte8_t Pmax; // max num of packets per tile Byte8_t Pmax; /* max num of packets per tile */
int i, j, k, n; Byte8_t i, j, k;
int n; /* FIXME: is this large enough ? */
target = cachemodel.target; target = cachemodel.target;

View File

@ -57,7 +57,7 @@ typedef struct cachemodellist_param{
* *
* @return pointer to the generated cache model list * @return pointer to the generated cache model list
*/ */
cachemodellist_param_t * gene_cachemodellist(); cachemodellist_param_t * gene_cachemodellist(void);
/** /**
* generate a cache model under a list * generate a cache model under a list

View File

@ -40,7 +40,7 @@
#define FCGI_stdout stdout #define FCGI_stdout stdout
#define FCGI_stderr stderr #define FCGI_stderr stderr
#define logstream stderr #define logstream stderr
#endif //SERVER #endif /*SERVER*/
imgreg_param_t map_viewin2imgreg( const int fx, const int fy, imgreg_param_t map_viewin2imgreg( const int fx, const int fy,
const int rx, const int ry, const int rx, const int ry,
@ -106,13 +106,13 @@ void find_level( int maxlev, int *lev, int *fx, int *fy, int *xmin, int *ymin, i
int xwidth = *xmax - *xmin; int xwidth = *xmax - *xmin;
int ywidth = *ymax - *ymin; int ywidth = *ymax - *ymin;
/// Find smaller frame size for now (i.e. assume "round-down"). /* Find smaller frame size for now (i.e. assume "round-down"). */
if ((*fx < 1 && xwidth != 0) || (*fy < 1 && ywidth != 0)){ if ((*fx < 1 && xwidth != 0) || (*fy < 1 && ywidth != 0)){
fprintf( FCGI_stderr, "Frame size must be strictly positive"); fprintf( FCGI_stderr, "Frame size must be strictly positive");
exit(-1); exit(-1);
} }
else if( *lev < maxlev-1 && ( *fx < xwidth || *fy < ywidth)) { else if( *lev < maxlev-1 && ( *fx < xwidth || *fy < ywidth)) {
// Simulate the ceil function. /* Simulate the ceil function. */
*xmin = ceil((double)*xmin/(double)2.0); *xmin = ceil((double)*xmin/(double)2.0);
*ymin = ceil((double)*ymin/(double)2.0); *ymin = ceil((double)*ymin/(double)2.0);
*xmax = ceil((double)*xmax/(double)2.0); *xmax = ceil((double)*xmax/(double)2.0);
@ -149,5 +149,7 @@ void print_imgreg( imgreg_param_t imgreg)
fprintf( logstream, "\t roff: %d, %d\n", imgreg.ox, imgreg.oy); fprintf( logstream, "\t roff: %d, %d\n", imgreg.ox, imgreg.oy);
fprintf( logstream, "\t rsiz: %d, %d\n", imgreg.sx, imgreg.sy); fprintf( logstream, "\t rsiz: %d, %d\n", imgreg.sx, imgreg.sy);
fprintf( logstream, "\t level: %d\n", imgreg.level); fprintf( logstream, "\t level: %d\n", imgreg.level);
#else
(void)imgreg;
#endif #endif
} }

View File

@ -31,14 +31,14 @@
#ifndef IMGREG_MANAGER_H_ #ifndef IMGREG_MANAGER_H_
# define IMGREG_MANAGER_H_ # define IMGREG_MANAGER_H_
//! image region parameters /** image region parameters */
typedef struct imgreg_param{ typedef struct imgreg_param{
int xosiz, yosiz; //!< offset from the origin of the reference grid int xosiz, yosiz; /** offset from the origin of the reference grid
//!at the decomposition level at the decomposition level */
int fx, fy; //!< frame size (fsiz) int fx, fy; /** frame size (fsiz) */
int ox, oy; //!< offset (roff) int ox, oy; /** offset (roff) */
int sx, sy; //!< region size (rsiz) int sx, sy; /** region size (rsiz) */
int level; //!< decomposition level int level; /** decomposition level */
} imgreg_param_t; } imgreg_param_t;

View File

@ -45,7 +45,7 @@
#define FCGI_stdout stdout #define FCGI_stdout stdout
#define FCGI_stderr stderr #define FCGI_stderr stderr
#define logstream stderr #define logstream stderr
#endif //SERVER #endif /*SERVER*/
/** /**
@ -105,11 +105,11 @@ Byte_t * recons_jp2( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn
if( ptr->phld){ if( ptr->phld){
if( strncmp( (char *)ptr->phld->OrigBH+4, "jp2c", 4) == 0){ if( strncmp( (char *)ptr->phld->OrigBH+4, "jp2c", 4) == 0){
jp2cDBoxOffset = *jp2len + ptr->phld->OrigBHlen; jp2cDBoxOffset = *jp2len + ptr->phld->OrigBHlen;
jp2stream = add_emptyboxstream( ptr->phld, jp2stream, jp2len); // header only jp2stream = add_emptyboxstream( ptr->phld, jp2stream, jp2len); /* header only */
jp2cDBoxlen = *jp2len - jp2cDBoxOffset; jp2cDBoxlen = *jp2len - jp2cDBoxOffset;
} }
else else
jp2stream = add_emptyboxstream( ptr->phld, jp2stream, jp2len); // header only jp2stream = add_emptyboxstream( ptr->phld, jp2stream, jp2len); /* header only */
} }
jp2stream = add_msgstream( ptr, jpipstream, jp2stream, jp2len); jp2stream = add_msgstream( ptr, jpipstream, jp2stream, jp2len);
ptr = ptr->next; ptr = ptr->next;
@ -203,7 +203,7 @@ Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *j
} }
ptr = msgqueue->first; ptr = msgqueue->first;
while(( ptr = search_message( EXT_TILE_MSG, tileID, csn, ptr))!=NULL){ while(( ptr = search_message( EXT_TILE_MSG, tileID, csn, ptr))!=NULL){
if( ptr->aux > mindeclev){ if( ptr->aux > mindeclev){ /* FIXME: pointer comparison ? */
if( ptr->bin_offset == binOffset){ if( ptr->bin_offset == binOffset){
found = true; found = true;
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen); j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
@ -625,7 +625,7 @@ Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, bool isJPPstre
message_param_t * search_message( Byte8_t class_id, Byte8_t in_class_id, Byte8_t csn, message_param_t *msg) message_param_t * search_message( Byte8_t class_id, Byte8_t in_class_id, Byte8_t csn, message_param_t *msg)
{ {
while( msg != NULL){ while( msg != NULL){
if( in_class_id == -1){ if( in_class_id == (Byte8_t)-1){
if( msg->class_id == class_id && msg->csn == csn) if( msg->class_id == class_id && msg->csn == csn)
return msg; return msg;
} }

View File

@ -43,7 +43,7 @@
#define FCGI_stdout stdout #define FCGI_stdout stdout
#define FCGI_stderr stderr #define FCGI_stderr stderr
#define logstream stderr #define logstream stderr
#endif //SERVER #endif /*SERVER*/
bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target) bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target)
@ -132,35 +132,35 @@ bool close_channel( query_param_t query_param,
#ifndef SERVER #ifndef SERVER
fprintf( logstream, "local log: close all\n"); fprintf( logstream, "local log: close all\n");
#endif #endif
// all channels associatd with the session will be closed /* all channels associatd with the session will be closed */
if( !delete_session( cursession, sessionlist)) if( !delete_session( cursession, sessionlist))
return false; return false;
} }
else{ else{
// check if all entry belonging to the same session /* check if all entry belonging to the same session */
for( i=0, cclose=query_param.cclose; i<query_param.numOfcclose; i++, cclose += (strlen(cclose)+1)){ for( i=0, cclose=query_param.cclose; i<query_param.numOfcclose; i++, cclose += (strlen(cclose)+1)){
// In case of the first entry of close cid /* In case of the first entry of close cid */
if( *cursession == NULL){ if( *cursession == NULL){
if( !search_session_and_channel( cclose, sessionlist, cursession, curchannel)) if( !search_session_and_channel( cclose, sessionlist, cursession, curchannel))
return false; return false;
} }
else // second or more entry of close cid else /* second or more entry of close cid */
if( !(*curchannel=search_channel( cclose, (*cursession)->channellist))){ if( !(*curchannel=search_channel( cclose, (*cursession)->channellist))){
fprintf( FCGI_stdout, "Reason: Cclose id %s is from another session\r\n", cclose); fprintf( FCGI_stdout, "Reason: Cclose id %s is from another session\r\n", cclose);
return false; return false;
} }
} }
// delete channels /* delete channels */
for( i=0, cclose=query_param.cclose; i<query_param.numOfcclose; i++, cclose += (strlen(cclose)+1)){ for( i=0, cclose=query_param.cclose; i<query_param.numOfcclose; i++, cclose += (strlen(cclose)+1)){
*curchannel = search_channel( cclose, (*cursession)->channellist); *curchannel = search_channel( cclose, (*cursession)->channellist);
delete_channel( curchannel, (*cursession)->channellist); delete_channel( curchannel, (*cursession)->channellist);
} }
if( (*cursession)->channellist->first == NULL || (*cursession)->channellist->last == NULL) if( (*cursession)->channellist->first == NULL || (*cursession)->channellist->last == NULL)
// In case of empty session /* In case of empty session */
delete_session( cursession, sessionlist); delete_session( cursession, sessionlist);
} }
return true; return true;
@ -195,14 +195,14 @@ bool gene_JPIPstream( query_param_t query_param,
index_param_t *codeidx; index_param_t *codeidx;
cachemodel_param_t *cachemodel; cachemodel_param_t *cachemodel;
if( !cursession || !curchannel){ // stateless if( !cursession || !curchannel){ /* stateless */
if( !target) if( !target)
return false; return false;
if( !(cachemodel = gene_cachemodel( NULL, target, query_param.return_type==JPPstream))) if( !(cachemodel = gene_cachemodel( NULL, target, query_param.return_type==JPPstream)))
return false; return false;
*msgqueue = gene_msgqueue( true, cachemodel); *msgqueue = gene_msgqueue( true, cachemodel);
} }
else{ // session else{ /* session */
cachemodel = curchannel->cachemodel; cachemodel = curchannel->cachemodel;
target = cachemodel->target; target = cachemodel->target;
*msgqueue = gene_msgqueue( false, cachemodel); *msgqueue = gene_msgqueue( false, cachemodel);
@ -222,7 +222,7 @@ bool gene_JPIPstream( query_param_t query_param,
} }
} }
//meta /*meta*/
if( query_param.box_type[0][0] != 0 && query_param.len != 0) if( query_param.box_type[0][0] != 0 && query_param.len != 0)
if( !enqueue_metabins( query_param, codeidx->metadatalist, *msgqueue)) if( !enqueue_metabins( query_param, codeidx->metadatalist, *msgqueue))
return false; return false;
@ -230,11 +230,11 @@ bool gene_JPIPstream( query_param_t query_param,
if( query_param.metadata_only) if( query_param.metadata_only)
return true; return true;
// main header /* main header */
if( !cachemodel->mhead_model && query_param.len != 0) if( !cachemodel->mhead_model && query_param.len != 0)
enqueue_mainheader( *msgqueue); enqueue_mainheader( *msgqueue);
// image codestream /* image codestream */
if( (query_param.fx > 0 && query_param.fy > 0)) if( (query_param.fx > 0 && query_param.fy > 0))
enqueue_imagedata( query_param, *msgqueue); enqueue_imagedata( query_param, *msgqueue);
@ -277,13 +277,13 @@ void enqueue_imagedata( query_param_t query_param, msgqueue_param_t *msgqueue)
index_param_t *codeidx; index_param_t *codeidx;
imgreg_param_t imgreg; imgreg_param_t imgreg;
range_param_t tile_Xrange, tile_Yrange; range_param_t tile_Xrange, tile_Yrange;
int u, v, tile_id; Byte4_t u, v, tile_id;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
int numOfreslev; int numOfreslev;
codeidx = msgqueue->cachemodel->target->codeidx; codeidx = msgqueue->cachemodel->target->codeidx;
if( !(msgqueue->cachemodel->jppstream) && get_nmax( codeidx->tilepart) == 1) // normally not the case if( !(msgqueue->cachemodel->jppstream) && get_nmax( codeidx->tilepart) == 1) /* normally not the case */
numOfreslev = 1; numOfreslev = 1;
else else
numOfreslev = codeidx->COD.numOfdecomp+1; numOfreslev = codeidx->COD.numOfdecomp+1;
@ -303,20 +303,20 @@ void enqueue_imagedata( query_param_t query_param, msgqueue_param_t *msgqueue)
tile_Xrange = get_tile_Xrange( codeidx->SIZ, tile_id, imgreg.level); tile_Xrange = get_tile_Xrange( codeidx->SIZ, tile_id, imgreg.level);
if( tile_Xrange.minvalue < tile_Xrange.maxvalue && tile_Yrange.minvalue < tile_Yrange.maxvalue){ if( tile_Xrange.minvalue < tile_Xrange.maxvalue && tile_Yrange.minvalue < tile_Yrange.maxvalue){
if( tile_Xrange.maxvalue <= imgreg.xosiz + imgreg.ox || if( tile_Xrange.maxvalue <= (Byte4_t)(imgreg.xosiz + imgreg.ox) ||
tile_Xrange.minvalue >= imgreg.xosiz + imgreg.ox + imgreg.sx || tile_Xrange.minvalue >= (Byte4_t)(imgreg.xosiz + imgreg.ox + imgreg.sx) ||
tile_Yrange.maxvalue <= imgreg.yosiz + imgreg.oy || tile_Yrange.maxvalue <= (Byte4_t)(imgreg.yosiz + imgreg.oy) ||
tile_Yrange.minvalue >= imgreg.yosiz + imgreg.oy + imgreg.sy) { tile_Yrange.minvalue >= (Byte4_t)(imgreg.yosiz + imgreg.oy + imgreg.sy)) {
//printf("Tile completely excluded from view-window %d\n", tile_id); /*printf("Tile completely excluded from view-window %d\n", tile_id);*/
// Tile completely excluded from view-window /* Tile completely excluded from view-window */
} }
else if( tile_Xrange.minvalue >= imgreg.xosiz + imgreg.ox && else if( tile_Xrange.minvalue >= (Byte4_t)(imgreg.xosiz + imgreg.ox) &&
tile_Xrange.maxvalue <= imgreg.xosiz + imgreg.ox + imgreg.sx && tile_Xrange.maxvalue <= (Byte4_t)(imgreg.xosiz + imgreg.ox + imgreg.sx) &&
tile_Yrange.minvalue >= imgreg.yosiz + imgreg.oy && tile_Yrange.minvalue >= (Byte4_t)(imgreg.yosiz + imgreg.oy) &&
tile_Yrange.maxvalue <= imgreg.yosiz + imgreg.oy + imgreg.sy) { tile_Yrange.maxvalue <= (Byte4_t)(imgreg.yosiz + imgreg.oy + imgreg.sy)) {
// Tile completely contained within view-window /* Tile completely contained within view-window */
// high priority /* high priority */
//printf("Tile completely contained within view-window %d\n", tile_id); /*printf("Tile completely contained within view-window %d\n", tile_id);*/
if( msgqueue->cachemodel->jppstream){ if( msgqueue->cachemodel->jppstream){
enqueue_tileheader( tile_id, msgqueue); enqueue_tileheader( tile_id, msgqueue);
enqueue_allprecincts( tile_id, imgreg.level, query_param.lastcomp, query_param.comps, query_param.layers, msgqueue); enqueue_allprecincts( tile_id, imgreg.level, query_param.lastcomp, query_param.comps, query_param.layers, msgqueue);
@ -325,16 +325,17 @@ void enqueue_imagedata( query_param_t query_param, msgqueue_param_t *msgqueue)
enqueue_tile( tile_id, imgreg.level, msgqueue); enqueue_tile( tile_id, imgreg.level, msgqueue);
} }
else{ else{
// Tile partially overlaps view-window /* Tile partially overlaps view-window */
// low priority /* low priority */
//printf("Tile partially overlaps view-window %d\n", tile_id); /*printf("Tile partially overlaps view-window %d\n", tile_id);*/
if( msgqueue->cachemodel->jppstream){ if( msgqueue->cachemodel->jppstream){
enqueue_tileheader( tile_id, msgqueue); enqueue_tileheader( tile_id, msgqueue);
xmin = tile_Xrange.minvalue >= imgreg.xosiz + imgreg.ox ? 0 : imgreg.xosiz + imgreg.ox - tile_Xrange.minvalue; /* FIXME: The following code is suspicious it implicitely cast an unsigned int to int, which truncates values */
xmax = tile_Xrange.maxvalue <= imgreg.xosiz + imgreg.ox + imgreg.sx ? tile_Xrange.maxvalue - tile_Xrange.minvalue -1 : imgreg.xosiz + imgreg.ox + imgreg.sx - tile_Xrange.minvalue -1; xmin = tile_Xrange.minvalue >= (Byte4_t)(imgreg.xosiz + imgreg.ox) ? 0 : imgreg.xosiz + imgreg.ox - tile_Xrange.minvalue;
ymin = tile_Yrange.minvalue >= imgreg.yosiz + imgreg.oy ? 0 : imgreg.yosiz + imgreg.oy - tile_Yrange.minvalue; xmax = tile_Xrange.maxvalue <= (Byte4_t)(imgreg.xosiz + imgreg.ox + imgreg.sx) ? tile_Xrange.maxvalue - tile_Xrange.minvalue -1 : imgreg.xosiz + imgreg.ox + imgreg.sx - tile_Xrange.minvalue -1;
ymax = tile_Yrange.maxvalue <= imgreg.yosiz + imgreg.oy + imgreg.sy ? tile_Yrange.maxvalue - tile_Yrange.minvalue -1 : imgreg.yosiz + imgreg.oy + imgreg.sy - tile_Yrange.minvalue -1; ymin = tile_Yrange.minvalue >= (Byte4_t)(imgreg.yosiz + imgreg.oy) ? 0 : imgreg.yosiz + imgreg.oy - tile_Yrange.minvalue;
ymax = tile_Yrange.maxvalue <= (Byte4_t)(imgreg.yosiz + imgreg.oy + imgreg.sy) ? tile_Yrange.maxvalue - tile_Yrange.minvalue -1 : imgreg.yosiz + imgreg.oy + imgreg.sy - tile_Yrange.minvalue -1;
enqueue_precincts( xmin, xmax, ymin, ymax, tile_id, imgreg.level, query_param.lastcomp, query_param.comps, query_param.layers, msgqueue); enqueue_precincts( xmin, xmax, ymin, ymax, tile_id, imgreg.level, query_param.lastcomp, query_param.comps, query_param.layers, msgqueue);
} }
else else
@ -346,6 +347,7 @@ void enqueue_imagedata( query_param_t query_param, msgqueue_param_t *msgqueue)
} }
/* MM: shouldnt xmin/xmax be Byte4_t instead ? */
void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int level, int lastcomp, bool *comps, int layers, msgqueue_param_t *msgqueue) void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int level, int lastcomp, bool *comps, int layers, msgqueue_param_t *msgqueue)
{ {
index_param_t *codeidx; index_param_t *codeidx;
@ -381,16 +383,16 @@ void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int
xmaxP = XTsiz-1; xmaxP = XTsiz-1;
if( xmaxP < xmin || xminP > xmax || ymaxP < ymin || yminP > ymax){ if( xmaxP < xmin || xminP > xmax || ymaxP < ymin || yminP > ymax){
// Precinct completely excluded from view-window /* Precinct completely excluded from view-window */
} }
else if( xminP >= xmin && xmaxP <= xmax && yminP >= ymin && ymaxP <= ymax){ else if( xminP >= xmin && xmaxP <= xmax && yminP >= ymin && ymaxP <= ymax){
// Precinct completely contained within view-window /* Precinct completely contained within view-window
// high priority high priority */
enqueue_precinct( seq_id, tile_id, c, (dec_lev>level)?-1:layers, msgqueue); enqueue_precinct( seq_id, tile_id, c, (dec_lev>level)?-1:layers, msgqueue);
} }
else{ else{
// Precinct partially overlaps view-window /* Precinct partially overlaps view-window
// low priority low priority */
enqueue_precinct( seq_id, tile_id, c, (dec_lev>level)?-1:layers, msgqueue); enqueue_precinct( seq_id, tile_id, c, (dec_lev>level)?-1:layers, msgqueue);
} }
} }

View File

@ -96,7 +96,7 @@ void print_manfbox( manfbox_param_t *manf)
} }
} }
boxheader_param_t * search_boxheader( char type[], manfbox_param_t *manf) boxheader_param_t * search_boxheader( const char type[], manfbox_param_t *manf)
{ {
boxheader_param_t *found; boxheader_param_t *found;

View File

@ -75,7 +75,7 @@ void print_manfbox( manfbox_param_t *manf);
* @param[in] manf manf box pointer * @param[in] manf manf box pointer
* @return found box pointer * @return found box pointer
*/ */
boxheader_param_t * search_boxheader( char type[], manfbox_param_t *manf); boxheader_param_t * search_boxheader( const char type[], manfbox_param_t *manf);
#endif /* !MANFBOX_MANAGER_H_ */ #endif /* !MANFBOX_MANAGER_H_ */

View File

@ -43,7 +43,7 @@
#endif /*SERVER*/ #endif /*SERVER*/
metadatalist_param_t * gene_metadatalist() metadatalist_param_t * gene_metadatalist(void)
{ {
metadatalist_param_t *list; metadatalist_param_t *list;

View File

@ -60,7 +60,7 @@ typedef struct metadatalist_param{
* *
* @return pointer to the generated metadata list * @return pointer to the generated metadata list
*/ */
metadatalist_param_t * gene_metadatalist(); metadatalist_param_t * gene_metadatalist(void);
/** /**

View File

@ -41,11 +41,11 @@
#define FCGI_stdout stdout #define FCGI_stdout stdout
#define FCGI_stderr stderr #define FCGI_stderr stderr
#define logstream stderr #define logstream stderr
#endif //SERVER #endif /*SERVER*/
placeholderlist_param_t * gene_placeholderlist() placeholderlist_param_t * gene_placeholderlist(void)
{ {
placeholderlist_param_t *list; placeholderlist_param_t *list;
@ -81,7 +81,7 @@ placeholder_param_t * gene_placeholder( box_param_t *box, int origID)
placeholder = (placeholder_param_t *)malloc( sizeof(placeholder_param_t)); placeholder = (placeholder_param_t *)malloc( sizeof(placeholder_param_t));
strncpy( placeholder->TBox, "phld", 4); strncpy( placeholder->TBox, "phld", 4);
placeholder->Flags = 1; // only the access to the original contents of this box, for now placeholder->Flags = 1; /* only the access to the original contents of this box, for now */
placeholder->OrigID = origID; placeholder->OrigID = origID;
placeholder->OrigBH = fetch_headbytes( box); placeholder->OrigBH = fetch_headbytes( box);
placeholder->OrigBHlen = box->headlen; placeholder->OrigBHlen = box->headlen;

View File

@ -66,7 +66,7 @@ typedef struct placeholderlist_param{
* *
* @return pointer to the generated placeholder list * @return pointer to the generated placeholder list
*/ */
placeholderlist_param_t * gene_placeholderlist(); placeholderlist_param_t * gene_placeholderlist(void);
/** /**

View File

@ -53,7 +53,7 @@
#define logstream stderr #define logstream stderr
#endif /*SERVER*/ #endif /*SERVER*/
targetlist_param_t * gene_targetlist() targetlist_param_t * gene_targetlist(void)
{ {
targetlist_param_t *targetlist; targetlist_param_t *targetlist;

View File

@ -67,7 +67,7 @@ typedef struct targetlist_param{
* *
* @return pointer to the generated target list * @return pointer to the generated target list
*/ */
targetlist_param_t * gene_targetlist(); targetlist_param_t * gene_targetlist(void);
/** /**

View File

@ -64,7 +64,7 @@ int main(int argc,char *argv[])
if(!( fwrite_jp2k( argv[2], dec))) if(!( fwrite_jp2k( argv[2], dec)))
return -1; return -1;
// output_log( true, false, false, dec); /* output_log( true, false, false, dec); */
destroy_jpipdecoder( &dec); destroy_jpipdecoder( &dec);

View File

@ -56,11 +56,14 @@
#ifdef _WIN32 #ifdef _WIN32
WSADATA initialisation_win32; WSADATA initialisation_win32;
#endif //_WIN32 #endif /*_WIN32*/
int main(void) int main(void)
{ {
server_record_t *server_record; server_record_t *server_record;
#ifdef SERVER
char *query_string;
#endif
#ifdef _WIN32 #ifdef _WIN32
int erreur = WSAStartup(MAKEWORD(2,2),&initialisation_win32); int erreur = WSAStartup(MAKEWORD(2,2),&initialisation_win32);
@ -68,13 +71,11 @@ int main(void)
fprintf( stderr, "Erreur initialisation Winsock error : %d %d\n",erreur,WSAGetLastError()); fprintf( stderr, "Erreur initialisation Winsock error : %d %d\n",erreur,WSAGetLastError());
else else
fprintf( stderr, "Initialisation Winsock\n"); fprintf( stderr, "Initialisation Winsock\n");
#endif //_WIN32 #endif /*_WIN32*/
server_record = init_JPIPserver( 60000, 0); server_record = init_JPIPserver( 60000, 0);
#ifdef SERVER #ifdef SERVER
char *query_string;
while(FCGI_Accept() >= 0) while(FCGI_Accept() >= 0)
#else #else
@ -82,17 +83,16 @@ int main(void)
while( fgets( query_string, 128, stdin) && query_string[0]!='\n') while( fgets( query_string, 128, stdin) && query_string[0]!='\n')
#endif #endif
{ {
QR_t *qr;
bool parse_status;
#ifdef SERVER #ifdef SERVER
query_string = getenv("QUERY_STRING"); query_string = getenv("QUERY_STRING");
#endif //SERVER #endif /*SERVER*/
if( strcmp( query_string, QUIT_SIGNAL) == 0) if( strcmp( query_string, QUIT_SIGNAL) == 0)
break; break;
QR_t *qr;
bool parse_status;
qr = parse_querystring( query_string); qr = parse_querystring( query_string);
parse_status = process_JPIPrequest( server_record, qr); parse_status = process_JPIPrequest( server_record, qr);