[trunk] Use const keyword when appropriate

This commit is contained in:
Mathieu Malaterre 2012-07-25 13:10:43 +00:00
parent e38680a4df
commit efafbe9a5c
13 changed files with 35 additions and 33 deletions

View File

@ -90,7 +90,7 @@ typedef struct aux_response_param{
#endif
} aux_response_param_t;
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame);
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame);
void delete_auxresponse( aux_response_param_t **auxresponse);
@ -101,7 +101,7 @@ unsigned __stdcall aux_streaming( void *arg);
void * aux_streaming( void *arg);
#endif
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
{
aux_response_param_t *auxresponse;
#ifdef _WIN32
@ -133,7 +133,7 @@ void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[]
fprintf( FCGI_stderr, "Error: error in send_responsedata_on_aux(), udp not implemented\n");
}
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
{
aux_response_param_t *auxresponse;

View File

@ -67,6 +67,6 @@ void close_aux_transport( auxtrans_param_t auxtrans);
* @param[in] length length of data
* @param[in] maxlenPerFrame maximum data length to send per frame
*/
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
#endif /* !AUXTRANS_MANAGER_H_ */

View File

@ -60,7 +60,7 @@ channellist_param_t * gene_channellist(void)
channel_param_t * gene_channel( query_param_t query_param, auxtrans_param_t auxtrans, cachemodel_param_t *cachemodel, channellist_param_t *channellist)
{
channel_param_t *channel;
char transport[4][10] = { "non", "http", "http-tcp", "http-udp"};
const char transport[4][10] = { "non", "http", "http-tcp", "http-udp"};
if( !cachemodel){
fprintf( FCGI_stdout, "Status: 404\r\n");
@ -160,7 +160,7 @@ void print_allchannel( channellist_param_t *channellist)
}
}
channel_param_t * search_channel( char cid[], channellist_param_t *channellist)
channel_param_t * search_channel( const char cid[], channellist_param_t *channellist)
{
channel_param_t *foundchannel;

View File

@ -116,5 +116,5 @@ void print_allchannel( channellist_param_t *channellist);
* @param[in] channellist channel list pointer
* @return found channel pointer
*/
channel_param_t * search_channel( char cid[], channellist_param_t *channellist);
channel_param_t * search_channel( const char cid[], channellist_param_t *channellist);
#endif /* !CHANNEL_MANAGER_H_ */

View File

@ -65,7 +65,8 @@ msgtype_t identify_clientmsg( SOCKET connected_socket)
Byte_t * receive_JPIPstream( SOCKET connected_socket, char **target, char **tid, char **cid, OPJ_SIZE_T *streamlen)
{
char buf[BUF_LEN], versionstring[] = "version 1.2";
char buf[BUF_LEN];
const char versionstring[] = "version 1.2";
int idatalen;
OPJ_SIZE_T linelen, datalen;
Byte_t *jpipstream;

View File

@ -77,7 +77,7 @@ Byte_t * jpipstream_to_pnm( Byte_t *jpipstream, msgqueue_param_t *msgqueue, Byte
Byte_t *j2kstream; /* j2k or jp2 codestream */
Byte8_t j2klen;
FILE *fp;
char j2kfname[] = "tmp.j2k";
const char j2kfname[] = "tmp.j2k";
j2kstream = recons_j2k( msgqueue, jpipstream, csn, fw, fh, &j2klen);

View File

@ -75,7 +75,7 @@ void terminate_JPIPserver( server_record_t **rec)
free( *rec);
}
QR_t * parse_querystring( char *query_string)
QR_t * parse_querystring( const char *query_string)
{
QR_t *qr;
@ -127,7 +127,7 @@ void add_EORmsg( int fd, QR_t *qr);
void send_responsedata( server_record_t *rec, QR_t *qr)
{
int fd;
char tmpfname[] = "tmpjpipstream.jpp";
const char tmpfname[] = "tmpjpipstream.jpp";
Byte_t *jpipstream;
Byte8_t len_of_jpipstream;
@ -321,7 +321,7 @@ jpip_dec_param_t * init_jpipdecoder( bool jp2)
}
bool fread_jpip( char fname[], jpip_dec_param_t *dec)
bool fread_jpip( const char fname[], jpip_dec_param_t *dec)
{
int infd;
@ -361,7 +361,7 @@ void decode_jpip( jpip_dec_param_t *dec)
dec->jp2kstream = recons_j2k( dec->msgqueue, dec->jpipstream, dec->msgqueue->first->csn, 0, 0, &dec->jp2klen);
}
bool fwrite_jp2k( char fname[], jpip_dec_param_t *dec)
bool fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
{
int outfd;

View File

@ -104,7 +104,7 @@ void terminate_JPIPserver( server_record_t **rec);
* @param[in] query_string request query string
* @return initialized query/response data pointer
*/
QR_t * parse_querystring( char *query_string);
QR_t * parse_querystring( const char *query_string);
/**
* 2nd process; process JPIP request and construct message queue
@ -245,7 +245,7 @@ void destroy_jpipdecoder( jpip_dec_param_t **dec);
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
bool fread_jpip( char fname[], jpip_dec_param_t *dec);
bool fread_jpip( const char fname[], jpip_dec_param_t *dec);
/**
* Decode jpip codestream
@ -261,7 +261,7 @@ void decode_jpip( jpip_dec_param_t *dec);
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
bool fwrite_jp2k( char fname[], jpip_dec_param_t *dec);
bool fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
/**
* Option; print out parameter values to stderr

View File

@ -70,7 +70,7 @@ query_param_t * get_initquery(void);
* @param[out] fieldval string to copy the field value, if not found, NULL
* @return pointer to the next field string, if there is none, NULL
*/
char * get_fieldparam( char *stringptr, char *fieldname, char *fieldval);
char * get_fieldparam( const char *stringptr, char *fieldname, char *fieldval);
void parse_cclose( char *src, query_param_t *query_param);
void parse_metareq( char *field, query_param_t *query_param);
@ -85,10 +85,11 @@ void parse_comps( char *field, query_param_t *query_param);
/** maximum length of field value*/
#define MAX_LENOFFIELDVAL 128
query_param_t * parse_query( char *query_string)
query_param_t * parse_query( const char *query_string)
{
query_param_t *query_param;
char *pquery, fieldname[MAX_LENOFFIELDNAME], fieldval[MAX_LENOFFIELDVAL];
const char *pquery;
char fieldname[MAX_LENOFFIELDNAME], fieldval[MAX_LENOFFIELDVAL];
query_param = get_initquery();
@ -194,7 +195,7 @@ query_param_t * get_initquery(void)
}
char * get_fieldparam( char *stringptr, char *fieldname, char *fieldval)
char * get_fieldparam( const char *stringptr, char *fieldname, char *fieldval)
{
char *eqp, *andp, *nexfieldptr;

View File

@ -77,7 +77,7 @@ typedef struct query_param{
* @param[in] query_string request query string
* @return pointer to query parameters
*/
query_param_t * parse_query( char *query_string);
query_param_t * parse_query( const char *query_string);
/**
* print query parameters

View File

@ -74,7 +74,7 @@ targetlist_param_t * gene_targetlist(void)
* @param[out] tmpfname new file name if filepath is a URL
* @return file descriptor
*/
int open_jp2file( char filepath[], char tmpfname[]);
int open_jp2file( const char filepath[], char tmpfname[]);
target_param_t * gene_target( targetlist_param_t *targetlist, char *targetpath)
{
@ -215,7 +215,7 @@ void print_alltarget( targetlist_param_t *targetlist)
}
}
target_param_t * search_target( char targetname[], targetlist_param_t *targetlist)
target_param_t * search_target( const char targetname[], targetlist_param_t *targetlist)
{
target_param_t *foundtarget;
@ -231,7 +231,7 @@ target_param_t * search_target( char targetname[], targetlist_param_t *targetlis
return NULL;
}
target_param_t * search_targetBytid( char tid[], targetlist_param_t *targetlist)
target_param_t * search_targetBytid( const char tid[], targetlist_param_t *targetlist)
{
target_param_t *foundtarget;
@ -248,9 +248,9 @@ target_param_t * search_targetBytid( char tid[], targetlist_param_t *targetlist)
return NULL;
}
int open_remotefile( char filepath[], char tmpfname[]);
int open_remotefile( const char filepath[], char tmpfname[]);
int open_jp2file( char filepath[], char tmpfname[])
int open_jp2file( const char filepath[], char tmpfname[])
{
int fd;
char *data;
@ -300,7 +300,7 @@ int open_jp2file( char filepath[], char tmpfname[])
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream);
#endif
int open_remotefile( char filepath[], char tmpfname[])
int open_remotefile( const char filepath[], char tmpfname[])
{
#ifndef SERVER
(void)filepath;

View File

@ -143,7 +143,7 @@ void print_alltarget( targetlist_param_t *targetlist);
* @param[in] targetlist target list pointer
* @return found target pointer
*/
target_param_t * search_target( char targetname[], targetlist_param_t *targetlist);
target_param_t * search_target( const char targetname[], targetlist_param_t *targetlist);
/**
@ -153,7 +153,7 @@ target_param_t * search_target( char targetname[], targetlist_param_t *targetlis
* @param[in] targetlist target list pointer
* @return found target pointer
*/
target_param_t * search_targetBytid( char tid[], targetlist_param_t *targetlist);
target_param_t * search_targetBytid( const char tid[], targetlist_param_t *targetlist);
#endif /* !TARGET_MANAGER_H_ */

View File

@ -59,7 +59,7 @@
* @param[in] filename file name string
* @return file descriptor
*/
FILE * open_jp2file( char filename[]);
FILE * open_jp2file( const char filename[]);
/**
@ -69,7 +69,7 @@ FILE * open_jp2file( char filename[]);
* @param[out] fsize file byte size
* @return pointer to the xml file content buffer
*/
char * read_xmlfile( char filename[], long *fsize);
char * read_xmlfile( const char filename[], long *fsize);
int main(int argc, char *argv[])
{
@ -102,7 +102,7 @@ int main(int argc, char *argv[])
return 0;
}
FILE * open_jp2file( char filename[])
FILE * open_jp2file( const char filename[])
{
FILE *fp;
char *data;
@ -137,7 +137,7 @@ FILE * open_jp2file( char filename[])
return fp;
}
char * read_xmlfile( char filename[], long *fsize)
char * read_xmlfile( const char filename[], long *fsize)
{
FILE *fp;
char *data;