[trunk] Remove bool.h, use opj_bool instead

Fix remaining opj_calloc/malloc/free issues
This commit is contained in:
Mathieu Malaterre 2012-10-29 16:24:39 +00:00
parent 1a5791750b
commit 82d29d4c2a
28 changed files with 289 additions and 350 deletions

View File

@ -53,7 +53,7 @@ static int jpip_to_jp2(int argc,char *argv[])
return -1;
}
dec = init_jpipdecoder( true);
dec = init_jpipdecoder( OPJ_TRUE);
if(!( fread_jpip( argv[1], dec)))
return -1;
@ -63,7 +63,7 @@ static int jpip_to_jp2(int argc,char *argv[])
if(!(fwrite_jp2k( argv[2], dec)))
return -1;
output_log( true, false, true, dec);
output_log( OPJ_TRUE, OPJ_FALSE, OPJ_TRUE, dec);
destroy_jpipdecoder( &dec);
@ -92,7 +92,7 @@ static int jpip_to_j2k(int argc,char *argv[])
return -1;
}
dec = init_jpipdecoder( false);
dec = init_jpipdecoder( OPJ_FALSE);
if(!( fread_jpip( argv[1], dec)))
return -1;
@ -102,7 +102,7 @@ static int jpip_to_j2k(int argc,char *argv[])
if(!( fwrite_jp2k( argv[2], dec)))
return -1;
/* output_log( true, false, false, dec); */
/* output_log( OPJ_TRUE, OPJ_FALSE, OPJ_FALSE, dec); */
destroy_jpipdecoder( &dec);

View File

@ -84,7 +84,7 @@ int main(void)
#endif
{
QR_t *qr;
bool parse_status;
opj_bool parse_status;
#ifdef SERVER
query_string = getenv("QUERY_STRING");
@ -98,7 +98,7 @@ int main(void)
parse_status = process_JPIPrequest( server_record, qr);
#ifndef SERVER
local_log( true, true, parse_status, false, qr, server_record);
local_log( OPJ_TRUE, OPJ_TRUE, parse_status, OPJ_FALSE, qr, server_record);
#endif
if( parse_status)

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, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame);
aux_response_param_t * gene_auxresponse( opj_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, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
void send_responsedata_on_aux( opj_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,11 +133,11 @@ void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, const char
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, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
aux_response_param_t * gene_auxresponse( opj_bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
{
aux_response_param_t *auxresponse;
auxresponse = (aux_response_param_t *)malloc( sizeof(aux_response_param_t));
auxresponse = (aux_response_param_t *)opj_malloc( sizeof(aux_response_param_t));
auxresponse->cid = strdup( cid);
auxresponse->data = data;
@ -150,9 +150,9 @@ aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans,
void delete_auxresponse( aux_response_param_t **auxresponse)
{
free( (*auxresponse)->cid);
free( (*auxresponse)->data);
free( *auxresponse);
opj_free( (*auxresponse)->cid);
opj_free( (*auxresponse)->data);
opj_free( *auxresponse);
}
/**
@ -163,9 +163,9 @@ void delete_auxresponse( aux_response_param_t **auxresponse)
* @param [in] fp file pointer for log of aux stream
* @return true if identified, false otherwise
*/
bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
opj_bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
bool recv_ack( SOCKET connected_socket, void *data);
opj_bool recv_ack( SOCKET connected_socket, void *data);
#ifdef _WIN32
unsigned __stdcall aux_streaming( void *arg)
@ -186,7 +186,7 @@ void * aux_streaming( void *arg)
pthread_detach( pthread_self());
#endif
chunk = (unsigned char *)malloc( auxresponse->maxlenPerFrame);
chunk = (unsigned char *)opj_malloc( auxresponse->maxlenPerFrame);
maxLenOfBody = auxresponse->maxlenPerFrame - headlen;
remlen = auxresponse->datalen;
@ -216,7 +216,7 @@ void * aux_streaming( void *arg)
break;
}
}
free( chunk);
opj_free( chunk);
delete_auxresponse( &auxresponse);
@ -230,38 +230,38 @@ void * aux_streaming( void *arg)
}
bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
opj_bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
{
char *cid;
bool succeed;
opj_bool succeed;
if(!(cid = receive_string( connected_socket))){
fprintf( fp, "Error: error in identify_cid(), while receiving cid from client\n");
return false;
return OPJ_FALSE;
}
succeed = false;
succeed = OPJ_FALSE;
if( strncmp( refcid, cid, strlen( refcid)) == 0)
succeed = true;
succeed = OPJ_TRUE;
free( cid);
opj_free( cid);
return succeed;
}
bool recv_ack( SOCKET connected_socket, void *data)
opj_bool recv_ack( SOCKET connected_socket, void *data)
{
char *header;
bool succeed;
opj_bool succeed;
header = receive_stream( connected_socket, 8);
if( memcmp( header, data, 8) != 0)
succeed = false;
succeed = OPJ_FALSE;
else
succeed = true;
succeed = OPJ_TRUE;
free( header);
opj_free( header);
return succeed;
}

View File

@ -32,6 +32,7 @@
# define AUXTRANS_MANAGER_H_
#include "sock_manager.h"
#include "opj_includes.h"
/** auxiliary transport setting parameters*/
typedef struct auxtrans_param{
@ -67,6 +68,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, const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
void send_responsedata_on_aux( opj_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

@ -1,52 +0,0 @@
/*
* $Id$
*
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BOOL_H_
# define BOOL_H_
#ifndef false
#define false 0
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef true
#define true (!false)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
typedef char bool;
#endif /* !BOOL_H_ */

View File

@ -56,7 +56,7 @@ cachemodellist_param_t * gene_cachemodellist(void)
return cachemodellist;
}
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, bool reqJPP)
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, opj_bool reqJPP)
{
cachemodel_param_t *cachemodel;
faixbox_param_t *tilepart;
@ -71,27 +71,27 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
if( reqJPP){
if( target->jppstream)
cachemodel->jppstream = true;
cachemodel->jppstream = OPJ_TRUE;
else
cachemodel->jppstream = false;
cachemodel->jppstream = OPJ_FALSE;
} else{ /* reqJPT */
if( target->jptstream)
cachemodel->jppstream = false;
cachemodel->jppstream = OPJ_FALSE;
else
cachemodel->jppstream = true;
cachemodel->jppstream = OPJ_TRUE;
}
cachemodel->mhead_model = false;
cachemodel->mhead_model = OPJ_FALSE;
tilepart = target->codeidx->tilepart;
numOftiles = get_m( tilepart);
numOfelem = get_nmax( tilepart)*numOftiles;
cachemodel->tp_model = (bool *)opj_calloc( 1, numOfelem*sizeof(bool));
cachemodel->th_model = (bool *)opj_calloc( 1, numOftiles*sizeof(bool));
cachemodel->pp_model = (bool **)opj_malloc( target->codeidx->SIZ.Csiz*sizeof(bool *));
cachemodel->tp_model = (opj_bool *)opj_calloc( 1, numOfelem*sizeof(opj_bool));
cachemodel->th_model = (opj_bool *)opj_calloc( 1, numOftiles*sizeof(opj_bool));
cachemodel->pp_model = (opj_bool **)opj_malloc( target->codeidx->SIZ.Csiz*sizeof(opj_bool *));
for( i=0; i<target->codeidx->SIZ.Csiz; i++){
precpacket = target->codeidx->precpacket[i];
cachemodel->pp_model[i] = (bool *)opj_calloc( 1, get_nmax(precpacket)*get_m(precpacket)*sizeof(bool));
cachemodel->pp_model[i] = (opj_bool *)opj_calloc( 1, get_nmax(precpacket)*get_m(precpacket)*sizeof(opj_bool));
}
cachemodel->next = NULL;
@ -196,7 +196,7 @@ void delete_cachemodel( cachemodel_param_t **cachemodel)
opj_free( *cachemodel);
}
bool is_allsent( cachemodel_param_t cachemodel)
opj_bool is_allsent( cachemodel_param_t cachemodel)
{
target_param_t *target;
Byte8_t TPnum; /* num of tile parts in each tile */
@ -207,30 +207,30 @@ bool is_allsent( cachemodel_param_t cachemodel)
target = cachemodel.target;
if( !cachemodel.mhead_model)
return false;
return OPJ_FALSE;
TPnum = get_nmax( target->codeidx->tilepart);
if( cachemodel.jppstream){
for( i=0; i<target->codeidx->SIZ.XTnum*target->codeidx->SIZ.YTnum; i++){
if( !cachemodel.th_model[i])
return false;
return OPJ_FALSE;
for( j=0; j<target->codeidx->SIZ.Csiz; j++){
Pmax = get_nmax( target->codeidx->precpacket[j]);
for( k=0; k<Pmax; k++)
if( !cachemodel.pp_model[j][i*Pmax+k])
return false;
return OPJ_FALSE;
}
}
return true;
return OPJ_TRUE;
}
else{
for( i=0, n=0; i<target->codeidx->SIZ.YTnum; i++)
for( j=0; j<target->codeidx->SIZ.XTnum; j++)
for( k=0; k<TPnum; k++)
if( !cachemodel.tp_model[n++])
return false;
return true;
return OPJ_FALSE;
return OPJ_TRUE;
}
}

