]> granicus.if.org Git - openjpeg/commitdiff
[trunk] continue work on getting API to use off_t instead of long toward LFS support...
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 26 Mar 2012 14:14:19 +0000 (14:14 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 26 Mar 2012 14:14:19 +0000 (14:14 +0000)
applications/jpip/libopenjpip/auxtrans_manager.c
applications/jpip/libopenjpip/auxtrans_manager.h
applications/jpip/libopenjpip/sock_manager.c
applications/jpip/libopenjpip/sock_manager.h

index d32856364093dec7c7dbfc5e70dcf1ff382890fc..a983e5f448b2e0e7542fb46fe8f52bcba224fb3d 100644 (file)
@@ -82,15 +82,15 @@ void close_aux_transport( auxtrans_param_t auxtrans)
 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 */
+  OPJ_SIZE_T datalen;          /*!< length of data */
+  OPJ_SIZE_T maxlenPerFrame;   /*!< maximum data length to send per frame */
   SOCKET listensock;    /*!< listeing socket */
 #ifdef _WIN32
   HANDLE hTh;           /*!< thread handle */
 #endif
 } aux_response_param_t;
 
-aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame);
+aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, 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, int datalen, int maxlenPerFrame)
+void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, 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, int datalen, int maxlenPerFrame)
+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 *auxresponse;
 
@@ -175,8 +175,8 @@ void * aux_streaming( void *arg)
 {
   SOCKET connected_socket;
   unsigned char *chunk, *ptr;
-  int maxLenOfBody, remlen, chunklen;
-  const int headlen = 8;
+  OPJ_SIZE_T maxLenOfBody, remlen, chunklen;
+  const OPJ_SIZE_T headlen = 8;
   
   aux_response_param_t *auxresponse = (aux_response_param_t *)arg;
 
@@ -194,25 +194,25 @@ void * aux_streaming( void *arg)
     if( identify_cid( connected_socket, auxresponse->cid, FCGI_stderr)){
       ptr = auxresponse->data;
       while( 0 < remlen){
-       memset( chunk, 0, auxresponse->maxlenPerFrame);
+        memset( chunk, 0, auxresponse->maxlenPerFrame);
 
-       chunklen = remlen<maxLenOfBody?remlen:maxLenOfBody;
-       chunklen += headlen;
-       
-       chunk[0] = (chunklen >> 8) & 0xff;
-       chunk[1] = chunklen & 0xff;
+        chunklen = remlen<maxLenOfBody?remlen:maxLenOfBody;
+        chunklen += headlen;
 
-       memcpy( chunk+headlen, ptr, chunklen-headlen);
+        chunk[0] = (chunklen >> 8) & 0xff;
+        chunk[1] = chunklen & 0xff;
 
-       do{
-         send_stream( connected_socket, chunk, chunklen);
-       }while( !recv_ack( connected_socket, chunk));
+        memcpy( chunk+headlen, ptr, chunklen-headlen);
 
-       remlen -= maxLenOfBody;
-       ptr += maxLenOfBody;
+        do{
+          send_stream( connected_socket, chunk, chunklen);
+        }while( !recv_ack( connected_socket, chunk));
+
+        remlen -= maxLenOfBody;
+        ptr += maxLenOfBody;
       }
       if( close_socket( connected_socket) != 0)
-       perror("close");
+        perror("close");
       break;
     }
   }
index 25a98c66e5d2c9dc4be7f5cf3e7b105a68fe21b9..5486aba0a8b8d61c22834de022e13867e898c78b 100644 (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, int length, int maxlenPerFrame);
+void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
 
 #endif /* !AUXTRANS_MANAGER_H_ */
index e6403f56b6f88c073e29453e059baa23bbb0e6e5..ef342aaeebf3473b577994e82cffb1c1715dbb2b 100644 (file)
@@ -97,7 +97,7 @@ SOCKET accept_socket( SOCKET listening_socket)
   return accept( listening_socket, (struct sockaddr *)&peer_sin, &addrlen);
 }
 
-void send_stream( SOCKET connected_socket, void *stream, int length)
+void send_stream( SOCKET connected_socket, void *stream, OPJ_SIZE_T length)
 {
   char *ptr = (char*)stream;
   int remlen = length;
index 652865424e6d4f7281dcc52cac21caafd2666d0e..ed2f1ff87dfb50d08f0731481d8eabf6d4827c38 100644 (file)
@@ -92,7 +92,7 @@ void * receive_stream( SOCKET connected_socket, int length);
  * @param [in]  stream           data stream
  * @param [in]  length           length of data stream
  */
-void send_stream( SOCKET connected_socket, void *stream, int length);
+void send_stream( SOCKET connected_socket, void *stream, OPJ_SIZE_T length);
 
 /**
  * close socket