#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER */
auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport)
{
auxtrans.tcplistensock = -1;
auxtrans.udplistensock = -1;
- // open listening socket for udp later
+ /* open listening socket for udp later */
return auxtrans;
}
}
-//!< auxiliary response parameters
+/*!< auxiliary response parameters */
typedef struct aux_response_param{
- char *cid; //!< channel ID
- unsigned char *data; //!< sending data
- int datalen; //!< length of data
- int maxlenPerFrame; //!< maximum data length to send per frame
- SOCKET listensock; //!< listeing socket
+ char *cid; /*!< channel ID */
+ unsigned char *data; /*!< sending data */
+ int datalen; /*!< length of data */
+ int maxlenPerFrame; /*!< maximum data length to send per frame */
+ SOCKET listensock; /*!< listeing socket */
#ifdef _WIN32
- HANDLE hTh; //!< thread handle
+ HANDLE hTh; /*!< thread handle */
#endif
} aux_response_param_t;
*/
#ifndef BYTE_MANAGER_H_
-# define BYTE_MANAGER_H_
-
+#define BYTE_MANAGER_H_
+
+#include "opj_config.h"
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+typedef uint8_t Byte_t;
+typedef uint16_t Byte2_t;
+typedef uint32_t Byte4_t;
+typedef uint64_t Byte8_t;
+#else
+#if defined(_WIN32)
/** 1Byte parameter type*/
-typedef unsigned char Byte_t;
-
+typedef unsigned __int8 Byte_t;
/** 2Byte parameter type*/
-typedef unsigned short int Byte2_t;
-
+typedef unsigned __int16 Byte2_t;
/** 4Byte parameter type*/
-typedef unsigned int Byte4_t; /* FIXME: Is this portable ? */
-
+typedef unsigned __int32 Byte4_t;
/** 8Byte parameter type*/
-typedef unsigned long long int Byte8_t;
+typedef unsigned __int64 Byte8_t;
+#else
+#error unsupported platform
+#endif
+#endif
/**
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER */
-channellist_param_t * gene_channellist()
+channellist_param_t * gene_channellist(void)
{
channellist_param_t *channellist;
channel = (channel_param_t *)malloc( sizeof(channel_param_t));
channel->cachemodel = cachemodel;
- // set channel ID and get present time
+ /* set channel ID and get present time */
snprintf( channel->cid, MAX_LENOFCID, "%x%x", (unsigned int)time( &channel->start_tm), (unsigned int)rand());
channel->aux = query_param.cnew;
- // only tcp implemented for now
+ /* only tcp implemented for now */
if( channel->aux == udp)
channel->aux = tcp;
void set_channel_variable_param( query_param_t query_param, channel_param_t *channel)
{
- // set roi information
+ /* set roi information */
+ (void)query_param;
+ (void)channel;
}
*
* @return pointer to the generated channel list
*/
-channellist_param_t * gene_channellist();
+channellist_param_t * gene_channellist(void);
/**
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER */
codestream_param_t set_codestream( int fd, Byte8_t offset, Byte8_t length)
{
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER */
SIZmarker_param_t get_SIZmkrdata_from_j2kstream( Byte_t *SIZstream);
SIZmarker_param_t get_SIZmkrdata_from_j2kstream( Byte_t *SIZstream)
{
- SIZmarker_param_t SIZ ={0};
+ SIZmarker_param_t SIZ = {0};
int i;
if( *SIZstream++ != 0xff || *SIZstream++ != 0x51){
COD.YPsiz = (Byte4_t *)malloc( (COD.numOfdecomp+1)*sizeof(Byte4_t));
for( i=0; i<=COD.numOfdecomp; i++){
- //precinct size
+ /*precinct size */
COD.XPsiz[i] = pow( 2, *( CODstream+12+i) & 0x0F);
COD.YPsiz[i] = pow( 2, (*( CODstream+12+i) & 0xF0) >> 4);
}
SIZ.YTOsiz = ceil( (double)SIZ.YTOsiz/2.0);
}
- SIZstream += 4; // skip Lsiz + Rsiz
+ SIZstream += 4; /* skip Lsiz + Rsiz */
modify_4Bytecode( SIZ.Xsiz, SIZstream);
modify_4Bytecode( SIZ.Ysiz, SIZstream+4);
CODstream += 2;
}
- CODstream += 5; // skip Scod & SGcod
+ CODstream += 5; /* skip Scod & SGcod */
- // SPcod
+ /* SPcod */
*CODstream++ = (Byte_t) numOfdecomp;
return newLcod;
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
+ Byte4_t Psot; /* tile part length ref A.4.2 Start of tile-part SOT */
Byte_t *thstream, *SOTstream, *Psot_stream;
Byte2_t oldLcoc, newLcoc;
return false;
}
- SOTstream += 4; // skip Lsot & Isot
+ SOTstream += 4; /* skip Lsot & Isot */
Psot = (SOTstream[0]<<24)+(SOTstream[1]<<16)+(SOTstream[2]<<8)+(SOTstream[3]);
Psot_stream = SOTstream;
- thstream += 12; // move to next marker (SOT always 12bytes)
+ thstream += 12; /* move to next marker (SOT always 12bytes) */
- while( !( *thstream == 0xff && *(thstream+1) == 0x93)){ // search SOD
- if( numOfdecomp != -1 && *thstream == 0xff && *(thstream+1) == 0x53){ // COC
+ 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;
*j2klen -= ( oldLcoc - newLcoc);
}
thstream += 2;
- thstream += ((thstream[0]<<8)+(thstream[1])); // marker length
+ thstream += ((thstream[0]<<8)+(thstream[1])); /* marker length */
}
if( (*j2klen)-SOToffset != Psot){
*COCstream++ = (Byte_t)((Byte2_t)((*newLcoc) & 0xff00) >> 8);
*COCstream++ = (Byte_t)((*newLcoc) & 0x00ff);
- if( Csiz < 257) COCstream +=2; // skip Ccoc & Scoc
+ if( Csiz < 257) COCstream +=2; /* skip Ccoc & Scoc */
else COCstream += 3;
*COCstream = numOfdecomp;
*/
void info_callback(const char *msg, void *client_data) {
(void)client_data;
- // fprintf(stdout, "[INFO] %s", msg);
+ (void)msg;
+ /* fprintf(stdout, "[INFO] %s", msg); */
}
r = image->comps[0].data[i];
r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
- // if( adjustR > 0)
+ /* if( adjustR > 0) */
*(ptr++) = (Byte_t) ((r >> adjustR)+((r >> (adjustR-1))%2));
if( image->numcomps == 3){
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER */
manfbox_param_t * gene_manfbox( box_param_t *box)
{
- manfbox_param_t *manf; // manifest parameters
- boxheader_param_t *bh; // current box pointer
- boxheader_param_t *last; // last boxheader pointer of the list
- int pos; // current position in manf_box contents;
+ manfbox_param_t *manf; /* manifest parameters */
+ boxheader_param_t *bh; /* current box pointer */
+ boxheader_param_t *last; /* last boxheader pointer of the list */
+ Byte8_t pos; /* current position in manf_box contents; */
manf = ( manfbox_param_t *)malloc( sizeof( manfbox_param_t));
bh = gene_childboxheader( box, pos);
pos += bh->headlen;
- // insert into the list
+ /* insert into the list */
if( manf->first)
last->next = bh;
else
while( bhPtr != NULL){
bhNext = bhPtr->next;
#ifndef SERVER
- // fprintf( logstream, "local log: boxheader %.4s deleted!\n", bhPtr->type);
+ /* fprintf( logstream, "local log: boxheader %.4s deleted!\n", bhPtr->type); */
#endif
free(bhPtr);
bhPtr = bhNext;
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER */
marker_param_t set_marker( codestream_param_t cs, Byte2_t code, Byte8_t offset, Byte2_t length)
{
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER */
mhixbox_param_t * gene_mhixbox( box_param_t *box)
{
mhixbox_param_t *mhix;
markeridx_param_t *mkridx, *lastmkidx;
- long pos = 0;
+ Byte8_t pos = 0;
mhix = ( mhixbox_param_t *)malloc( sizeof( mhixbox_param_t));
while( mkPtr != NULL){
mkNext=mkPtr->next;
#ifndef SERVER
- // fprintf( logstream, "local log: marker index %#x deleted!\n", mkPtr->code);
+ /* fprintf( logstream, "local log: marker index %#x deleted!\n", mkPtr->code); */
#endif
free(mkPtr);
mkPtr=mkNext;
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
-#endif //SERVER
+#endif /*SERVER */
-sessionlist_param_t * gene_sessionlist()
+sessionlist_param_t * gene_sessionlist(void)
{
sessionlist_param_t *sessionlist;
session->next = NULL;
- if( sessionlist->first) // there are one or more entries
+ if( sessionlist->first) /* there are one or more entries */
sessionlist->last->next = session;
- else // first entry
+ else /* first entry */
sessionlist->first = session;
sessionlist->last = session;
*
* @return pointer to the generated session list
*/
-sessionlist_param_t * gene_sessionlist();
+sessionlist_param_t * gene_sessionlist(void);
/**