View File

@ -31,17 +31,16 @@
#ifndef CACHEMODEL_MANAGER_H_
# define CACHEMODEL_MANAGER_H_
#include "bool.h"
#include "target_manager.h"
/** Cache model parameters*/
typedef struct cachemodel_param{
target_param_t *target; /**< reference pointer to the target*/
bool jppstream; /**< return type, true: JPP-stream, false: JPT-stream*/
bool mhead_model; /**< main header model, if sent, 1, else 0*/
bool *tp_model; /**< dynamic array pointer of tile part model, if sent, 1, else 0*/
bool *th_model; /**< dynamic array pointer of tile header model*/
bool **pp_model; /**< dynamic array pointer of precint packet model*/
opj_bool jppstream; /**< return type, true: JPP-stream, false: JPT-stream*/
opj_bool mhead_model; /**< main header model, if sent, 1, else 0*/
opj_bool *tp_model; /**< dynamic array pointer of tile part model, if sent, 1, else 0*/
opj_bool *th_model; /**< dynamic array pointer of tile header model*/
opj_bool **pp_model; /**< dynamic array pointer of precint packet model*/
struct cachemodel_param *next; /**< pointer to the next cache model*/
} cachemodel_param_t;
@ -67,7 +66,7 @@ cachemodellist_param_t * gene_cachemodellist(void);
* @param[in] reqJPP if JPP-stream is desired true, JPT-stream false
* @return pointer to the generated cache model
*/
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, bool reqJPP);
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, opj_bool reqJPP);
/**
@ -94,7 +93,7 @@ cachemodel_param_t * search_cachemodel( target_param_t *target, cachemodellist_p
* @param[in] cachemodel cache model
* @return true if sent all, false otherwise
*/
bool is_allsent( cachemodel_param_t cachemodel);
opj_bool is_allsent( cachemodel_param_t cachemodel);
/**

View File

@ -86,7 +86,7 @@ void handle_JPIPstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist
if( tid) opj_free( tid);
if( cid) opj_free( cid);
response_signal( connected_socket, true);
response_signal( connected_socket, OPJ_TRUE);
}
void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist)
@ -192,7 +192,7 @@ void handle_dstCIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist)
cid = receive_string( connected_socket);
remove_cachecid( cid, cachelist);
response_signal( connected_socket, true);
response_signal( connected_socket, OPJ_TRUE);
opj_free( cid);
}

View File

@ -196,7 +196,7 @@ void send_SIZstream( SOCKET connected_socket, unsigned int width, unsigned int h
send_stream( connected_socket, responce, 9);
}
void response_signal( SOCKET connected_socket, bool succeed)
void response_signal( SOCKET connected_socket, opj_bool succeed)
{
Byte_t code;

View File

@ -31,9 +31,9 @@
#ifndef IMGSOCK_MANAGER_H_
# define IMGSOCK_MANAGER_H_
#include "bool.h"
#include "byte_manager.h"
#include "sock_manager.h"
#include "opj_includes.h"
#define NUM_OF_MSGTYPES 9
typedef enum eMSGTYPE{ JPIPSTREAM, PNMREQ, XMLREQ, TIDREQ, CIDREQ, CIDDST, SIZREQ, JP2SAVE, QUIT, MSGERROR} msgtype_t;
@ -112,7 +112,7 @@ void send_SIZstream( SOCKET connected_socket, unsigned int width, unsigned int h
* @param [in] connected_socket file descriptor of the connected socket
* @param [in] succeed whether if the requested process succeeded
*/
void response_signal( SOCKET connected_socket, bool succeed);
void response_signal( SOCKET connected_socket, opj_bool succeed);
#endif /* !IMGSOCK_MANAGER_H_ */

View File

