summaryrefslogtreecommitdiff
path: root/applications
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-03-02 08:44:04 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-03-02 08:44:04 +0000
commit6f314ae48e65d1ffbb81635b18c47411a5f8e3f4 (patch)
tree5d5c13e8339075aac10d666fd7fcf39cb2c371f1 /applications
parent24ab49a363abe97495edc429dff09277806a7029 (diff)
[1.5] Fix a bunch of comparison between signed and unsigned integer expressions. Some are still left to decide.
Diffstat (limited to 'applications')
-rw-r--r--applications/jpip/libopenjpip/box_manager.c8
-rw-r--r--applications/jpip/libopenjpip/box_manager.h8
-rw-r--r--applications/jpip/libopenjpip/boxheader_manager.c4
-rw-r--r--applications/jpip/libopenjpip/byte_manager.h2
-rw-r--r--applications/jpip/libopenjpip/cachemodel_manager.c28
-rw-r--r--applications/jpip/libopenjpip/cachemodel_manager.h2
-rw-r--r--applications/jpip/libopenjpip/imgreg_manager.c8
-rw-r--r--applications/jpip/libopenjpip/imgreg_manager.h14
-rw-r--r--applications/jpip/libopenjpip/jp2k_encoder.c10
-rw-r--r--applications/jpip/libopenjpip/jpip_parser.c80
-rw-r--r--applications/jpip/libopenjpip/manfbox_manager.c2
-rw-r--r--applications/jpip/libopenjpip/manfbox_manager.h2
-rw-r--r--applications/jpip/libopenjpip/metadata_manager.c2
-rw-r--r--applications/jpip/libopenjpip/metadata_manager.h2
-rw-r--r--applications/jpip/libopenjpip/placeholder_manager.c6
-rw-r--r--applications/jpip/libopenjpip/placeholder_manager.h2
-rw-r--r--applications/jpip/libopenjpip/target_manager.c2
-rw-r--r--applications/jpip/libopenjpip/target_manager.h2
-rw-r--r--applications/jpip/util/jpip_to_j2k.c2
-rw-r--r--applications/jpip/util/opj_server.c16
20 files changed, 104 insertions, 98 deletions
diff --git a/applications/jpip/libopenjpip/box_manager.c b/applications/jpip/libopenjpip/box_manager.c
index b37c0f05..14d670ff 100644
--- a/applications/jpip/libopenjpip/box_manager.c
+++ b/applications/jpip/libopenjpip/box_manager.c
@@ -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;
Byte_t *data;
@@ -221,7 +221,7 @@ box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[
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;
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);
}
-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);
}
@@ -317,7 +317,7 @@ Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long 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;
diff --git a/applications/jpip/libopenjpip/box_manager.h b/applications/jpip/libopenjpip/box_manager.h
index 8203e281..37577300 100644
--- a/applications/jpip/libopenjpip/box_manager.h
+++ b/applications/jpip/libopenjpip/box_manager.h
@@ -97,7 +97,7 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset);
* @param[in] TBox Box Type
* @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
@@ -108,7 +108,7 @@ box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[
* @param[in] TBox Box Type
* @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
@@ -127,7 +127,7 @@ box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset);
* @param[in] TBox Box Type
* @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
@@ -210,7 +210,7 @@ Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset);
* @param[in] boxlist box list 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
diff --git a/applications/jpip/libopenjpip/boxheader_manager.c b/applications/jpip/libopenjpip/boxheader_manager.c
index 0a8b2215..cb6962ab 100644
--- a/applications/jpip/libopenjpip/boxheader_manager.c
+++ b/applications/jpip/libopenjpip/boxheader_manager.c
@@ -41,7 +41,7 @@
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER*/
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);
headlen = 8;
- if( boxlen == 1){ // read XLBox
+ if( boxlen == 1){ /* read XLBox */
boxlen = fetch_8bytebigendian( fd, offset+8);
headlen = 16;
}
diff --git a/applications/jpip/libopenjpip/byte_manager.h b/applications/jpip/libopenjpip/byte_manager.h
index 60cd26c1..d06b9131 100644
--- a/applications/jpip/libopenjpip/byte_manager.h
+++ b/applications/jpip/libopenjpip/byte_manager.h
@@ -38,7 +38,7 @@ typedef unsigned char Byte_t;
typedef unsigned short int Byte2_t;
/** 4Byte parameter type*/
-typedef unsigned int Byte4_t;
+typedef unsigned int Byte4_t; /* FIXME: Is this portable ? */
/** 8Byte parameter type*/
typedef unsigned long long int Byte8_t;
diff --git a/applications/jpip/libopenjpip/cachemodel_manager.c b/applications/jpip/libopenjpip/cachemodel_manager.c
index 62566268..db921fba 100644
--- a/applications/jpip/libopenjpip/cachemodel_manager.c
+++ b/applications/jpip/libopenjpip/cachemodel_manager.c
@@ -40,10 +40,10 @@
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER*/
-cachemodellist_param_t * gene_cachemodellist()
+cachemodellist_param_t * gene_cachemodellist(void)
{
cachemodellist_param_t *cachemodellist;
@@ -73,7 +73,7 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
cachemodel->jppstream = true;
else
cachemodel->jppstream = false;
- } else{ // reqJPT
+ } else{ /* reqJPT */
if( target->jptstream)
cachemodel->jppstream = false;
else
@@ -95,9 +95,9 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
cachemodel->next = NULL;
if( cachemodellist){
- if( cachemodellist->first) // there are one or more entries
+ if( cachemodellist->first) /* there are one or more entries */
cachemodellist->last->next = cachemodel;
- else // first entry
+ else /* first entry */
cachemodellist->first = 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)
{
target_param_t *target;
- Byte8_t TPnum; // num of tile parts in each tile
- Byte8_t Pmax; // max num of packets per tile
- int i, j, k, n;
+ Byte8_t TPnum; /* num of tile parts in each tile */
+ Byte8_t Pmax; /* max num of packets per tile */
+ Byte8_t i, j, k;
+ int n; /* FIXME: Is this large enough ? */
target = cachemodel.target;
@@ -135,9 +136,9 @@ void print_cachemodel( cachemodel_param_t cachemodel)
fprintf( logstream, "\t tile header and precinct packet model:\n");
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++){
- fprintf( logstream, "\t compo.%d: ", j);
+ fprintf( logstream, "\t compo.%llud: ", j);
Pmax = get_nmax( target->codeidx->precpacket[j]);
for( k=0; k<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)
{
target_param_t *target;
- Byte8_t TPnum; // num of tile parts in each tile
- Byte8_t Pmax; // max num of packets per tile
- int i, j, k, n;
+ Byte8_t TPnum; /* num of tile parts in each tile */
+ Byte8_t Pmax; /* max num of packets per tile */
+ Byte8_t i, j, k;
+ int n; /* FIXME: is this large enough ? */
target = cachemodel.target;
diff --git a/applications/jpip/libopenjpip/cachemodel_manager.h b/applications/jpip/libopenjpip/cachemodel_manager.h
index 2cc44dac..2c9dc540 100644
--- a/applications/jpip/libopenjpip/cachemodel_manager.h
+++ b/applications/jpip/libopenjpip/cachemodel_manager.h
@@ -57,7 +57,7 @@ typedef struct cachemodellist_param{
*
* @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
diff --git a/applications/jpip/libopenjpip/imgreg_manager.c b/applications/jpip/libopenjpip/imgreg_manager.c
index 268cbb79..3bdca31f 100644
--- a/applications/jpip/libopenjpip/imgreg_manager.c
+++ b/applications/jpip/libopenjpip/imgreg_manager.c
@@ -40,7 +40,7 @@
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER*/
imgreg_param_t map_viewin2imgreg( const int fx, const int fy,
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 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)){
fprintf( FCGI_stderr, "Frame size must be strictly positive");
exit(-1);
}
else if( *lev < maxlev-1 && ( *fx < xwidth || *fy < ywidth)) {
- // Simulate the ceil function.
+ /* Simulate the ceil function. */
*xmin = ceil((double)*xmin/(double)2.0);
*ymin = ceil((double)*ymin/(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 rsiz: %d, %d\n", imgreg.sx, imgreg.sy);
fprintf( logstream, "\t level: %d\n", imgreg.level);
+#else
+ (void)imgreg;
#endif
}
diff --git a/applications/jpip/libopenjpip/imgreg_manager.h b/applications/jpip/libopenjpip/imgreg_manager.h
index 045d15ea..7967120b 100644
--- a/applications/jpip/libopenjpip/imgreg_manager.h
+++ b/applications/jpip/libopenjpip/imgreg_manager.h
@@ -31,14 +31,14 @@
#ifndef IMGREG_MANAGER_H_
# define IMGREG_MANAGER_H_
-//! image region parameters
+/** image region parameters */
typedef struct imgreg_param{
- int xosiz, yosiz; //!< offset from the origin of the reference grid
- //!at the decomposition level
- int fx, fy; //!< frame size (fsiz)
- int ox, oy; //!< offset (roff)
- int sx, sy; //!< region size (rsiz)
- int level; //!< decomposition level
+ int xosiz, yosiz; /** offset from the origin of the reference grid
+ at the decomposition level */
+ int fx, fy; /** frame size (fsiz) */
+ int ox, oy; /** offset (roff) */
+ int sx, sy; /** region size (rsiz) */
+ int level; /** decomposition level */
} imgreg_param_t;
diff --git a/applications/jpip/libopenjpip/jp2k_encoder.c b/applications/jpip/libopenjpip/jp2k_encoder.c
index 013e4316..0db7e818 100644
--- a/applications/jpip/libopenjpip/jp2k_encoder.c
+++ b/applications/jpip/libopenjpip/jp2k_encoder.c
@@ -45,7 +45,7 @@
#define FCGI_stdout stdout
#define FCGI_stderr 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( strncmp( (char *)ptr->phld->OrigBH+4, "jp2c", 4) == 0){
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;
}
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);
ptr = ptr->next;
@@ -203,7 +203,7 @@ Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *j
}
ptr = msgqueue->first;
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){
found = true;
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)
{
while( msg != NULL){
- if( in_class_id == -1){
+ if( in_class_id == (Byte8_t)-1){
if( msg->class_id == class_id && msg->csn == csn)
return msg;
}
diff --git a/applications/jpip/libopenjpip/jpip_parser.c b/applications/jpip/libopenjpip/jpip_parser.c
index 2215fd8f..22481cc1 100644
--- a/applications/jpip/libopenjpip/jpip_parser.c
+++ b/applications/jpip/libopenjpip/jpip_parser.c
@@ -43,7 +43,7 @@
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER*/
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
fprintf( logstream, "local log: close all\n");
#endif
- // all channels associatd with the session will be closed
+ /* all channels associatd with the session will be closed */
if( !delete_session( cursession, sessionlist))
return false;
}
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)){
- // In case of the first entry of close cid
+ /* In case of the first entry of close cid */
if( *cursession == NULL){
if( !search_session_and_channel( cclose, sessionlist, cursession, curchannel))
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))){
fprintf( FCGI_stdout, "Reason: Cclose id %s is from another session\r\n", cclose);
return false;
}
}
- // delete channels
+ /* delete channels */
for( i=0, cclose=query_param.cclose; i<query_param.numOfcclose; i++, cclose += (strlen(cclose)+1)){
*curchannel = search_channel( cclose, (*cursession)->channellist);
delete_channel( curchannel, (*cursession)->channellist);
}
if( (*cursession)->channellist->first == NULL || (*cursession)->channellist->last == NULL)
- // In case of empty session
+ /* In case of empty session */
delete_session( cursession, sessionlist);
}
return true;
@@ -195,14 +195,14 @@ bool gene_JPIPstream( query_param_t query_param,
index_param_t *codeidx;
cachemodel_param_t *cachemodel;
- if( !cursession || !curchannel){ // stateless
+ if( !cursession || !curchannel){ /* stateless */
if( !target)
return false;
if( !(cachemodel = gene_cachemodel( NULL, target, query_param.return_type==JPPstream)))
return false;
*msgqueue = gene_msgqueue( true, cachemodel);
}
- else{ // session
+ else{ /* session */
cachemodel = curchannel->cachemodel;
target = cachemodel->target;
*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( !enqueue_metabins( query_param, codeidx->metadatalist, *msgqueue))
return false;
@@ -230,11 +230,11 @@ bool gene_JPIPstream( query_param_t query_param,
if( query_param.metadata_only)
return true;
- // main header
+ /* main header */
if( !cachemodel->mhead_model && query_param.len != 0)
enqueue_mainheader( *msgqueue);
- // image codestream
+ /* image codestream */
if( (query_param.fx > 0 && query_param.fy > 0))
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;
imgreg_param_t imgreg;
range_param_t tile_Xrange, tile_Yrange;
- int u, v, tile_id;
+ Byte4_t u, v, tile_id;
int xmin, xmax, ymin, ymax;
int numOfreslev;
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;
else
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);
if( tile_Xrange.minvalue < tile_Xrange.maxvalue && tile_Yrange.minvalue < tile_Yrange.maxvalue){
- if( tile_Xrange.maxvalue <= imgreg.xosiz + imgreg.ox ||
- tile_Xrange.minvalue >= imgreg.xosiz + imgreg.ox + imgreg.sx ||
- tile_Yrange.maxvalue <= imgreg.yosiz + imgreg.oy ||
- tile_Yrange.minvalue >= imgreg.yosiz + imgreg.oy + imgreg.sy) {
- //printf("Tile completely excluded from view-window %d\n", tile_id);
- // Tile completely excluded from view-window
+ if( tile_Xrange.maxvalue <= (Byte4_t)(imgreg.xosiz + imgreg.ox) ||
+ tile_Xrange.minvalue >= (Byte4_t)(imgreg.xosiz + imgreg.ox + imgreg.sx) ||
+ tile_Yrange.maxvalue <= (Byte4_t)(imgreg.yosiz + imgreg.oy) ||
+ tile_Yrange.minvalue >= (Byte4_t)(imgreg.yosiz + imgreg.oy + imgreg.sy)) {
+ /*printf("Tile completely excluded from view-window %d\n", tile_id);*/
+ /* Tile completely excluded from view-window */
}
- else if( tile_Xrange.minvalue >= imgreg.xosiz + imgreg.ox &&
- tile_Xrange.maxvalue <= imgreg.xosiz + imgreg.ox + imgreg.sx &&
- tile_Yrange.minvalue >= imgreg.yosiz + imgreg.oy &&
- tile_Yrange.maxvalue <= imgreg.yosiz + imgreg.oy + imgreg.sy) {
- // Tile completely contained within view-window
- // high priority
- //printf("Tile completely contained within view-window %d\n", tile_id);
+ else if( tile_Xrange.minvalue >= (Byte4_t)(imgreg.xosiz + imgreg.ox) &&
+ tile_Xrange.maxvalue <= (Byte4_t)(imgreg.xosiz + imgreg.ox + imgreg.sx) &&
+ tile_Yrange.minvalue >= (Byte4_t)(imgreg.yosiz + imgreg.oy) &&
+ tile_Yrange.maxvalue <= (Byte4_t)(imgreg.yosiz + imgreg.oy + imgreg.sy)) {
+ /* Tile completely contained within view-window */
+ /* high priority */
+ /*printf("Tile completely contained within view-window %d\n", tile_id);*/
if( msgqueue->cachemodel->jppstream){
enqueue_tileheader( tile_id, 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);
}
else{
- // Tile partially overlaps view-window
- // low priority
- //printf("Tile partially overlaps view-window %d\n", tile_id);
+ /* Tile partially overlaps view-window */
+ /* low priority */
+ /*printf("Tile partially overlaps view-window %d\n", tile_id);*/
if( msgqueue->cachemodel->jppstream){
enqueue_tileheader( tile_id, msgqueue);
- xmin = tile_Xrange.minvalue >= imgreg.xosiz + imgreg.ox ? 0 : imgreg.xosiz + imgreg.ox - tile_Xrange.minvalue;
- 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;
- ymin = tile_Yrange.minvalue >= imgreg.yosiz + imgreg.oy ? 0 : imgreg.yosiz + imgreg.oy - tile_Yrange.minvalue;
- 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;
+ /* FIXME: The following code is suspicious it implicitely cast an unsigned int to int, which truncates values */
+ xmin = tile_Xrange.minvalue >= (Byte4_t)(imgreg.xosiz + imgreg.ox) ? 0 : imgreg.xosiz + imgreg.ox - tile_Xrange.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;
+ 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);
}
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)
{
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;
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){
- // Precinct completely contained within view-window
- // high priority
+ /* Precinct completely contained within view-window
+ high priority */
enqueue_precinct( seq_id, tile_id, c, (dec_lev>level)?-1:layers, msgqueue);
}
else{
- // Precinct partially overlaps view-window
- // low priority
+ /* Precinct partially overlaps view-window
+ low priority */
enqueue_precinct( seq_id, tile_id, c, (dec_lev>level)?-1:layers, msgqueue);
}
}
diff --git a/applications/jpip/libopenjpip/manfbox_manager.c b/applications/jpip/libopenjpip/manfbox_manager.c
index d2b41536..51aac36e 100644
--- a/applications/jpip/libopenjpip/manfbox_manager.c
+++ b/applications/jpip/libopenjpip/manfbox_manager.c
@@ -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;
diff --git a/applications/jpip/libopenjpip/manfbox_manager.h b/applications/jpip/libopenjpip/manfbox_manager.h
index 484e7af3..ed4189e0 100644
--- a/applications/jpip/libopenjpip/manfbox_manager.h
+++ b/applications/jpip/libopenjpip/manfbox_manager.h
@@ -75,7 +75,7 @@ void print_manfbox( manfbox_param_t *manf);
* @param[in] manf manf 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_ */
diff --git a/applications/jpip/libopenjpip/metadata_manager.c b/applications/jpip/libopenjpip/metadata_manager.c
index 09a753ba..f109f448 100644
--- a/applications/jpip/libopenjpip/metadata_manager.c
+++ b/applications/jpip/libopenjpip/metadata_manager.c
@@ -43,7 +43,7 @@
#endif /*SERVER*/
-metadatalist_param_t * gene_metadatalist()
+metadatalist_param_t * gene_metadatalist(void)
{
metadatalist_param_t *list;
diff --git a/applications/jpip/libopenjpip/metadata_manager.h b/applications/jpip/libopenjpip/metadata_manager.h
index 8e717638..5bd0e506 100644
--- a/applications/jpip/libopenjpip/metadata_manager.h
+++ b/applications/jpip/libopenjpip/metadata_manager.h
@@ -60,7 +60,7 @@ typedef struct metadatalist_param{
*
* @return pointer to the generated metadata list
*/
-metadatalist_param_t * gene_metadatalist();
+metadatalist_param_t * gene_metadatalist(void);
/**
diff --git a/applications/jpip/libopenjpip/placeholder_manager.c b/applications/jpip/libopenjpip/placeholder_manager.c
index d76dbf3c..dfbf3dd3 100644
--- a/applications/jpip/libopenjpip/placeholder_manager.c
+++ b/applications/jpip/libopenjpip/placeholder_manager.c
@@ -41,11 +41,11 @@
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER*/
-placeholderlist_param_t * gene_placeholderlist()
+placeholderlist_param_t * gene_placeholderlist(void)
{
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));
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->OrigBH = fetch_headbytes( box);
placeholder->OrigBHlen = box->headlen;
diff --git a/applications/jpip/libopenjpip/placeholder_manager.h b/applications/jpip/libopenjpip/placeholder_manager.h
index b2165135..a085bebd 100644
--- a/applications/jpip/libopenjpip/placeholder_manager.h
+++ b/applications/jpip/libopenjpip/placeholder_manager.h
@@ -66,7 +66,7 @@ typedef struct placeholderlist_param{
*
* @return pointer to the generated placeholder list
*/
-placeholderlist_param_t * gene_placeholderlist();
+placeholderlist_param_t * gene_placeholderlist(void);
/**
diff --git a/applications/jpip/libopenjpip/target_manager.c b/applications/jpip/libopenjpip/target_manager.c
index d06b745b..c62972b3 100644
--- a/applications/jpip/libopenjpip/target_manager.c
+++ b/applications/jpip/libopenjpip/target_manager.c
@@ -53,7 +53,7 @@
#define logstream stderr
#endif /*SERVER*/
-targetlist_param_t * gene_targetlist()
+targetlist_param_t * gene_targetlist(void)
{
targetlist_param_t *targetlist;
diff --git a/applications/jpip/libopenjpip/target_manager.h b/applications/jpip/libopenjpip/target_manager.h
index f44f99cd..47284dc2 100644
--- a/applications/jpip/libopenjpip/target_manager.h
+++ b/applications/jpip/libopenjpip/target_manager.h
@@ -67,7 +67,7 @@ typedef struct targetlist_param{
*
* @return pointer to the generated target list
*/
-targetlist_param_t * gene_targetlist();
+targetlist_param_t * gene_targetlist(void);
/**
diff --git a/applications/jpip/util/jpip_to_j2k.c b/applications/jpip/util/jpip_to_j2k.c
index 28876377..d8b2e2b0 100644
--- a/applications/jpip/util/jpip_to_j2k.c
+++ b/applications/jpip/util/jpip_to_j2k.c
@@ -64,7 +64,7 @@ int main(int argc,char *argv[])
if(!( fwrite_jp2k( argv[2], dec)))
return -1;
- // output_log( true, false, false, dec);
+ /* output_log( true, false, false, dec); */
destroy_jpipdecoder( &dec);
diff --git a/applications/jpip/util/opj_server.c b/applications/jpip/util/opj_server.c
index bed1be35..1666a94f 100644
--- a/applications/jpip/util/opj_server.c
+++ b/applications/jpip/util/opj_server.c
@@ -56,11 +56,14 @@
#ifdef _WIN32
WSADATA initialisation_win32;
-#endif //_WIN32
+#endif /*_WIN32*/
int main(void)
{
server_record_t *server_record;
+#ifdef SERVER
+ char *query_string;
+#endif
#ifdef _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());
else
fprintf( stderr, "Initialisation Winsock\n");
-#endif //_WIN32
+#endif /*_WIN32*/
server_record = init_JPIPserver( 60000, 0);
#ifdef SERVER
-
- char *query_string;
while(FCGI_Accept() >= 0)
#else
@@ -82,17 +83,16 @@ int main(void)
while( fgets( query_string, 128, stdin) && query_string[0]!='\n')
#endif
{
+ QR_t *qr;
+ bool parse_status;
#ifdef SERVER
query_string = getenv("QUERY_STRING");
-#endif //SERVER
+#endif /*SERVER*/
if( strcmp( query_string, QUIT_SIGNAL) == 0)
break;
- QR_t *qr;
- bool parse_status;
-
qr = parse_querystring( query_string);
parse_status = process_JPIPrequest( server_record, qr);