[trunk] change char* to const char* when possible. Remove more warnings
This commit is contained in:
parent
7e28fdc176
commit
91ee6ed60f
|
@ -58,7 +58,7 @@ void delete_cachelist(cachelist_param_t **cachelist)
|
||||||
free( *cachelist);
|
free( *cachelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_param_t * gene_cache( char *targetname, int csn, char *tid, char *cid)
|
cache_param_t * gene_cache( const char *targetname, int csn, char *tid, char *cid)
|
||||||
{
|
{
|
||||||
cache_param_t *cache;
|
cache_param_t *cache;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ void insert_cache_into_list( cache_param_t *cache, cachelist_param_t *cachelist)
|
||||||
cachelist->last = cache;
|
cachelist->last = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_param_t * search_cache( char targetname[], cachelist_param_t *cachelist)
|
cache_param_t * search_cache( const char targetname[], cachelist_param_t *cachelist)
|
||||||
{
|
{
|
||||||
cache_param_t *foundcache;
|
cache_param_t *foundcache;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist)
|
cache_param_t * search_cacheBycid( const char cid[], cachelist_param_t *cachelist)
|
||||||
{
|
{
|
||||||
cache_param_t *foundcache;
|
cache_param_t *foundcache;
|
||||||
int i;
|
int i;
|
||||||
|
@ -159,7 +159,7 @@ cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_param_t * search_cacheBytid( char tid[], cachelist_param_t *cachelist)
|
cache_param_t * search_cacheBytid( const char tid[], cachelist_param_t *cachelist)
|
||||||
{
|
{
|
||||||
cache_param_t *foundcache;
|
cache_param_t *foundcache;
|
||||||
|
|
||||||
|
@ -176,12 +176,12 @@ cache_param_t * search_cacheBytid( char tid[], cachelist_param_t *cachelist)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_cachecid( char *cid, cache_param_t *cache)
|
void add_cachecid( const char *cid, cache_param_t *cache)
|
||||||
{
|
{
|
||||||
if( !cid)
|
if( !cid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( (cache->cid = realloc( cache->cid, (cache->numOfcid+1)*sizeof(char *))) == NULL){
|
if( (cache->cid = realloc( cache->cid, (OPJ_SIZE_T)(cache->numOfcid+1)*sizeof(char *))) == NULL){
|
||||||
fprintf( stderr, "failed to add new cid to cache table in add_cachecid()\n");
|
fprintf( stderr, "failed to add new cid to cache table in add_cachecid()\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ void add_cachecid( char *cid, cache_param_t *cache)
|
||||||
cache->numOfcid ++;
|
cache->numOfcid ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_cachetid( char *tid, cache_param_t *cache)
|
void update_cachetid( const char *tid, cache_param_t *cache)
|
||||||
{
|
{
|
||||||
if( !tid)
|
if( !tid)
|
||||||
return;
|
return;
|
||||||
|
@ -203,9 +203,9 @@ void update_cachetid( char *tid, cache_param_t *cache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_cidInCache( char *cid, cache_param_t *cache);
|
void remove_cidInCache( const char *cid, cache_param_t *cache);
|
||||||
|
|
||||||
void remove_cachecid( char *cid, cachelist_param_t *cachelist)
|
void remove_cachecid( const char *cid, cachelist_param_t *cachelist)
|
||||||
{
|
{
|
||||||
cache_param_t *cache;
|
cache_param_t *cache;
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ void remove_cachecid( char *cid, cachelist_param_t *cachelist)
|
||||||
remove_cidInCache( cid, cache);
|
remove_cidInCache( cid, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_cidInCache( char *cid, cache_param_t *cache)
|
void remove_cidInCache( const char *cid, cache_param_t *cache)
|
||||||
{
|
{
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
char **tmp;
|
char **tmp;
|
||||||
|
@ -232,7 +232,7 @@ void remove_cidInCache( char *cid, cache_param_t *cache)
|
||||||
|
|
||||||
tmp = cache->cid;
|
tmp = cache->cid;
|
||||||
|
|
||||||
cache->cid = (char **)malloc( (cache->numOfcid-1)*sizeof(char *));
|
cache->cid = (char **)malloc( (OPJ_SIZE_T)(cache->numOfcid-1)*sizeof(char *));
|
||||||
|
|
||||||
for( i=0, j=0; i<cache->numOfcid; i++){
|
for( i=0, j=0; i<cache->numOfcid; i++){
|
||||||
if( i != idx){
|
if( i != idx){
|
||||||
|
|
|
@ -76,7 +76,7 @@ void delete_cachelist(cachelist_param_t **cachelist);
|
||||||
* @param[in] cid channel identifier
|
* @param[in] cid channel identifier
|
||||||
* @return pointer to the generated cache
|
* @return pointer to the generated cache
|
||||||
*/
|
*/
|
||||||
cache_param_t * gene_cache( char *targetname, int csn, char *tid, char *cid);
|
cache_param_t * gene_cache( const char *targetname, int csn, char *tid, char *cid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* delete a cache
|
* delete a cache
|
||||||
|
@ -101,7 +101,7 @@ void insert_cache_into_list( cache_param_t *cache, cachelist_param_t *cachelist)
|
||||||
* @param[in] cachelist cache list pointer
|
* @param[in] cachelist cache list pointer
|
||||||
* @return found cache pointer
|
* @return found cache pointer
|
||||||
*/
|
*/
|
||||||
cache_param_t * search_cache( char targetname[], cachelist_param_t *cachelist);
|
cache_param_t * search_cache( const char targetname[], cachelist_param_t *cachelist);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +121,7 @@ cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist);
|
||||||
* @param[in] cachelist cache list pointer
|
* @param[in] cachelist cache list pointer
|
||||||
* @return found cache pointer
|
* @return found cache pointer
|
||||||
*/
|
*/
|
||||||
cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist);
|
cache_param_t * search_cacheBycid( const char cid[], cachelist_param_t *cachelist);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,7 +131,7 @@ cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist);
|
||||||
* @param[in] cachelist cache list pointer
|
* @param[in] cachelist cache list pointer
|
||||||
* @return found cache pointer
|
* @return found cache pointer
|
||||||
*/
|
*/
|
||||||
cache_param_t * search_cacheBytid( char tid[], cachelist_param_t *cachelist);
|
cache_param_t * search_cacheBytid( const char tid[], cachelist_param_t *cachelist);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add cid into a cache
|
* add cid into a cache
|
||||||
|
@ -139,7 +139,7 @@ cache_param_t * search_cacheBytid( char tid[], cachelist_param_t *cachelist);
|
||||||
* @param[in] cid channel identifier
|
* @param[in] cid channel identifier
|
||||||
* @param[in] cache cache pointer
|
* @param[in] cache cache pointer
|
||||||
*/
|
*/
|
||||||
void add_cachecid( char *cid, cache_param_t *cache);
|
void add_cachecid( const char *cid, cache_param_t *cache);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +148,7 @@ void add_cachecid( char *cid, cache_param_t *cache);
|
||||||
* @param[in] tid target identifier
|
* @param[in] tid target identifier
|
||||||
* @param[in] cache cache pointer
|
* @param[in] cache cache pointer
|
||||||
*/
|
*/
|
||||||
void update_cachetid( char *tid, cache_param_t *cache);
|
void update_cachetid( const char *tid, cache_param_t *cache);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,7 +157,7 @@ void update_cachetid( char *tid, cache_param_t *cache);
|
||||||
* @param[in] cid channel identifier
|
* @param[in] cid channel identifier
|
||||||
* @param[in] cachelist cachelist pointer
|
* @param[in] cachelist cachelist pointer
|
||||||
*/
|
*/
|
||||||
void remove_cachecid( char *cid, cachelist_param_t *cachelist);
|
void remove_cachecid( const char *cid, cachelist_param_t *cachelist);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "imgreg_manager.h"
|
#include "imgreg_manager.h"
|
||||||
|
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
|
@ -138,6 +139,7 @@ int comp_decomplev( int fw, int fh, int Xsiz, int Ysiz)
|
||||||
|
|
||||||
find_level( 1000, &level, &fw, &fh, &xmin, &ymin, &xmax, &ymax);
|
find_level( 1000, &level, &fw, &fh, &xmin, &ymin, &xmax, &ymax);
|
||||||
|
|
||||||
|
assert( level >= 0 );
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "jp2k_encoder.h"
|
#include "jp2k_encoder.h"
|
||||||
#include "j2kheader_manager.h"
|
#include "j2kheader_manager.h"
|
||||||
#include "imgreg_manager.h"
|
#include "imgreg_manager.h"
|
||||||
|
@ -102,7 +103,7 @@ Byte_t * recons_jp2( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ptr = msgqueue->first;
|
ptr = msgqueue->first;
|
||||||
while(( ptr = search_message( METADATA_MSG, -1, csn, ptr))!=NULL){
|
while(( ptr = search_message( METADATA_MSG, (Byte8_t)-1, csn, ptr))!=NULL){
|
||||||
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;
|
||||||
|
@ -174,7 +175,7 @@ Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *j
|
||||||
Byte8_t binOffset;
|
Byte8_t binOffset;
|
||||||
message_param_t *ptr;
|
message_param_t *ptr;
|
||||||
SIZmarker_param_t SIZ;
|
SIZmarker_param_t SIZ;
|
||||||
int mindeclev;
|
OPJ_SIZE_T mindeclev;
|
||||||
|
|
||||||
*j2klen = 0;
|
*j2klen = 0;
|
||||||
j2kstream = add_mainhead_msgstream( msgqueue, jpipstream, j2kstream, csn, j2klen);
|
j2kstream = add_mainhead_msgstream( msgqueue, jpipstream, j2kstream, csn, j2klen);
|
||||||
|
@ -185,7 +186,7 @@ Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *j
|
||||||
if( fw <= 0 || fh <= 0)
|
if( fw <= 0 || fh <= 0)
|
||||||
mindeclev = 0;
|
mindeclev = 0;
|
||||||
else
|
else
|
||||||
mindeclev = comp_decomplev( fw, fh, SIZ.Xsiz, SIZ.Ysiz);
|
mindeclev = (OPJ_SIZE_T)comp_decomplev( fw, fh, (int)SIZ.Xsiz, (int)SIZ.Ysiz);
|
||||||
|
|
||||||
last_tileID = get_last_tileID( msgqueue, csn, false);
|
last_tileID = get_last_tileID( msgqueue, csn, false);
|
||||||
|
|
||||||
|
@ -249,7 +250,7 @@ Byte_t * recons_codestream_from_JPPstream( msgqueue_param_t *msgqueue, Byte_t *j
|
||||||
if( fw == 0 || fh == 0)
|
if( fw == 0 || fh == 0)
|
||||||
mindeclev = 0;
|
mindeclev = 0;
|
||||||
else
|
else
|
||||||
mindeclev = comp_decomplev( fw, fh, SIZ.Xsiz, SIZ.Ysiz);
|
mindeclev = comp_decomplev( fw, fh, (int)SIZ.Xsiz, (int)SIZ.Ysiz);
|
||||||
|
|
||||||
max_reslev = -1;
|
max_reslev = -1;
|
||||||
last_tileID = get_last_tileID( msgqueue, csn, true);
|
last_tileID = get_last_tileID( msgqueue, csn, true);
|
||||||
|
@ -298,7 +299,7 @@ Byte_t * add_mainhead_msgstream( msgqueue_param_t *msgqueue, Byte_t *origstream,
|
||||||
ptr = msgqueue->first;
|
ptr = msgqueue->first;
|
||||||
binOffset = 0;
|
binOffset = 0;
|
||||||
|
|
||||||
while(( ptr = search_message( MAINHEADER_MSG, -1, csn, ptr))!=NULL){
|
while(( ptr = search_message( MAINHEADER_MSG, (Byte8_t)-1, csn, ptr))!=NULL){
|
||||||
if( ptr->bin_offset == binOffset){
|
if( ptr->bin_offset == binOffset){
|
||||||
j2kstream = add_msgstream( ptr, origstream, j2kstream, j2klen);
|
j2kstream = add_msgstream( ptr, origstream, j2kstream, j2klen);
|
||||||
binOffset += ptr->length;
|
binOffset += ptr->length;
|
||||||
|
@ -506,12 +507,15 @@ Byte_t * recons_CPRLbitstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, B
|
||||||
|
|
||||||
int comp_numOfprcts( Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int r)
|
int comp_numOfprcts( Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int r)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
Byte4_t XTsiz, YTsiz;
|
Byte4_t XTsiz, YTsiz;
|
||||||
|
|
||||||
XTsiz = get_tile_XSiz( SIZ, tileID, COD.numOfdecomp-r);
|
XTsiz = get_tile_XSiz( SIZ, (Byte4_t)tileID, COD.numOfdecomp-r);
|
||||||
YTsiz = get_tile_YSiz( SIZ, tileID, COD.numOfdecomp-r);
|
YTsiz = get_tile_YSiz( SIZ, (Byte4_t)tileID, COD.numOfdecomp-r);
|
||||||
|
|
||||||
return ceil((double)XTsiz/(double)COD.XPsiz[r])*ceil((double)YTsiz/(double)COD.YPsiz[r]);
|
ret = (int)(ceil((double)XTsiz/(double)COD.XPsiz[r])*ceil((double)YTsiz/(double)COD.YPsiz[r]));
|
||||||
|
assert( ret >= 0 );
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Byte_t * add_padding( Byte8_t padding, Byte_t *j2kstream, Byte8_t *j2klen);
|
Byte_t * add_padding( Byte8_t padding, Byte_t *j2kstream, Byte8_t *j2klen);
|
||||||
|
@ -526,7 +530,7 @@ Byte_t * recons_packet( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
seqID = comp_seqID( tileID, SIZ, COD, res_idx, prct_idx);
|
seqID = comp_seqID( tileID, SIZ, COD, res_idx, prct_idx);
|
||||||
precID = comp_precinct_id( tileID, comp_idx, seqID, SIZ.Csiz, SIZ.XTnum*SIZ.YTnum);
|
precID = comp_precinct_id( (int)tileID, comp_idx, (int)seqID, (int)SIZ.Csiz, (int)SIZ.XTnum*(int)SIZ.YTnum);
|
||||||
|
|
||||||
ptr = msgqueue->first;
|
ptr = msgqueue->first;
|
||||||
binOffset = 0;
|
binOffset = 0;
|
||||||
|
@ -563,7 +567,7 @@ Byte_t * recons_precinct( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t
|
||||||
message_param_t *ptr;
|
message_param_t *ptr;
|
||||||
bool foundPrec;
|
bool foundPrec;
|
||||||
|
|
||||||
precID = comp_precinct_id( tileID, comp_idx, seqID, SIZ.Csiz, SIZ.XTnum*SIZ.YTnum);
|
precID = comp_precinct_id( (int)tileID, comp_idx, (int)seqID, (int)SIZ.Csiz, (int)SIZ.XTnum*(int)SIZ.YTnum);
|
||||||
|
|
||||||
ptr = msgqueue->first;
|
ptr = msgqueue->first;
|
||||||
binOffset = 0;
|
binOffset = 0;
|
||||||
|
@ -593,11 +597,13 @@ Byte8_t comp_seqID( Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD
|
||||||
{
|
{
|
||||||
Byte8_t seqID = 0;
|
Byte8_t seqID = 0;
|
||||||
int rr;
|
int rr;
|
||||||
|
assert( p >= 0);
|
||||||
|
assert( r >= 0);
|
||||||
|
|
||||||
for( rr=0; rr<r; rr++)
|
for( rr=0; rr<r; rr++)
|
||||||
seqID += comp_numOfprcts( tileID, SIZ, COD, rr);
|
seqID += (Byte8_t)comp_numOfprcts( tileID, SIZ, COD, rr);
|
||||||
|
|
||||||
seqID += p;
|
seqID += (Byte8_t)p;
|
||||||
|
|
||||||
return seqID;
|
return seqID;
|
||||||
}
|
}
|
||||||
|
@ -778,7 +784,7 @@ Byte_t * gene_emptytilestream( const Byte8_t tileID, Byte8_t *length)
|
||||||
*length = 14;
|
*length = 14;
|
||||||
buf = (Byte_t *)malloc(*length);
|
buf = (Byte_t *)malloc(*length);
|
||||||
|
|
||||||
Isot = (((Byte2_t)tileID) << 8) | ((((Byte2_t)tileID) & 0xf0) >> 8);
|
Isot = (Byte2_t)((((Byte2_t)tileID) << 8) | ((((Byte2_t)tileID) & 0xf0) >> 8));
|
||||||
|
|
||||||
memcpy( buf, &SOT, 2);
|
memcpy( buf, &SOT, 2);
|
||||||
memcpy( buf+2, &Lsot, 2);
|
memcpy( buf+2, &Lsot, 2);
|
||||||
|
|
|
@ -281,6 +281,7 @@ void enqueue_precinct( int seq_id, int tile_id, int comp_id, int layers, msgqueu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* MM FIXME: each params is coded on int, this is really not clear from the specs what it should be */
|
||||||
Byte8_t comp_precinct_id( int t, int c, int s, int num_components, int num_tiles)
|
Byte8_t comp_precinct_id( int t, int c, int s, int num_components, int num_tiles)
|
||||||
{
|
{
|
||||||
return t + (c + s * num_components ) * num_tiles;
|
return t + (c + s * num_components ) * num_tiles;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define snprintf _snprintf /* Visual Studio */
|
#define snprintf _snprintf /* Visual Studio */
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -336,8 +337,9 @@ int open_remotefile( char filepath[], char tmpfname[])
|
||||||
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
|
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||||
{
|
{
|
||||||
int *fd = (int *)stream;
|
int *fd = (int *)stream;
|
||||||
int written = write( *fd, ptr, size*nmemb);
|
ssize_t written = write( *fd, ptr, size*nmemb);
|
||||||
|
assert( written >= 0 );
|
||||||
|
|
||||||
return written;
|
return (size_t)written;
|
||||||
}
|
}
|
||||||
#endif /*SERVER*/
|
#endif /*SERVER*/
|
||||||
|
|
Loading…
Reference in New Issue