4 * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
5 * Copyright (c) 2002-2011, Professor Benoit Macq
6 * Copyright (c) 2010-2011, Kaori Hagihara
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
34 #include "manfbox_manager.h"
37 #include "fcgi_stdio.h"
38 #define logstream FCGI_stdout
40 #define FCGI_stdout stdout
41 #define FCGI_stderr stderr
42 #define logstream stderr
45 manfbox_param_t * gene_manfbox( box_param_t *box)
47 manfbox_param_t *manf; /* manifest parameters */
48 boxheader_param_t *bh; /* current box pointer */
49 boxheader_param_t *last; /* last boxheader pointer of the list */
50 OPJ_OFF_T pos; /* current position in manf_box contents; */
52 manf = ( manfbox_param_t *)malloc( sizeof( manfbox_param_t));
55 manf->first = last = NULL;
57 while( (OPJ_SIZE_T)pos < get_DBoxlen( box)){
59 bh = gene_childboxheader( box, pos);
62 /* insert into the list */
72 void delete_manfbox( manfbox_param_t **manf)
74 boxheader_param_t *bhPtr, *bhNext;
76 bhPtr = (*manf)->first;
77 while( bhPtr != NULL){
80 /* fprintf( logstream, "local log: boxheader %.4s deleted!\n", bhPtr->type); */
88 void print_manfbox( manfbox_param_t *manf)
90 boxheader_param_t *ptr;
94 print_boxheader( ptr);
99 boxheader_param_t * search_boxheader( const char type[], manfbox_param_t *manf)
101 boxheader_param_t *found;
105 while( found != NULL){
107 if( strncmp( type, found->type, 4) == 0)
112 fprintf( FCGI_stderr, "Error: Boxheader %s not found\n", type);