fix declarations
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 30 Jan 2012 09:27:35 +0000 (09:27 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 30 Jan 2012 09:27:35 +0000 (09:27 +0000)
applications/jpip/libopenjpip/byte_manager.c
applications/jpip/libopenjpip/target_manager.c

index e0c628b16e1294f1a8a17fe8befdbf4855d081fe..4dd887bcfdf4b4c1b127c05bec9e1f254cfbe18a 100644 (file)
  */
 
 #include <stdio.h>
+#ifdef _WIN32
+#include <io.h>
+#else
 #include <sys/types.h>
+#include <unistd.h>
+#endif
 #include <stdlib.h>
 #include <sys/stat.h>
 #include "byte_manager.h"
@@ -41,7 +46,7 @@
 #define FCGI_stdout stdout
 #define FCGI_stderr stderr
 #define logstream stderr
-#endif //SERVER
+#endif /*SERVER*/
 
 
 Byte_t * fetch_bytes( int fd, long offset, int size)
index db084ee1c01bdc1a196749b8a89b34369835cc58..95dc92944408f670af9ae619209f2719f6c1a769 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#ifdef _WIN32
+#include <io.h>
+#else
 #include <sys/types.h>
+#include <unistd.h>
+#endif
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
@@ -45,7 +50,7 @@
 #define FCGI_stdout stdout
 #define FCGI_stderr stderr
 #define logstream stderr
-#endif //SERVER
+#endif /*SERVER*/
 
 targetlist_param_t * gene_targetlist()
 {
@@ -109,9 +114,9 @@ target_param_t * gene_target( targetlist_param_t *targetlist, char *targetpath)
   target->jptstream = isJPTfeasible( *jp2idx);
   target->next=NULL;
 
-  if( targetlist->first) // there are one or more entries
+  if( targetlist->first) /* there are one or more entries*/
     targetlist->last->next = target;
-  else                   // first entry
+  else                   /* first entry*/
     targetlist->first = target;
   targetlist->last = target;
 
@@ -248,7 +253,7 @@ int open_jp2file( char filepath[], char tmpfname[])
   int fd;
   char *data;
   
-  // download remote target file to local storage
+  /* download remote target file to local storage*/
   if( strncmp( filepath, "http://", 7) == 0){
     if( (fd = open_remotefile( filepath, tmpfname)) == -1)
       return -1;
@@ -260,14 +265,14 @@ int open_jp2file( char filepath[], char tmpfname[])
       return -1;
     }
   }
-  // Check resource is a JP family file.
+  /* Check resource is a JP family file.*/
   if( lseek( fd, 0, SEEK_SET)==-1){
     close(fd);
     fprintf( FCGI_stdout, "Reason: Target %s broken (lseek error)\r\n", filepath);
     return -1;
   }
   
-  data = (char *)malloc( 12); // size of header
+  data = (char *)malloc( 12); /* size of header*/
 
   if( read( fd, data, 12) != 12){
     free( data);
@@ -296,7 +301,8 @@ static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream);
 int open_remotefile( char filepath[], char tmpfname[])
 {
 #ifndef SERVER
-
+  (void)filepath;
+  (void)tmpfname;
   fprintf( FCGI_stderr, "Remote file can not be opened in local mode\n");
   return -1;
 
@@ -322,7 +328,7 @@ int open_remotefile( char filepath[], char tmpfname[])
   curl_easy_cleanup(curl_handle);
 
   return fd;
-#endif //SERVER
+#endif /*SERVER*/
 }
 
 #ifdef SERVER
@@ -333,4 +339,4 @@ static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
 
   return written;
 }
-#endif //SERVER
+#endif /*SERVER*/