@ -33,7 +33,6 @@
#include <math.h>
#include <string.h>
#include "bool.h"
#include "opj_inttypes.h"
#include "index_manager.h"
#include "box_manager.h"
@ -59,7 +58,7 @@
* @param[in] toplev_boxlist top level box list
* @return if correct (true) or wrong (false)
*/
bool check_JP2boxidx( boxlist_param_t *toplev_boxlist);
opj_bool check_JP2boxidx( boxlist_param_t *toplev_boxlist);
/**
* set code index parameters (parse cidx box)
@ -69,7 +68,7 @@ bool check_JP2boxidx( boxlist_param_t *toplev_boxlist);
* @param[out] codeidx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
bool set_cidxdata( box_param_t *cidx_box, index_param_t *codeidx);
opj_bool set_cidxdata( box_param_t *cidx_box, index_param_t *codeidx);
index_param_t * parse_jp2file( int fd)
{
@ -205,7 +204,7 @@ void delete_COD( CODmarker_param_t COD)
if( COD.YPsiz) opj_free( COD.YPsiz);
}
bool check_JP2boxidx( boxlist_param_t *toplev_boxlist)
opj_bool check_JP2boxidx( boxlist_param_t *toplev_boxlist)
{
box_param_t *iptr, *fidx, *prxy;
box_param_t *cidx, *jp2c;
@ -247,7 +246,7 @@ bool check_JP2boxidx( boxlist_param_t *toplev_boxlist)
ni = fetch_DBox1byte( prxy, pos);
if( ni != 1){
fprintf( FCGI_stderr, "Multiple indexes not supported\n");
return false;
return OPJ_FALSE;
}
pos += 1;
@ -264,7 +263,7 @@ bool check_JP2boxidx( boxlist_param_t *toplev_boxlist)
opj_free(prxy);
return true;
return OPJ_TRUE;
}
/**
@ -275,7 +274,7 @@ bool check_JP2boxidx( boxlist_param_t *toplev_boxlist)
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx);
opj_bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx);
/**
* set code index parameters from mhix box for main header
@ -286,7 +285,7 @@ bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx);
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx);
opj_bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx);
/**
* set code index parameters from tpix box
@ -296,7 +295,7 @@ bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, ind
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx);
opj_bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx);
/**
* set code index parameters from thix box
@ -306,7 +305,7 @@ bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx);
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx);
opj_bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx);
/**
* set code index parameters from ppix box
@ -316,9 +315,9 @@ bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx);
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx);
opj_bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx);
bool set_cidxdata( box_param_t *cidx_box, index_param_t *jp2idx)
opj_bool set_cidxdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *manf_box;
manfbox_param_t *manf;
@ -334,51 +333,51 @@ bool set_cidxdata( box_param_t *cidx_box, index_param_t *jp2idx)
if( !search_boxheader( "mhix", manf)){
fprintf( FCGI_stderr, "Error: mhix box not present in manfbox\n");
opj_free(jp2idx);
return false;
return OPJ_FALSE;
}
set_mainmhixdata( cidx_box, codestream, jp2idx);
if( !search_boxheader( "tpix", manf)){
fprintf( FCGI_stderr, "Error: tpix box not present in manfbox\n");
opj_free(jp2idx);
return false;
return OPJ_FALSE;
}
set_tpixdata( cidx_box, jp2idx);
if( !search_boxheader( "thix", manf)){
fprintf( FCGI_stderr, "Error: thix box not present in manfbox\n");
opj_free(jp2idx);
return false;
return OPJ_FALSE;
}
set_thixdata( cidx_box, jp2idx);
if( !search_boxheader( "ppix", manf)){
fprintf( FCGI_stderr, "Error: ppix box not present in manfbox\n");
opj_free(jp2idx);
return false;
return OPJ_FALSE;
}
set_ppixdata( cidx_box, jp2idx);
delete_manfbox( &manf);
opj_free( manf_box);
return true;
return OPJ_TRUE;
}
bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx)
opj_bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *box; /**< cptr box*/
Byte2_t dr, cont;
if( !(box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "cptr")))
return false;
return OPJ_FALSE;
/* DR: Data Reference. */
/* If 0, the codestream or its Fragment Table box exists in the current file*/
if(( dr = fetch_DBox2bytebigendian( box, 0))){
fprintf( FCGI_stderr, "Error: Codestream not present in current file\n");
opj_free( box);
return false;
return OPJ_FALSE;
}
/* CONT: Container Type*/
@ -387,7 +386,7 @@ bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx)
if(( cont = fetch_DBox2bytebigendian( box, 2))){
fprintf( FCGI_stderr, "Error: Can't cope with fragmented codestreams yet\n");
opj_free( box);
return false;
return OPJ_FALSE;
}
jp2idx->offset = (OPJ_OFF_T)fetch_DBox8bytebigendian( box, 4);
@ -395,7 +394,7 @@ bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx)
opj_free( box);
return true;
return OPJ_TRUE;
}
@ -409,7 +408,7 @@ bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx)
* @param[out] SIZ SIZ marker parameters pointer
* @return if succeeded (true) or failed (false)
*/
bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ);
opj_bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ);
/**
* set code index parameters from COD marker in codestream
@ -421,9 +420,9 @@ bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream,
* @param[out] COD COD marker parameters pointer
* @return if succeeded (true) or failed (false)
*/
bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD);
opj_bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD);
bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx)
opj_bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx)
{
box_param_t *mhix_box;
mhixbox_param_t *mhix;
@ -431,7 +430,7 @@ bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, ind
markeridx_param_t *codmkidx;
if( !(mhix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "mhix")))
return false;
return OPJ_FALSE;
jp2idx->mhead_length = fetch_DBox8bytebigendian( mhix_box, 0);
@ -446,22 +445,22 @@ bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, ind
delete_mhixbox( &mhix);
return true;
return OPJ_TRUE;
}
bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx)
opj_bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *tpix_box; /**< tpix box*/
box_param_t *faix_box; /**< faix box*/
if( !(tpix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "tpix"))){
fprintf( FCGI_stderr, "Error: tpix box not present in cidx box\n");
return false;
return OPJ_FALSE;
}
if( !(faix_box = gene_boxbyType( tpix_box->fd, get_DBoxoff( tpix_box), get_DBoxlen( tpix_box), "faix"))){
fprintf( FCGI_stderr, "Error: faix box not present in tpix box\n");
return false;
return OPJ_FALSE;
}
jp2idx->tilepart = gene_faixbox( faix_box);
@ -469,10 +468,10 @@ bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx)
opj_free( tpix_box);
opj_free( faix_box);
return true;
return OPJ_TRUE;
}
bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
opj_bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *thix_box, *manf_box, *mhix_box;
manfbox_param_t *manf;
@ -484,13 +483,13 @@ bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
if( !(thix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "thix"))){
fprintf( FCGI_stderr, "Error: thix box not present in cidx box\n");
return false;
return OPJ_FALSE;
}
if( !(manf_box = gene_boxbyType( thix_box->fd, get_DBoxoff( thix_box), get_DBoxlen( thix_box), "manf"))){
fprintf( FCGI_stderr, "Error: manf box not present in thix box\n");
opj_free( thix_box);
return false;
return OPJ_FALSE;
}
manf = gene_manfbox( manf_box);
@ -506,7 +505,7 @@ bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
delete_manfbox( &manf);
opj_free( manf_box);
opj_free( thix_box);
return false;
return OPJ_FALSE;
}
mhix = gene_mhixbox( mhix_box);
@ -521,10 +520,10 @@ bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
opj_free( manf_box);
opj_free( thix_box);
return true;
return OPJ_TRUE;
}
bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx)
opj_bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *ppix_box, *faix_box, *manf_box;
manfbox_param_t *manf; /**< manf*/
@ -535,14 +534,14 @@ bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx)
if( !(ppix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "ppix"))){
fprintf( FCGI_stderr, "Error: ppix box not present in cidx box\n");
return false;
return OPJ_FALSE;
}
inbox_offset = get_DBoxoff( ppix_box);
if( !(manf_box = gene_boxbyType( ppix_box->fd, inbox_offset, get_DBoxlen( ppix_box), "manf"))){
fprintf( FCGI_stderr, "Error: manf box not present in ppix box\n");
opj_free( ppix_box);
return false;
return OPJ_FALSE;
}
opj_free( ppix_box);
@ -558,12 +557,12 @@ bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx)
for( comp_idx=0; bh!=NULL; bh=bh->next, comp_idx++){
if( jp2idx->SIZ.Csiz <= comp_idx ){
fprintf( FCGI_stderr, "Error: num of faix boxes is not identical to num of components in ppix box\n");
return false;
return OPJ_FALSE;
}
if( !(faix_box = gene_boxbyOffset( cidx_box->fd, inbox_offset))){
fprintf( FCGI_stderr, "Error: faix box not present in ppix box\n");
return false;
return OPJ_FALSE;
}
faix = gene_faixbox( faix_box);
@ -575,10 +574,10 @@ bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx)
delete_manfbox( &manf);
return true;
return OPJ_TRUE;
}
bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ)
opj_bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ)
{
marker_param_t sizmkr;
int i;
@ -589,7 +588,7 @@ bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream,
if( sizmkidx->length != SIZ->Lsiz){
fprintf( FCGI_stderr, "Error: marker %#x index is not correct\n", sizmkidx->code);
return false;
return OPJ_FALSE;
}
SIZ->Rsiz = fetch_marker2bytebigendian( sizmkr, 2);
@ -611,10 +610,10 @@ bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream,
SIZ->XRsiz[i] = fetch_marker1byte( sizmkr, 39+i*3);
SIZ->YRsiz[i] = fetch_marker1byte( sizmkr, 40+i*3);
}
return true;
return OPJ_TRUE;
}
bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD)
opj_bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD)
{
marker_param_t codmkr;
int i;
@ -625,7 +624,7 @@ bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream,
if( codmkidx->length != COD->Lcod){
fprintf( FCGI_stderr, "Error: marker %#x index is not correct\n", codmkidx->code);
return false;
return OPJ_FALSE;
}
COD->Scod = fetch_marker1byte( codmkr, 2);
@ -649,7 +648,7 @@ bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream,
COD->XPsiz[0] = COD->YPsiz[0] = pow(2,15);
}
return true;
return OPJ_TRUE;
}
@ -723,10 +722,10 @@ Byte4_t min( Byte4_t n1, Byte4_t n2)
return n2;
}
bool isJPTfeasible( index_param_t index)
opj_bool isJPTfeasible( index_param_t index)
{
if( 1 < get_nmax( index.tilepart))
return true;
return OPJ_TRUE;
else
return false;
return OPJ_FALSE;
}

View File

