[trunk] change char* to const char* when possible. Remove more warnings
This commit is contained in:
parent
3a3820bedc
commit
1228e0e925
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
msgtype_t identify_clientmsg( SOCKET connected_socket)
|
msgtype_t identify_clientmsg( SOCKET connected_socket)
|
||||||
{
|
{
|
||||||
int receive_size;
|
OPJ_SIZE_T receive_size;
|
||||||
char buf[BUF_LEN];
|
char buf[BUF_LEN];
|
||||||
static const char *magicid[] = { "JPIP-stream", "PNM request", "XML request",
|
static const char *magicid[] = { "JPIP-stream", "PNM request", "XML request",
|
||||||
"TID request", "CID request", "CID destroy", "SIZ request", "JP2 save",
|
"TID request", "CID request", "CID destroy", "SIZ request", "JP2 save",
|
||||||
|
@ -66,7 +66,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)
|
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], versionstring[] = "version 1.2";
|
||||||
int linelen, datalen;
|
int idatalen;
|
||||||
|
OPJ_SIZE_T linelen, datalen;
|
||||||
Byte_t *jpipstream;
|
Byte_t *jpipstream;
|
||||||
|
|
||||||
*target = *cid = *tid = NULL;
|
*target = *cid = *tid = NULL;
|
||||||
|
@ -99,8 +100,14 @@ Byte_t * receive_JPIPstream( SOCKET connected_socket, char **target, char **tid,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
datalen = atoi( buf);
|
idatalen = atoi( buf);
|
||||||
fprintf( stderr, "Receive Data: %d Bytes\n", datalen);
|
if( idatalen < 0 )
|
||||||
|
{
|
||||||
|
fprintf( stderr, "Receive Data: %d Bytes\n", idatalen);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
datalen = (OPJ_SIZE_T)idatalen;
|
||||||
|
fprintf( stdout, "Receive Data: %lu Bytes\n", datalen);
|
||||||
|
|
||||||
jpipstream = receive_stream( connected_socket, datalen);
|
jpipstream = receive_stream( connected_socket, datalen);
|
||||||
|
|
||||||
|
@ -113,40 +120,40 @@ Byte_t * receive_JPIPstream( SOCKET connected_socket, char **target, char **tid,
|
||||||
return jpipstream;
|
return jpipstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, int length)
|
void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, OPJ_SIZE_T length)
|
||||||
{
|
{
|
||||||
Byte_t header[5];
|
Byte_t header[5];
|
||||||
|
|
||||||
header[0] = 'X';
|
header[0] = 'X';
|
||||||
header[1] = 'M';
|
header[1] = 'M';
|
||||||
header[2] = 'L';
|
header[2] = 'L';
|
||||||
header[3] = (length >> 8) & 0xff;
|
header[3] = (Byte_t)((length >> 8) & 0xff);
|
||||||
header[4] = length & 0xff;
|
header[4] = (Byte_t)(length & 0xff);
|
||||||
|
|
||||||
send_stream( connected_socket, header, 5);
|
send_stream( connected_socket, header, 5);
|
||||||
send_stream( connected_socket, xmlstream, length);
|
send_stream( connected_socket, xmlstream, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_IDstream( SOCKET connected_socket, char *id, int idlen, const char *label);
|
void send_IDstream( SOCKET connected_socket, const char *id, OPJ_SIZE_T idlen, const char *label);
|
||||||
|
|
||||||
void send_CIDstream( SOCKET connected_socket, char *cid, int cidlen)
|
void send_CIDstream( SOCKET connected_socket, const char *cid, OPJ_SIZE_T cidlen)
|
||||||
{
|
{
|
||||||
send_IDstream( connected_socket, cid, cidlen, "CID");
|
send_IDstream( connected_socket, cid, cidlen, "CID");
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_TIDstream( SOCKET connected_socket, char *tid, OPJ_SIZE_T tidlen)
|
void send_TIDstream( SOCKET connected_socket, const char *tid, OPJ_SIZE_T tidlen)
|
||||||
{
|
{
|
||||||
send_IDstream( connected_socket, tid, tidlen, "TID");
|
send_IDstream( connected_socket, tid, tidlen, "TID");
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_IDstream( SOCKET connected_socket, char *id, int idlen, const char *label)
|
void send_IDstream( SOCKET connected_socket, const char *id, OPJ_SIZE_T idlen, const char *label)
|
||||||
{
|
{
|
||||||
Byte_t header[4];
|
char header[4];
|
||||||
|
|
||||||
header[0] = label[0];
|
header[0] = label[0];
|
||||||
header[1] = label[1];
|
header[1] = label[1];
|
||||||
header[2] = label[2];
|
header[2] = label[2];
|
||||||
header[3] = idlen & 0xff;
|
header[3] = (char)(idlen & 0xff);
|
||||||
|
|
||||||
send_stream( connected_socket, header, 4);
|
send_stream( connected_socket, header, 4);
|
||||||
send_stream( connected_socket, id, idlen);
|
send_stream( connected_socket, id, idlen);
|
||||||
|
@ -154,7 +161,7 @@ void send_IDstream( SOCKET connected_socket, char *id, int idlen, const char *l
|
||||||
|
|
||||||
void send_PNMstream( SOCKET connected_socket, Byte_t *pnmstream, unsigned int width, unsigned int height, unsigned int numofcomp, Byte_t maxval)
|
void send_PNMstream( SOCKET connected_socket, Byte_t *pnmstream, unsigned int width, unsigned int height, unsigned int numofcomp, Byte_t maxval)
|
||||||
{
|
{
|
||||||
int pnmlen = 0;
|
OPJ_SIZE_T pnmlen = 0;
|
||||||
Byte_t header[7];
|
Byte_t header[7];
|
||||||
|
|
||||||
pnmlen = width*height*numofcomp;
|
pnmlen = width*height*numofcomp;
|
||||||
|
|
|
@ -77,7 +77,7 @@ void send_PNMstream( SOCKET connected_socket, Byte_t *pnmstream, unsigned int wi
|
||||||
* @param [in] xmlstream xml data stream
|
* @param [in] xmlstream xml data stream
|
||||||
* @param [in] length legnth of the xml data stream
|
* @param [in] length legnth of the xml data stream
|
||||||
*/
|
*/
|
||||||
void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, int length);
|
void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, OPJ_SIZE_T length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send TID data stream to the client
|
* send TID data stream to the client
|
||||||
|
@ -86,7 +86,7 @@ void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, int length);
|
||||||
* @param [in] tid tid string
|
* @param [in] tid tid string
|
||||||
* @param [in] tidlen legnth of the tid string
|
* @param [in] tidlen legnth of the tid string
|
||||||
*/
|
*/
|
||||||
void send_TIDstream( SOCKET connected_socket, char *tid, OPJ_SIZE_T tidlen);
|
void send_TIDstream( SOCKET connected_socket, const char *tid, OPJ_SIZE_T tidlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send CID data stream to the client
|
* send CID data stream to the client
|
||||||
|
@ -95,7 +95,7 @@ void send_TIDstream( SOCKET connected_socket, char *tid, OPJ_SIZE_T tidlen);
|
||||||
* @param [in] cid cid string
|
* @param [in] cid cid string
|
||||||
* @param [in] cidlen legnth of the cid string
|
* @param [in] cidlen legnth of the cid string
|
||||||
*/
|
*/
|
||||||
void send_CIDstream( SOCKET connected_socket, char *cid, int cidlen);
|
void send_CIDstream( SOCKET connected_socket, const char *cid, OPJ_SIZE_T cidlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send SIZ data stream to the client
|
* send SIZ data stream to the client
|
||||||
|
|
|
@ -135,9 +135,9 @@ void * receive_stream( SOCKET connected_socket, OPJ_SIZE_T length)
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
int receive_line(SOCKET connected_socket, char *p)
|
OPJ_SIZE_T receive_line(SOCKET connected_socket, char *p)
|
||||||
{
|
{
|
||||||
int len = 0;
|
OPJ_SIZE_T len = 0;
|
||||||
while (1){
|
while (1){
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
ret = recv( connected_socket, p, 1, 0);
|
ret = recv( connected_socket, p, 1, 0);
|
||||||
|
|
|
@ -67,7 +67,7 @@ SOCKET accept_socket( SOCKET listening_socket);
|
||||||
* @param [out] buf string to be stored
|
* @param [out] buf string to be stored
|
||||||
* @return red size
|
* @return red size
|
||||||
*/
|
*/
|
||||||
int receive_line(SOCKET connected_socket, char *buf);
|
OPJ_SIZE_T receive_line(SOCKET connected_socket, char *buf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* receive a string line (ending with '\n') from client, return malloc string
|
* receive a string line (ending with '\n') from client, return malloc string
|
||||||
|
|
Loading…
Reference in New Issue