From 2e493cb89a841471352ff8f6fc562b7467148e5a Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Mon, 26 Mar 2012 14:44:12 +0000 Subject: [PATCH] [trunk] According to JPIP/A.2.3 in class identifiers should be an unsigned integer. Since portion of codes was using Byte8_t and other was using int, pick Byte8_t as best matching type --- .../jpip/libopenjpip/auxtrans_manager.c | 2 +- applications/jpip/libopenjpip/jpip_parser.c | 21 ++++++++++++------- .../jpip/libopenjpip/metadata_manager.c | 10 +++++---- .../jpip/libopenjpip/metadata_manager.h | 6 +++--- .../jpip/libopenjpip/msgqueue_manager.c | 4 ++-- .../jpip/libopenjpip/msgqueue_manager.h | 4 ++-- .../jpip/libopenjpip/placeholder_manager.c | 4 ++-- .../jpip/libopenjpip/placeholder_manager.h | 2 +- 8 files changed, 30 insertions(+), 23 deletions(-) diff --git a/applications/jpip/libopenjpip/auxtrans_manager.c b/applications/jpip/libopenjpip/auxtrans_manager.c index a983e5f4..2c3551bb 100644 --- a/applications/jpip/libopenjpip/auxtrans_manager.c +++ b/applications/jpip/libopenjpip/auxtrans_manager.c @@ -56,7 +56,7 @@ auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport) auxtrans.udpauxport = udp_auxport; if( 49152 <= tcp_auxport && tcp_auxport <= 65535) - auxtrans.tcplistensock = open_listeningsocket( tcp_auxport); + auxtrans.tcplistensock = open_listeningsocket( (uint16_t)tcp_auxport); else auxtrans.tcplistensock = -1; diff --git a/applications/jpip/libopenjpip/jpip_parser.c b/applications/jpip/libopenjpip/jpip_parser.c index 72219fe0..cd78b17c 100644 --- a/applications/jpip/libopenjpip/jpip_parser.c +++ b/applications/jpip/libopenjpip/jpip_parser.c @@ -360,27 +360,30 @@ void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int /* MM: shouldnt xmin/xmax be Byte4_t instead ? */ if( xmin < 0 || xmax < 0 || ymin < 0 || ymax < 0) return; + /* MM: I think the API should not really be int should it ? */ + if( tile_id < 0 ) + return; for( c=0; cSIZ.Csiz; c++) if( lastcomp == -1 /*all*/ || ( c<=lastcomp && comps[c])){ seq_id = 0; for( res_lev=0, dec_lev=codeidx->COD.numOfdecomp; dec_lev>=level; res_lev++, dec_lev--){ - XTsiz = get_tile_XSiz( codeidx->SIZ, tile_id, dec_lev); - YTsiz = get_tile_YSiz( codeidx->SIZ, tile_id, dec_lev); + XTsiz = get_tile_XSiz( codeidx->SIZ, (Byte4_t)tile_id, dec_lev); + YTsiz = get_tile_YSiz( codeidx->SIZ, (Byte4_t)tile_id, dec_lev); XPsiz = ( codeidx->COD.Scod & 0x01) ? codeidx->COD.XPsiz[ res_lev] : XTsiz; YPsiz = ( codeidx->COD.Scod & 0x01) ? codeidx->COD.YPsiz[ res_lev] : YTsiz; for( u=0; ucachemodel->target->codeidx; + if( tile_id < 0 ) + return; for( c=0; cSIZ.Csiz; c++) if( lastcomp == -1 /*all*/ || ( c<=lastcomp && comps[c])){ seq_id = 0; for( res_lev=0, dec_lev=codeidx->COD.numOfdecomp; dec_lev>=level; res_lev++, dec_lev--){ - XTsiz = get_tile_XSiz( codeidx->SIZ, tile_id, dec_lev); - YTsiz = get_tile_YSiz( codeidx->SIZ, tile_id, dec_lev); + XTsiz = get_tile_XSiz( codeidx->SIZ, (Byte4_t)tile_id, dec_lev); + YTsiz = get_tile_YSiz( codeidx->SIZ, (Byte4_t)tile_id, dec_lev); XPsiz = ( codeidx->COD.Scod & 0x01) ? codeidx->COD.XPsiz[ res_lev] : XTsiz; YPsiz = ( codeidx->COD.Scod & 0x01) ? codeidx->COD.YPsiz[ res_lev] : YTsiz; diff --git a/applications/jpip/libopenjpip/metadata_manager.c b/applications/jpip/libopenjpip/metadata_manager.c index 046f86cb..8e8e1e72 100644 --- a/applications/jpip/libopenjpip/metadata_manager.c +++ b/applications/jpip/libopenjpip/metadata_manager.c @@ -33,6 +33,8 @@ #include #include #include +#include +#include #ifdef SERVER #include "fcgi_stdio.h" @@ -64,7 +66,7 @@ metadatalist_param_t * const_metadatalist( int fd) box_param_t *box, *next; placeholderlist_param_t *phldlist; placeholder_param_t *phld; - int idx; + Byte8_t idx; Byte8_t filesize; if(!(filesize = (Byte8_t)get_filesize( fd))) @@ -120,7 +122,7 @@ void delete_metadatalist( metadatalist_param_t **list) free( *list); } -metadata_param_t * gene_metadata( int idx, boxlist_param_t *boxlist, placeholderlist_param_t *phldlist, boxcontents_param_t *boxcontents) +metadata_param_t * gene_metadata( Byte8_t idx, boxlist_param_t *boxlist, placeholderlist_param_t *phldlist, boxcontents_param_t *boxcontents) { metadata_param_t *bin; @@ -194,7 +196,7 @@ boxcontents_param_t * gene_boxcontents( OPJ_OFF_T offset, OPJ_SIZE_T length) return contents; } -metadata_param_t * search_metadata( int idx, metadatalist_param_t *list) +metadata_param_t * search_metadata( Byte8_t idx, metadatalist_param_t *list) { metadata_param_t *found; @@ -227,7 +229,7 @@ Byte8_t search_metadataidx( char boxtype[4], metadatalist_param_t *list) box_param_t *box = ptr->boxlist->first; while( box){ if( strncmp ( boxtype, box->type, 4) == 0) - return (Byte8_t)ptr->idx; + return ptr->idx; box = box->next; } } diff --git a/applications/jpip/libopenjpip/metadata_manager.h b/applications/jpip/libopenjpip/metadata_manager.h index a2e39621..089b19a5 100644 --- a/applications/jpip/libopenjpip/metadata_manager.h +++ b/applications/jpip/libopenjpip/metadata_manager.h @@ -41,7 +41,7 @@ typedef struct boxcontents_param{ /** metadata-bin parameters*/ typedef struct metadata_param{ - int idx; /**< index number*/ + Byte8_t idx; /**< index number*/ boxlist_param_t *boxlist; /**< box list*/ placeholderlist_param_t *placeholderlist; /**< placeholder box list*/ boxcontents_param_t *boxcontents; /**< box contens in case of no boxlist and placeholderlist*/ @@ -89,7 +89,7 @@ void delete_metadatalist( metadatalist_param_t **list); * @param[in] boxcontents boxcontents pointer * @return pointer to the generated metadata bin */ -metadata_param_t * gene_metadata( int idx, boxlist_param_t *boxlist, placeholderlist_param_t *phldlist, boxcontents_param_t *boxcontents); +metadata_param_t * gene_metadata( Byte8_t idx, boxlist_param_t *boxlist, placeholderlist_param_t *phldlist, boxcontents_param_t *boxcontents); /** * delete a metadata bin @@ -127,7 +127,7 @@ void print_allmetadata( metadatalist_param_t *list); * @param[in] list metadata-bin list pointer * @return found metadata-bin pointer */ -metadata_param_t * search_metadata( int idx, metadatalist_param_t *list); +metadata_param_t * search_metadata( Byte8_t idx, metadatalist_param_t *list); /** diff --git a/applications/jpip/libopenjpip/msgqueue_manager.c b/applications/jpip/libopenjpip/msgqueue_manager.c index 7e23c779..7716ded7 100644 --- a/applications/jpip/libopenjpip/msgqueue_manager.c +++ b/applications/jpip/libopenjpip/msgqueue_manager.c @@ -180,7 +180,7 @@ void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue) } } -void enqueue_tile( int tile_id, int level, msgqueue_param_t *msgqueue) +void enqueue_tile( Byte4_t tile_id, int level, msgqueue_param_t *msgqueue) { cachemodel_param_t *cachemodel; target_param_t *target; @@ -682,7 +682,7 @@ placeholder_param_t * parse_phld( Byte_t *datastream, Byte8_t metalength) strcpy( phld->TBox, "phld"); phld->Flags = big4( datastream+8); phld->OrigID = big8( datastream+12); - phld->OrigBHlen = metalength - 20; + phld->OrigBHlen = (Byte_t)(metalength - 20); phld->OrigBH = (Byte_t *)malloc(phld->OrigBHlen); memcpy( phld->OrigBH, datastream+20, phld->OrigBHlen); phld->next = NULL; diff --git a/applications/jpip/libopenjpip/msgqueue_manager.h b/applications/jpip/libopenjpip/msgqueue_manager.h index 61fa1a91..e9dc095a 100644 --- a/applications/jpip/libopenjpip/msgqueue_manager.h +++ b/applications/jpip/libopenjpip/msgqueue_manager.h @@ -54,7 +54,7 @@ typedef struct message_param{ Byte8_t bin_offset; /**< offset of the data in this message from the start of the data-bin*/ Byte8_t length; /**< message byte length*/ Byte8_t aux; /**<*/ - Byte8_t res_offset; /**< offset in the resource*/ + OPJ_OFF_T res_offset; /**< offset in the resource*/ placeholder_param_t *phld; /**< placeholder pointer in index*/ struct message_param *next; /**< pointer to the next message*/ } message_param_t; @@ -121,7 +121,7 @@ void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue); * @param[in] level decomposition level * @param[in,out] msgqueue message queue pointer */ -void enqueue_tile( int tile_id, int level, msgqueue_param_t *msgqueue); +void enqueue_tile( Byte4_t tile_id, int level, msgqueue_param_t *msgqueue); /** * enqueue precinct data-bin into message queue diff --git a/applications/jpip/libopenjpip/placeholder_manager.c b/applications/jpip/libopenjpip/placeholder_manager.c index 96efb0d8..4a37a13b 100644 --- a/applications/jpip/libopenjpip/placeholder_manager.c +++ b/applications/jpip/libopenjpip/placeholder_manager.c @@ -74,7 +74,7 @@ void delete_placeholderlist( placeholderlist_param_t **list) free( *list); } -placeholder_param_t * gene_placeholder( box_param_t *box, int origID) +placeholder_param_t * gene_placeholder( box_param_t *box, Byte8_t origID) { placeholder_param_t *placeholder; @@ -85,7 +85,7 @@ placeholder_param_t * gene_placeholder( box_param_t *box, int origID) placeholder->OrigID = origID; placeholder->OrigBH = fetch_headbytes( box); placeholder->OrigBHlen = box->headlen; - placeholder->LBox = 20+box->headlen; + placeholder->LBox = 20+(Byte4_t)box->headlen; placeholder->next = NULL; return placeholder; diff --git a/applications/jpip/libopenjpip/placeholder_manager.h b/applications/jpip/libopenjpip/placeholder_manager.h index a085bebd..ced20854 100644 --- a/applications/jpip/libopenjpip/placeholder_manager.h +++ b/applications/jpip/libopenjpip/placeholder_manager.h @@ -84,7 +84,7 @@ void delete_placeholderlist( placeholderlist_param_t **list); * @param[in] origID metadata-bin ID of the bin containing the contents of the original box * @return pointer to the generated placeholder */ -placeholder_param_t * gene_placeholder( box_param_t *box, int origID); +placeholder_param_t * gene_placeholder( box_param_t *box, Byte8_t origID); /**