@ -38,7 +38,6 @@
#include "faixbox_manager.h"
#include "metadata_manager.h"
#include "mhixbox_manager.h"
#include "bool.h"
/** progression order */
#if 0
@ -187,6 +186,6 @@ Byte4_t get_tile_YSiz( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
* @param[in] index index parameters
* @return true if JPT-stream is feasible
*/
bool isJPTfeasible( index_param_t index);
opj_bool isJPTfeasible( index_param_t index);
#endif /* !INDEX_MANAGER_H_ */

View File

@ -49,17 +49,17 @@
SIZmarker_param_t get_SIZmkrdata_from_j2kstream( Byte_t *SIZstream);
CODmarker_param_t get_CODmkrdata_from_j2kstream( Byte_t *CODstream);
bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD)
opj_bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD)
{
if( *j2kstream++ != 0xff || *j2kstream++ != 0x4f){
fprintf( FCGI_stderr, "Error, j2kstream is not starting with SOC marker\n");
return false;
return OPJ_FALSE;
}
if( SIZ){
*SIZ = get_SIZmkrdata_from_j2kstream( j2kstream);
if( SIZ->Lsiz == 0)
return false;
return OPJ_FALSE;
j2kstream += (SIZ->Lsiz+2);
}
@ -70,9 +70,9 @@ bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, C
*COD = get_CODmkrdata_from_j2kstream( j2kstream);
if( COD->Lcod == 0)
return false;
return OPJ_FALSE;
}
return true;
return OPJ_TRUE;
}
SIZmarker_param_t get_SIZmkrdata_from_j2kstream( Byte_t *SIZstream)
@ -145,38 +145,38 @@ CODmarker_param_t get_CODmkrdata_from_j2kstream( Byte_t *CODstream)
}
bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream);
opj_bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream);
Byte2_t modify_CODmkrstream( CODmarker_param_t COD, int numOfdecomp, Byte_t *CODstream);
bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen)
opj_bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen)
{
Byte2_t newLcod;
if( *j2kstream++ != 0xff || *j2kstream++ != 0x4f){
fprintf( FCGI_stderr, "Error, j2kstream is not starting with SOC marker\n");
return false;
return OPJ_FALSE;
}
if(!modify_SIZmkrstream( SIZ, COD.numOfdecomp-numOfdecomp, j2kstream))
return false;
return OPJ_FALSE;
j2kstream += SIZ.Lsiz+2;
if( !(newLcod = modify_CODmkrstream( COD, numOfdecomp, j2kstream)))
return false;
return OPJ_FALSE;
memmove( j2kstream+2+newLcod, j2kstream+2+COD.Lcod, *j2klen - (Byte8_t)(SIZ.Lsiz+COD.Lcod+6));
*j2klen -= (Byte8_t)( COD.Lcod - newLcod);
return true;
return OPJ_TRUE;
}
bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream)
opj_bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream)
{
int i;
if( *SIZstream++ != 0xff || *SIZstream++ != 0x51){
fprintf( FCGI_stderr, "Error, SIZ marker not found in the reconstructed j2kstream\n");
return false;
return OPJ_FALSE;
}
for( i=0; i<difOfdecomplev; i++){
@ -201,7 +201,7 @@ bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZ
modify_4Bytecode( SIZ.XTOsiz, SIZstream+24);
modify_4Bytecode( SIZ.YTOsiz, SIZstream+28);
return true;
return OPJ_TRUE;
}
Byte2_t modify_CODmkrstream( CODmarker_param_t COD, int numOfdecomp, Byte_t *CODstream)
@ -233,9 +233,9 @@ Byte2_t modify_CODmkrstream( CODmarker_param_t COD, int numOfdecomp, Byte_t *COD
return newLcod;
}
bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc);
opj_bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc);
bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen)
opj_bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen)
{
Byte4_t Psot; /* tile part length ref A.4.2 Start of tile-part SOT */
Byte_t *thstream, *SOTstream, *Psot_stream;
@ -245,7 +245,7 @@ bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, B
if( *SOTstream++ != 0xff || *SOTstream++ != 0x90){
fprintf( FCGI_stderr, "Error, thstream is not starting with SOT marker\n");
return false;
return OPJ_FALSE;
}
SOTstream += 4; /* skip Lsot & Isot */
@ -257,7 +257,7 @@ bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, B
while( !( *thstream == 0xff && *(thstream+1) == 0x93)){ /* search SOD */
if( numOfdecomp != -1 && *thstream == 0xff && *(thstream+1) == 0x53){ /* COC */
if( !modify_COCmkrstream( numOfdecomp, thstream, Csiz, &oldLcoc, &newLcoc))
return false;
return OPJ_FALSE;
memmove( thstream+newLcoc+2, thstream+oldLcoc+2, *j2klen - (Byte8_t)(thstream-j2kstream+oldLcoc+2));
*j2klen -= (Byte8_t)( oldLcoc - newLcoc);
@ -270,15 +270,15 @@ bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, B
Psot = (Byte4_t)((*j2klen)-SOToffset);
modify_4Bytecode( Psot, Psot_stream);
}
return true;
return OPJ_TRUE;
}
bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc)
opj_bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc)
{
if( numOfdecomp < 0 || numOfdecomp > 255 ) return false;
if( numOfdecomp < 0 || numOfdecomp > 255 ) return OPJ_FALSE;
if( *COCstream++ != 0xff || *COCstream++ != 0x53){
fprintf( FCGI_stderr, "Error, COC marker not found in the reconstructed j2kstream\n");
return false;
return OPJ_FALSE;
}
*oldLcoc = big2( COCstream);
@ -291,5 +291,5 @@ bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte
*COCstream = (Byte_t)numOfdecomp;
return true;
return OPJ_TRUE;
}

View File

@ -32,7 +32,6 @@
#ifndef J2KHEADER_MANAGER_H_
# define J2KHEADER_MANAGER_H_
#include "bool.h"
#include "byte_manager.h"
#include "index_manager.h"
@ -44,7 +43,7 @@
* @param[out] COD COD marker pointer
* @return if succeeded (true) or failed (false)
*/
bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD);
opj_bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD);
/**
* modify main header in j2k codestream to fit with the new number of decompositions
@ -56,7 +55,7 @@ bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, C
* @param[out] j2klen pointer to the length of j2k code stream
* @return if succeeded (true) or failed (false)
*/
bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen);
opj_bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen);
/**
* modify tile header in j2k codestream to fit with the tile part length, and new number of decompositions for multi-componet images
@ -68,6 +67,6 @@ bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SI
* @param[out] j2klen pointer to the length of j2k code stream
* @return if succeeded (true) or failed (false)
*/
bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen);
opj_bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen);
#endif /* !J2KHEADER_MANAGER_H_ */

View File

@ -127,7 +127,7 @@ Byte_t * recons_jp2( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn
return jp2stream;
}
bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue);
opj_bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue);
Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen);
Byte_t * recons_codestream_from_JPPstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen);
@ -142,7 +142,7 @@ Byte_t * recons_codestream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte
return recons_codestream_from_JPTstream( msgqueue, jpipstream, csn, fw, fh, codelen);
}
bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue)
opj_bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue)
{
message_param_t *msg;
@ -150,28 +150,28 @@ bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue)
while( msg){
if( msg->csn == csn){
if( msg->class_id <= 2)
return true;
return OPJ_TRUE;
else
if( msg->class_id == 4 || msg->class_id == 5)
return false;
return OPJ_FALSE;
}
msg = msg->next;
}
fprintf( FCGI_stderr, "Error, message of csn %" PRId64 " not found\n", csn);
return false;
return OPJ_FALSE;
}
Byte_t * add_mainhead_msgstream( msgqueue_param_t *msgqueue, Byte_t *origstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t *j2klen);
Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, bool isJPPstream);
Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, opj_bool isJPPstream);
Byte_t * add_emptytilestream( const Byte8_t tileID, Byte_t *j2kstream, Byte8_t *j2klen);
Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen)
{
Byte_t *j2kstream = NULL;
Byte8_t last_tileID, tileID;
bool found;
opj_bool found;
Byte8_t binOffset;
message_param_t *ptr;
SIZmarker_param_t SIZ;
@ -188,16 +188,16 @@ Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *j
else
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, OPJ_FALSE);
for( tileID=0; tileID <= last_tileID; tileID++){
found = false;
found = OPJ_FALSE;
binOffset = 0;
ptr = msgqueue->first;
while(( ptr = search_message( TILE_MSG, tileID, csn, ptr))!=NULL){
if( ptr->bin_offset == binOffset){
found = true;
found = OPJ_TRUE;
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
binOffset += ptr->length;
}
@ -207,7 +207,7 @@ Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *j
while(( ptr = search_message( EXT_TILE_MSG, tileID, csn, ptr))!=NULL){
if( ptr->aux > mindeclev){ /* FIXME: pointer comparison ? */
if( ptr->bin_offset == binOffset){
found = true;
found = OPJ_TRUE;
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
binOffset += ptr->length;
}
@ -234,7 +234,7 @@ Byte_t * recons_codestream_from_JPPstream( msgqueue_param_t *msgqueue, Byte_t *j
Byte_t *j2kstream = NULL;
Byte8_t tileID, last_tileID;
Byte8_t SOToffset;
bool foundTH;
opj_bool foundTH;
Byte8_t binOffset;
message_param_t *ptr;
SIZmarker_param_t SIZ;
@ -253,19 +253,19 @@ Byte_t * recons_codestream_from_JPPstream( msgqueue_param_t *msgqueue, Byte_t *j
mindeclev = comp_decomplev( fw, fh, (int)SIZ.Xsiz, (int)SIZ.Ysiz);
max_reslev = -1;
last_tileID = get_last_tileID( msgqueue, csn, true);
last_tileID = get_last_tileID( msgqueue, csn, OPJ_TRUE);
for( tileID=0; tileID <= last_tileID; tileID++){
ptr = msgqueue->first;
binOffset = 0;
foundTH = false;
foundTH = OPJ_FALSE;
SOToffset = *j2klen;
while(( ptr = search_message( TILE_HEADER_MSG, tileID, csn, ptr))!=NULL){
if( ptr->bin_offset == binOffset){
j2kstream = add_SOTmkr( j2kstream, j2klen);
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
foundTH = true;
foundTH = OPJ_TRUE;
binOffset += ptr->length;
}
ptr = ptr->next;
@ -526,7 +526,7 @@ Byte_t * recons_packet( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *
{
Byte8_t seqID, precID, binOffset;
message_param_t *ptr;
bool foundPrec;
opj_bool foundPrec;
int l;
seqID = comp_seqID( tileID, SIZ, COD, res_idx, prct_idx);
@ -534,14 +534,14 @@ Byte_t * recons_packet( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *
ptr = msgqueue->first;
binOffset = 0;
foundPrec = false;
foundPrec = OPJ_FALSE;
l = 0;
while(( ptr = search_message( PRECINCT_MSG, precID, csn, ptr))!=NULL){
if( ptr->bin_offset == binOffset){
if( lay_idx == l){
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
foundPrec = true;
foundPrec = OPJ_TRUE;
if( *max_reslev < res_idx)
*max_reslev = res_idx;
@ -565,19 +565,19 @@ Byte_t * recons_precinct( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t
{
Byte8_t precID, binOffset;
message_param_t *ptr;
bool foundPrec;
opj_bool foundPrec;
precID = comp_precinct_id( (int)tileID, comp_idx, (int)seqID, (int)SIZ.Csiz, (int)SIZ.XTnum*(int)SIZ.YTnum);
ptr = msgqueue->first;
binOffset = 0;
foundPrec = false;
foundPrec = OPJ_FALSE;
while(( ptr = search_message( PRECINCT_MSG, precID, csn, ptr))!=NULL){
if( ptr->bin_offset == binOffset){
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
foundPrec = true;
foundPrec = OPJ_TRUE;
binOffset += ptr->length;
if( *max_reslev < res_idx)
*max_reslev = res_idx;
@ -608,7 +608,7 @@ Byte8_t comp_seqID( Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD
return seqID;
}
Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, bool isJPPstream)
Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, opj_bool isJPPstream)
{
Byte8_t last_tileID = 0;
message_param_t *msg;

View File

@ -46,37 +46,37 @@
#endif /*SERVER*/
bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target)
opj_bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target)
{
if( query_param.tid){
if( strcmp( query_param.tid, "0") != 0 ){
if( query_param.cid[0] != '\0'){
fprintf( FCGI_stdout, "Reason: Target can not be specified both through tid and cid\r\n");
fprintf( FCGI_stdout, "Status: 400\r\n");
return false;
return OPJ_FALSE;
}
if( ( *target = search_targetBytid( query_param.tid, targetlist)))
return true;
return OPJ_TRUE;
}
}
if( query_param.target)
if( !( *target = search_target( query_param.target, targetlist)))
if(!( *target = gene_target( targetlist, query_param.target)))
return false;
return OPJ_FALSE;
if( *target){
fprintf( FCGI_stdout, "JPIP-tid: %s\r\n", (*target)->tid);
return true;
return OPJ_TRUE;
}
else{
fprintf( FCGI_stdout, "Reason: target not found\r\n");
fprintf( FCGI_stdout, "Status: 400\r\n");
return false;
return OPJ_FALSE;
}
}
bool associate_channel( query_param_t query_param,
opj_bool associate_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel)
@ -88,12 +88,12 @@ bool associate_channel( query_param_t query_param,
}
else{
fprintf( FCGI_stderr, "Error: process canceled\n");
return false;
return OPJ_FALSE;
}
return true;
return OPJ_TRUE;
}
bool open_channel( query_param_t query_param,
opj_bool open_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
auxtrans_param_t auxtrans,
target_param_t *target,
@ -107,7 +107,7 @@ bool open_channel( query_param_t query_param,
*cursession = gene_session( sessionlist);
if( !( cachemodel = search_cachemodel( target, (*cursession)->cachemodellist)))
if( !(cachemodel = gene_cachemodel( (*cursession)->cachemodellist, target, query_param.return_type==JPPstream)))
return false;
return OPJ_FALSE;
}
else
if( *curchannel)
@ -115,12 +115,12 @@ bool open_channel( query_param_t query_param,
*curchannel = gene_channel( query_param, auxtrans, cachemodel, (*cursession)->channellist);
if( *curchannel == NULL)
return false;
return OPJ_FALSE;
return true;
return OPJ_TRUE;
}
bool close_channel( query_param_t query_param,
opj_bool close_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel)
@ -134,7 +134,7 @@ bool close_channel( query_param_t query_param,
#endif
/* all channels associatd with the session will be closed */
if( !delete_session( cursession, sessionlist))
return false;
return OPJ_FALSE;
}
else{
/* check if all entry belonging to the same session */
@ -144,12 +144,12 @@ bool close_channel( query_param_t query_param,
/* In case of the first entry of close cid */
if( *cursession == NULL){
if( !search_session_and_channel( cclose, sessionlist, cursession, curchannel))
return false;
return OPJ_FALSE;
}
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;
return OPJ_FALSE;
}
}
@ -163,7 +163,7 @@ bool close_channel( query_param_t query_param,
/* In case of empty session */
delete_session( cursession, sessionlist);
}
return true;
return OPJ_TRUE;
}
@ -183,10 +183,10 @@ void enqueue_imagedata( query_param_t query_param, msgqueue_param_t *msgqueue);
* @param[in,out] msgqueue message queue pointer
* @return if succeeded (true) or failed (false)
*/
bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue);
opj_bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue);
bool gene_JPIPstream( query_param_t query_param,
opj_bool gene_JPIPstream( query_param_t query_param,
target_param_t *target,
session_param_t *cursession,
channel_param_t *curchannel,
@ -197,15 +197,15 @@ bool gene_JPIPstream( query_param_t query_param,
if( !cursession || !curchannel){ /* stateless */
if( !target)
return false;
return OPJ_FALSE;
if( !(cachemodel = gene_cachemodel( NULL, target, query_param.return_type==JPPstream)))
return false;
*msgqueue = gene_msgqueue( true, cachemodel);
return OPJ_FALSE;
*msgqueue = gene_msgqueue( OPJ_TRUE, cachemodel);
}
else{ /* session */
cachemodel = curchannel->cachemodel;
target = cachemodel->target;
*msgqueue = gene_msgqueue( false, cachemodel);
*msgqueue = gene_msgqueue( OPJ_FALSE, cachemodel);
}
codeidx = target->codeidx;
@ -225,10 +225,10 @@ bool gene_JPIPstream( query_param_t query_param,
/*meta*/
if( query_param.box_type[0][0] != 0 && query_param.len != 0)
if( !enqueue_metabins( query_param, codeidx->metadatalist, *msgqueue))
return false;
return OPJ_FALSE;
if( query_param.metadata_only)
return true;
return OPJ_TRUE;
/* main header */
if( !cachemodel->mhead_model && query_param.len != 0)
@ -238,7 +238,7 @@ bool gene_JPIPstream( query_param_t query_param,
if( (query_param.fx > 0 && query_param.fy > 0))
enqueue_imagedata( query_param, *msgqueue);
return true;
return OPJ_TRUE;
}
@ -257,7 +257,7 @@ bool gene_JPIPstream( query_param_t query_param,
* @param[in] msgqueue message queue
* @return
*/
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, opj_bool *comps, int layers, msgqueue_param_t *msgqueue);
/**
* enqueue all precincts inside a tile into the queue
@ -270,7 +270,7 @@ void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int
* @param[in] msgqueue message queue
* @return
*/
void enqueue_allprecincts( int tile_id, int level, int lastcomp, bool *comps, int layers, msgqueue_param_t *msgqueue);
void enqueue_allprecincts( int tile_id, int level, int lastcomp, opj_bool *comps, int layers, msgqueue_param_t *msgqueue);
void enqueue_imagedata( query_param_t query_param, msgqueue_param_t *msgqueue)
{
@ -347,7 +347,7 @@ void enqueue_imagedata( query_param_t query_param, 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)
void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int level, int lastcomp, opj_bool *comps, int layers, msgqueue_param_t *msgqueue)
{
index_param_t *codeidx;
int c, u, v, res_lev, dec_lev;
@ -406,7 +406,7 @@ void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int
}
}
void enqueue_allprecincts( int tile_id, int level, int lastcomp, bool *comps, int layers, msgqueue_param_t *msgqueue)
void enqueue_allprecincts( int tile_id, int level, int lastcomp, opj_bool *comps, int layers, msgqueue_param_t *msgqueue)
{
index_param_t *codeidx;
int c, i, res_lev, dec_lev;
@ -435,14 +435,14 @@ void enqueue_allprecincts( int tile_id, int level, int lastcomp, bool *comps, in
}
}
bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
opj_bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
{
int i;
for( i=0; query_param.box_type[i][0]!=0 && i<MAX_NUMOFBOX; i++){
if( query_param.box_type[i][0] == '*'){
fprintf( FCGI_stdout, "Status: 501\r\n");
fprintf( FCGI_stdout, "Reason: metareq with all box-property * not implemented\r\n");
return false;
return OPJ_FALSE;
}
else{
Byte8_t idx = search_metadataidx( query_param.box_type[i], metadatalist);
@ -452,9 +452,9 @@ bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadata
else{
fprintf( FCGI_stdout, "Status: 400\r\n");
fprintf( FCGI_stdout, "Reason: box-type %.4s not found\r\n", query_param.box_type[i]);
return false;
return OPJ_FALSE;
}
}
}
return true;
return OPJ_TRUE;
}

View File

@ -32,7 +32,6 @@
#ifndef JPIP_PARSER_H_
# define JPIP_PARSER_H_
#include "bool.h"
#include "query_parser.h"
#include "session_manager.h"
#include "target_manager.h"
@ -47,7 +46,7 @@
* @param[out] target address of target pointer
* @return if succeeded (true) or failed (false)
*/
bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target);
opj_bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target);
/**
* REQUEST: channel association
@ -59,7 +58,7 @@ bool identify_target( query_param_t query_param, targetlist_param_t *targetlist,
* @param[out] curchannel address of the associated channel pointer
* @return if succeeded (true) or failed (false)
*/
bool associate_channel( query_param_t query_param,
opj_bool associate_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel);
@ -74,7 +73,7 @@ bool associate_channel( query_param_t query_param,
* @param[in,out] curchannel address of the associated/opened channel pointer
* @return if succeeded (true) or failed (false)
*/
bool open_channel( query_param_t query_param,
opj_bool open_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
auxtrans_param_t auxtrans,
target_param_t *target,
@ -90,7 +89,7 @@ bool open_channel( query_param_t query_param,
* @param[in,out] curchannel address of the deleting channel pointer
* @return if succeeded (true) or failed (false)
*/
bool close_channel( query_param_t query_param,
opj_bool close_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel);
@ -105,7 +104,7 @@ bool close_channel( query_param_t query_param,
* @param[out] msgqueue address of the message queue pointer
* @return if succeeded (true) or failed (false)
*/
bool gene_JPIPstream( query_param_t query_param,
opj_bool gene_JPIPstream( query_param_t query_param,
target_param_t *target,
session_param_t *cursession,
channel_param_t *curchannel,

View File

@ -56,7 +56,7 @@
#define logstream stderr
#endif /*SERVER*/
msgqueue_param_t * gene_msgqueue( bool stateless, cachemodel_param_t *cachemodel)
msgqueue_param_t * gene_msgqueue( opj_bool stateless, cachemodel_param_t *cachemodel)
{
msgqueue_param_t *msgqueue;
@ -137,7 +137,7 @@ void enqueue_mainheader( msgqueue_param_t *msgqueue)
msg = (message_param_t *)opj_malloc( sizeof(message_param_t));
msg->last_byte = true;
msg->last_byte = OPJ_TRUE;
msg->in_class_id = 0;
msg->class_id = MAINHEADER_MSG;
assert( target->csn >= 0 );
@ -151,7 +151,7 @@ void enqueue_mainheader( msgqueue_param_t *msgqueue)
enqueue_message( msg, msgqueue);
cachemodel->mhead_model = true;
cachemodel->mhead_model = OPJ_TRUE;
}
void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue)
@ -167,7 +167,7 @@ void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue)
if( !cachemodel->th_model[ tile_id]){
msg = (message_param_t *)opj_malloc( sizeof(message_param_t));
msg->last_byte = true;
msg->last_byte = OPJ_TRUE;
assert( tile_id >= 0 );
msg->in_class_id = (Byte8_t)tile_id;
msg->class_id = TILE_HEADER_MSG;
@ -181,7 +181,7 @@ void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue)
msg->next = NULL;
enqueue_message( msg, msgqueue);
cachemodel->th_model[ tile_id] = true;
cachemodel->th_model[ tile_id] = OPJ_TRUE;
}
}
@ -189,7 +189,7 @@ void enqueue_tile( Byte4_t tile_id, int level, msgqueue_param_t *msgqueue)
{
cachemodel_param_t *cachemodel;
target_param_t *target;
bool *tp_model;
opj_bool *tp_model;
Byte8_t numOftparts; /* num of tile parts par tile*/
Byte8_t numOftiles;
index_param_t *codeidx;
@ -236,7 +236,7 @@ void enqueue_tile( Byte4_t tile_id, int level, msgqueue_param_t *msgqueue)
enqueue_message( msg, msgqueue);
tp_model[i] = true;
tp_model[i] = OPJ_TRUE;
}
binOffset += binLength;
}
@ -283,7 +283,7 @@ void enqueue_precinct( int seq_id, int tile_id, int comp_id, int layers, msgqueu
enqueue_message( msg, msgqueue);
cachemodel->pp_model[comp_id][tile_id*(int)nmax+seq_id*numOflayers+layer_id] = true;
cachemodel->pp_model[comp_id][tile_id*(int)nmax+seq_id*numOflayers+layer_id] = OPJ_TRUE;
}
binOffset += binLength;
}
@ -323,7 +323,7 @@ void enqueue_metadata( Byte8_t meta_id, msgqueue_param_t *msgqueue)
if( metadata->boxcontents)
enqueue_boxcontents( meta_id, metadata->boxcontents, msgqueue, &binOffset);
msgqueue->last->last_byte = true;
msgqueue->last->last_byte = OPJ_TRUE;
}
message_param_t * gene_metamsg( Byte8_t meta_id, Byte8_t binoffset, Byte8_t length, OPJ_OFF_T res_offset, placeholder_param_t *phld, Byte8_t csn);
@ -378,7 +378,7 @@ message_param_t * gene_metamsg( Byte8_t meta_id, Byte8_t binOffset, Byte8_t leng
msg = (message_param_t *)opj_malloc( sizeof(message_param_t));
msg->last_byte = false;
msg->last_byte = OPJ_FALSE;
msg->in_class_id = meta_id;
msg->class_id = METADATA_MSG;
msg->csn = csn;
@ -600,7 +600,7 @@ void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset,
ptr = parse_bin_id_vbas( ptr, &bb, &c, &msg->in_class_id);
msg->last_byte = c == 1 ? true : false;
msg->last_byte = c == 1 ? OPJ_TRUE : OPJ_FALSE;
if( bb >= 2)
ptr = parse_vbas( ptr, &class_id);

View File

@ -32,7 +32,6 @@
#ifndef MSGQUEUE_MANAGER_H_
# define MSGQUEUE_MANAGER_H_
#include "bool.h"
#include "byte_manager.h"
#include "cachemodel_manager.h"
#include "placeholder_manager.h"
@ -47,7 +46,7 @@
/** message parameters */
typedef struct message_param{
bool last_byte; /**< if message contains the last byte of the data-bin*/
opj_bool last_byte; /**< if message contains the last byte of the data-bin*/
Byte8_t in_class_id; /**< in-class identifier A.2.3*/
Byte8_t class_id; /**< class identifiers */
Byte8_t csn; /**< index of the codestream*/
@ -63,7 +62,7 @@ typedef struct message_param{
typedef struct msgqueue_param{
message_param_t *first; /**< first message pointer of the list*/
message_param_t *last; /**< last message pointer of the list*/
bool stateless; /**< if this is a stateless message queue*/
opj_bool stateless; /**< if this is a stateless message queue*/
cachemodel_param_t *cachemodel; /**< reference cachemodel pointer*/
} msgqueue_param_t;
@ -74,7 +73,7 @@ typedef struct msgqueue_param{
* @param[in] cachemodel cachemodel pointer
* @return generated message queue pointer
*/
msgqueue_param_t * gene_msgqueue( bool stateless, cachemodel_param_t *cachemodel);
msgqueue_param_t * gene_msgqueue( opj_bool stateless, cachemodel_param_t *cachemodel);
/**
* delete message queue

View File

@ -88,7 +88,7 @@ QR_t * parse_querystring( const char *query_string)
return qr;
}
bool process_JPIPrequest( server_record_t *rec, QR_t *qr)
opj_bool process_JPIPrequest( server_record_t *rec, QR_t *qr)
{
target_param_t *target = NULL;
session_param_t *cursession = NULL;
@ -96,30 +96,30 @@ bool process_JPIPrequest( server_record_t *rec, QR_t *qr)
if( qr->query->target || qr->query->tid){
if( !identify_target( *(qr->query), rec->targetlist, &target))
return false;
return OPJ_FALSE;
}
if( qr->query->cid){
if( !associate_channel( *(qr->query), rec->sessionlist, &cursession, &curchannel))
return false;
return OPJ_FALSE;
qr->channel = curchannel;
}
if( qr->query->cnew != non){
if( !open_channel( *(qr->query), rec->sessionlist, rec->auxtrans, target, &cursession, &curchannel))
return false;
return OPJ_FALSE;
qr->channel = curchannel;
}
if( qr->query->cclose)
if( !close_channel( *(qr->query), rec->sessionlist, &cursession, &curchannel))
return false;
return OPJ_FALSE;
if( (qr->query->fx > 0 && qr->query->fy > 0) || qr->query->box_type[0][0] != 0 || qr->query->len > 0)
if( !gene_JPIPstream( *(qr->query), target, cursession, curchannel, &qr->msgqueue))
return false;
return OPJ_FALSE;
return true;
return OPJ_TRUE;
}
void add_EORmsg( int fd, QR_t *qr);
@ -190,7 +190,7 @@ void end_QRprocess( server_record_t *rec, QR_t **qr)
}
void local_log( bool query, bool messages, bool sessions, bool targets, QR_t *qr, server_record_t *rec)
void local_log( opj_bool query, opj_bool messages, opj_bool sessions, opj_bool targets, QR_t *qr, server_record_t *rec)
{
if( query)
print_queryparam( *qr->query);
@ -216,7 +216,7 @@ dec_server_record_t * OPJ_CALLCONV init_dec_server( int port)
record->cachelist = gene_cachelist();
record->jpipstream = NULL;
record->jpipstreamlen = 0;
record->msgqueue = gene_msgqueue( true, NULL);
record->msgqueue = gene_msgqueue( OPJ_TRUE, NULL);
record->listening_socket = open_listeningsocket( (uint16_t)port);
return record;
@ -247,9 +247,9 @@ client_t OPJ_CALLCONV accept_connection( dec_server_record_t *rec)
return client;
}
bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec)
opj_bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec)
{
bool quit = false;
opj_bool quit = OPJ_FALSE;
msgtype_t msgtype = identify_clientmsg( client);
switch( msgtype){
@ -286,7 +286,7 @@ bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec)
break;
case QUIT:
quit = true;
quit = OPJ_TRUE;
save_codestream( rec->jpipstream, rec->jpipstreamlen, "jpt");
break;
case MSGERROR:
@ -296,23 +296,23 @@ bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec)
fprintf( stderr, "\t end of the connection\n\n");
if( close_socket(client) != 0){
perror("close");
return false;
return OPJ_FALSE;
}
if( quit)
return false;
return OPJ_FALSE;
return true;
return OPJ_TRUE;
}
jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2)
jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( opj_bool jp2)
{
jpip_dec_param_t *dec;
dec = (jpip_dec_param_t *)opj_calloc( 1, sizeof(jpip_dec_param_t));
dec->msgqueue = gene_msgqueue( true, NULL);
dec->msgqueue = gene_msgqueue( OPJ_TRUE, NULL);
if( jp2)
dec->metadatalist = gene_metadatalist();
@ -321,29 +321,29 @@ jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2)
}
bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec)
opj_bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec)
{
int infd;
if(( infd = open( fname, O_RDONLY)) == -1){
fprintf( stderr, "file %s not exist\n", fname);
return false;
return OPJ_FALSE;
}
if(!(dec->jpiplen = (Byte8_t)get_filesize(infd)))
return false;
return OPJ_FALSE;
dec->jpipstream = (Byte_t *)opj_malloc( dec->jpiplen);
if( read( infd, dec->jpipstream, dec->jpiplen) != (int)dec->jpiplen){
fprintf( stderr, "file reading error\n");
opj_free( dec->jpipstream);
return false;
return OPJ_FALSE;
}
close(infd);
return true;
return OPJ_TRUE;
}
void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec)
@ -361,7 +361,7 @@ void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec)
dec->jp2kstream = recons_j2k( dec->msgqueue, dec->jpipstream, dec->msgqueue->first->csn, 0, 0, &dec->jp2klen);
}
bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
opj_bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
{
int outfd;
@ -371,7 +371,7 @@ bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
if(( outfd = open( fname, O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG)) == -1){
#endif
fprintf( stderr, "file %s open error\n", fname);
return false;
return OPJ_FALSE;
}
if( write( outfd, dec->jp2kstream, dec->jp2klen) != (int)dec->jp2klen)
@ -379,10 +379,10 @@ bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
close(outfd);
return true;
return OPJ_TRUE;
}
void OPJ_CALLCONV output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec)
void OPJ_CALLCONV output_log( opj_bool messages, opj_bool metadata, opj_bool ihdrbox, jpip_dec_param_t *dec)
{
if( messages)
print_msgqueue( dec->msgqueue);

View File

@ -35,7 +35,6 @@
#include "target_manager.h"
#include "query_parser.h"
#include "msgqueue_manager.h"
#include "bool.h"
#include "sock_manager.h"
#include "auxtrans_manager.h"
@ -113,7 +112,7 @@ QR_t * parse_querystring( const char *query_string);
* @param[in] qr query/response data pointer
* @return true if succeed, otherwise false
*/
bool process_JPIPrequest( server_record_t *rec, QR_t *qr);
opj_bool process_JPIPrequest( server_record_t *rec, QR_t *qr);
/**
* 3rd process; send response data JPT/JPP-stream
@ -141,7 +140,7 @@ void end_QRprocess( server_record_t *rec, QR_t **qr);
* @param[in] qr query/response data pointer
* @param[in] rec server static record pinter
*/
void local_log( bool query, bool messages, bool sessions, bool targets, QR_t *qr, server_record_t *rec);
void local_log( opj_bool query, opj_bool messages, opj_bool sessions, opj_bool targets, QR_t *qr, server_record_t *rec);
#endif /*SERVER*/
@ -196,7 +195,7 @@ OPJ_API client_t OPJ_CALLCONV accept_connection( dec_server_record_t *rec);
* @param[in] rec decoding server static record pointer
* @return true if succeed
*/
OPJ_API bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec);
OPJ_API opj_bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec);
#endif /*SERVER*/
@ -229,7 +228,7 @@ typedef struct jpip_dec_param{
* @param[in] jp2 true in case of jp2 file encoding, else j2k file encoding
* @return JPIP decoding parameters pointer
*/
OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2);
OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( opj_bool jp2);
/**
* Destroy jpip decoding parameters
@ -245,7 +244,7 @@ OPJ_API void OPJ_CALLCONV destroy_jpipdecoder( jpip_dec_param_t **dec);
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
OPJ_API bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec);
OPJ_API opj_bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec);
/**
* Decode jpip codestream
@ -261,7 +260,7 @@ OPJ_API void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec);
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
OPJ_API bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
OPJ_API opj_bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
/**
* Option; print out parameter values to stderr
@ -271,7 +270,7 @@ OPJ_API bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec
* @param[in] ihdrbox true if image header data is to be printed out
* @param[in] dec JPIP decoding parameters pointer
*/
OPJ_API void OPJ_CALLCONV output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec);
OPJ_API void OPJ_CALLCONV output_log( opj_bool messages, opj_bool metadata, opj_bool ihdrbox, jpip_dec_param_t *dec);
/*
* test the format of index (cidx) box in JP2 file

View File

@ -159,7 +159,7 @@ query_param_t * get_initquery(void)
query_param_t *query;
int i;
query = (query_param_t *)malloc( sizeof(query_param_t));
query = (query_param_t *)opj_malloc( sizeof(query_param_t));
query->target = NULL;
query->tid = NULL;
@ -179,15 +179,15 @@ query_param_t * get_initquery(void)
memset( query->box_type, 0, MAX_NUMOFBOX*4);
memset( query->limit, 0, MAX_NUMOFBOX*sizeof(int));
for( i=0; i<MAX_NUMOFBOX; i++){
query->w[i] = false;
query->s[i] = false;
query->g[i] = false;
query->a[i] = false;
query->priority[i] = false;
query->w[i] = OPJ_FALSE;
query->s[i] = OPJ_FALSE;
query->g[i] = OPJ_FALSE;
query->a[i] = OPJ_FALSE;
query->priority[i] = OPJ_FALSE;
}
query->root_bin = 0;
query->max_depth = -1;
query->metadata_only = false;
query->metadata_only = OPJ_FALSE;
query->return_type = UNKNOWN;
query->len = -1;
@ -329,7 +329,7 @@ void parse_metareq( char *field, query_param_t *query_param)
sscanf( ptr+1, "%d", &(query_param->max_depth));
if(( ptr = strstr( field, "!!")))
query_param->metadata_only = true;
query_param->metadata_only = OPJ_TRUE;
}
void parse_req_box_prop( char *req_box_prop, int idx, query_param_t *query_param)
@ -352,22 +352,22 @@ void parse_req_box_prop( char *req_box_prop, int idx, query_param_t *query_param
ptr++;
while( *ptr=='w' || *ptr=='s' || *ptr=='g' || *ptr=='a'){
switch( *ptr){
case 'w': query_param->w[idx] = true; break;
case 's': query_param->s[idx] = true; break;
case 'g': query_param->g[idx] = true; break;
case 'a': query_param->a[idx] = true; break;
case 'w': query_param->w[idx] = OPJ_TRUE; break;
case 's': query_param->s[idx] = OPJ_TRUE; break;
case 'g': query_param->g[idx] = OPJ_TRUE; break;
case 'a': query_param->a[idx] = OPJ_TRUE; break;
}
ptr++;
}
}
else{
query_param->g[idx] = true;
query_param->s[idx] = true;
query_param->w[idx] = true;
query_param->g[idx] = OPJ_TRUE;
query_param->s[idx] = OPJ_TRUE;
query_param->w[idx] = OPJ_TRUE;
}
if((ptr = strchr( req_box_prop, '!')))
query_param->priority[idx] = true;
query_param->priority[idx] = OPJ_TRUE;
idx++;
}
@ -399,31 +399,31 @@ void parse_comps( char *field, query_param_t *query_param)
}
query_param->lastcomp = stop > aux ? stop : aux;
query_param->comps = (bool *)calloc( 1, (OPJ_SIZE_T)(query_param->lastcomp+1)*sizeof(bool));
query_param->comps = (opj_bool *)opj_calloc( 1, (OPJ_SIZE_T)(query_param->lastcomp+1)*sizeof(opj_bool));
for( i=start; i<=stop; i++)
query_param->comps[i]=true;
query_param->comps[i]=OPJ_TRUE;
if(aux!=-1)
query_param->comps[aux] = true;
query_param->comps[aux] = OPJ_TRUE;
}
void delete_query( query_param_t **query)
{
if( (*query)->target)
free( (*query)->target);
opj_free( (*query)->target);
if( (*query)->tid)
free( (*query)->tid);
opj_free( (*query)->tid);
if( (*query)->comps)
free((*query)->comps);
opj_free((*query)->comps);
if( (*query)->cid)
free( (*query)->cid);
opj_free( (*query)->cid);
if( (*query)->cclose)
free( (*query)->cclose);
opj_free( (*query)->cclose);
free( *query);
opj_free( *query);
}

View File

@ -32,7 +32,7 @@
#ifndef QUERY_PARSER_H_
# define QUERY_PARSER_H_
#include "bool.h"
#include "opj_includes.h"
/** maximum number of meta request box */
#define MAX_NUMOFBOX 10
@ -51,21 +51,21 @@ typedef struct query_param{
int rx, ry, rw, rh; /**< roi region */
int layers; /**< quality layers */
int lastcomp; /**< last component number */
bool *comps; /**< components (dynamic array) for jpp-stream, null means all components */
opj_bool *comps; /**< components (dynamic array) for jpp-stream, null means all components */
char *cid; /**< channel identifier */
cnew_transport_t cnew; /**< transport name if there is new channel request, else non */
char *cclose; /**< list of closing channel identifiers, separated by '\\0' */
int numOfcclose; /**< number of closing channels */
char box_type[MAX_NUMOFBOX][4]; /**< interested box-types */
int limit[MAX_NUMOFBOX]; /**< limit value, -1: skeleton request "r", 0: entire contents */
bool w[MAX_NUMOFBOX]; /**< Metadata request qualifier flags */
bool s[MAX_NUMOFBOX];
bool g[MAX_NUMOFBOX];
bool a[MAX_NUMOFBOX];
bool priority[MAX_NUMOFBOX]; /**< priority flag */
opj_bool w[MAX_NUMOFBOX]; /**< Metadata request qualifier flags */
opj_bool s[MAX_NUMOFBOX];
opj_bool g[MAX_NUMOFBOX];
opj_bool a[MAX_NUMOFBOX];
opj_bool priority[MAX_NUMOFBOX]; /**< priority flag */
int root_bin; /**< root-bin */
int max_depth; /**< max-depth */
bool metadata_only; /**< metadata-only request */
opj_bool metadata_only; /**< metadata-only request */
image_return_t return_type; /**< image return type */
int len; /**< maximum response length */
} query_param_t;

View File

@ -76,7 +76,7 @@ session_param_t * gene_session( sessionlist_param_t *sessionlist)
return session;
}
bool search_session_and_channel( char cid[],
opj_bool search_session_and_channel( char cid[],
sessionlist_param_t *sessionlist,
session_param_t **foundsession,
channel_param_t **foundchannel)
@ -90,7 +90,7 @@ bool search_session_and_channel( char cid[],
while( *foundchannel != NULL){
if( strcmp( cid, (*foundchannel)->cid) == 0)
return true;
return OPJ_TRUE;
*foundchannel = (*foundchannel)->next;
}
@ -100,7 +100,7 @@ bool search_session_and_channel( char cid[],
fprintf( FCGI_stdout, "Status: 503\r\n");
fprintf( FCGI_stdout, "Reason: Channel %s not found\r\n", cid);
return false;
return OPJ_FALSE;
}
void insert_cachemodel_into_session( session_param_t *session, cachemodel_param_t *cachemodel)
@ -118,12 +118,12 @@ void insert_cachemodel_into_session( session_param_t *session, cachemodel_param_
session->cachemodellist->last = cachemodel;
}
bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist)
opj_bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist)
{
session_param_t *ptr;
if( *session == NULL)
return false;
return OPJ_FALSE;
if( *session == sessionlist->first)
@ -146,7 +146,7 @@ bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist
#endif
opj_free( *session);
return true;
return OPJ_TRUE;
}
void delete_sessionlist( sessionlist_param_t **sessionlist)

View File

@ -31,7 +31,6 @@
#ifndef SESSION_MANAGER_H_
# define SESSION_MANAGER_H_
#include "bool.h"
#include "channel_manager.h"
#include "cachemodel_manager.h"
@ -74,7 +73,7 @@ session_param_t * gene_session( sessionlist_param_t *sessionlist);
* @param[in,out] foundchannel address of the found channel pointer
* @return if the channel is found (true) or not (false)
*/
bool search_session_and_channel( char cid[],
opj_bool search_session_and_channel( char cid[],
sessionlist_param_t *sessionlist,
session_param_t **foundsession,
channel_param_t **foundchannel);
@ -95,7 +94,7 @@ void insert_cachemodel_into_session( session_param_t *session, cachemodel_param_
* @param[in] sessionlist session list pointer
* @return if succeeded (true) or failed (false)
*/
bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist);
opj_bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist);
/**

View File

@ -31,7 +31,6 @@
#ifndef SOCK_MANAGER_H_
# define SOCK_MANAGER_H_
#include "bool.h"
#include "byte_manager.h"
#include "opj_stdint.h"

View File

@ -112,7 +112,7 @@ target_param_t * gene_target( targetlist_param_t *targetlist, char *targetpath)
target->csn = last_csn++;
target->codeidx = jp2idx;
target->num_of_use = 0;
target->jppstream = true;
target->jppstream = OPJ_TRUE;
target->jptstream = isJPTfeasible( *jp2idx);
target->next=NULL;

View File

@ -31,7 +31,6 @@
#ifndef TARGET_MANAGER_H_
# define TARGET_MANAGER_H_
#include "bool.h"
#include "index_manager.h"
/** maximum length of target identifier*/
@ -48,8 +47,8 @@ typedef struct target_param{
int csn; /**< codestream number */
index_param_t *codeidx; /**< index information of codestream */
int num_of_use; /**< numbers of sessions refering to this target */
bool jppstream; /**< if this target can return JPP-stream */
bool jptstream; /**< if this target can return JPP-stream */
opj_bool jppstream; /**< if this target can return JPP-stream */
opj_bool jptstream; /**< if this target can return JPP-stream */
struct target_param *next; /**< pointer to the next target */
} target_param_t;