Print

Print


Commit in lcio on MAIN
CMakeLists.txt+11.51 -> 1.52
sio/CMakeLists.txt+3-31.20 -> 1.21
sio/include/SIO_stream.h+32-11.6 -> 1.7
sio/src/SIO_stream.cc+5-261.7 -> 1.8
src/cpp/src/SIO/SIOReader.cc+8-81.54 -> 1.55
               /SIOWriter.cc+1-11.36 -> 1.37
+50-39
6 modified files
bug fixes for dcap support - added fflush and stat (fopen in SIOWriter)

lcio
CMakeLists.txt 1.51 -> 1.52
diff -u -r1.51 -r1.52
--- CMakeLists.txt	13 Dec 2008 13:13:49 -0000	1.51
+++ CMakeLists.txt	27 Oct 2009 16:01:16 -0000	1.52
@@ -340,6 +340,7 @@
               "Please call cmake with -DDCAP_HOME=<path_to_DCAP>" )
   ENDIF()
   INCLUDE_DIRECTORIES( ${DCAP_HOME}/include )
+  ADD_DEFINITIONS( "-DSIO_USE_DCAP" )
   FIND_LIBRARY( DCAP_LIB NAMES dcap PATHS ${DCAP_HOME}/lib NO_DEFAULT_PATH )
   LINK_LIBRARIES( ${DCAP_LIB} ) 
 ENDIF()

lcio/sio
CMakeLists.txt 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- CMakeLists.txt	13 Dec 2008 13:13:50 -0000	1.20
+++ CMakeLists.txt	27 Oct 2009 16:01:17 -0000	1.21
@@ -29,9 +29,9 @@
     ADD_DEFINITIONS( "-D__LITTLE_ENDIAN__" )
 ENDIF()
 
-IF( BUILD_WITH_DCAP )
-    ADD_DEFINITIONS( "-DSIO_USE_DCAP" )
-ENDIF()
+#IF( BUILD_WITH_DCAP )
+#    ADD_DEFINITIONS( "-DSIO_USE_DCAP" )
+#ENDIF()
 
 INCLUDE_DIRECTORIES(
     ${SIO_SOURCE_DIR}/include

lcio/sio/include
SIO_stream.h 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- SIO_stream.h	9 Nov 2007 20:21:09 -0000	1.6
+++ SIO_stream.h	27 Oct 2009 16:01:17 -0000	1.7
@@ -1,5 +1,5 @@
 // ----------------------------------------------------------------------------
-// CVS $Id: SIO_stream.h,v 1.6 2007/11/09 20:21:09 gaede Exp $
+// CVS $Id: SIO_stream.h,v 1.7 2009/10/27 16:01:17 gaede Exp $
 // ----------------------------------------------------------------------------
 // => Controller for a single SIO stream.                          
 // ----------------------------------------------------------------------------
@@ -30,6 +30,37 @@
 
 struct z_stream_s;
 
+
+//------- if built with dcap support we need different file functions -------
+#ifdef SIO_USE_DCAP
+
+#include <dcap.h>
+
+#define FOPEN  dc_fopen
+#define FTELL  dc_ftell
+#define FSEEK  dc_fseek
+#define FCLOSE dc_fclose
+#define FREAD  dc_fread
+#define FWRITE dc_fwrite
+#define FFLUSH dc_fflush
+#define FSTAT  dc_stat
+
+#else
+
+#define FOPEN  fopen
+#define FTELL  ftell
+#define FSEEK  fseek
+#define FCLOSE fclose
+#define FREAD  fread
+#define FWRITE fwrite
+#define FFLUSH fflush
+#define FSTAT  stat
+
+#endif
+
+
+
+
 // ----------------------------------------------------------------------------
 // Class SIO_stream.         
 // ----------------------------------------------------------------------------

lcio/sio/src
SIO_stream.cc 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- SIO_stream.cc	28 May 2008 14:02:09 -0000	1.7
+++ SIO_stream.cc	27 Oct 2009 16:01:17 -0000	1.8
@@ -1,5 +1,5 @@
 // ----------------------------------------------------------------------------
-// CVS $Id: SIO_stream.cc,v 1.7 2008/05/28 14:02:09 engels Exp $
+// CVS $Id: SIO_stream.cc,v 1.8 2009/10/27 16:01:17 gaede Exp $
 // ----------------------------------------------------------------------------
 // => Controller for a single SIO stream.                          
 // ----------------------------------------------------------------------------
@@ -27,27 +27,6 @@
 #include "SIO_recordManager.h"
 #include "SIO_stream.h"
 
-#ifdef SIO_USE_DCAP
-
-#include <dcap.h>
-
-#define FOPEN  dc_fopen
-#define FTELL  dc_ftell
-#define FSEEK  dc_fseek
-#define FCLOSE dc_fclose
-#define FREAD  dc_fread
-#define FWRITE dc_fwrite
-
-#else
-
-#define FOPEN  fopen
-#define FTELL  ftell
-#define FSEEK  fseek
-#define FCLOSE fclose
-#define FREAD  fread
-#define FWRITE fwrite
-
-#endif
 
 
 static unsigned int
@@ -122,7 +101,7 @@
     }
     return( SIO_STREAM_NOTOPEN );
 }
-int rc = fflush( handle );
+int rc = FFLUSH( handle );
 return (rc == 0) ? SIO_STREAM_SUCCESS : SIO_STREAM_BADWRITE;
 }
 
@@ -1256,7 +1235,7 @@
     //
     data_length += head_length;
     bufout = FWRITE( bufloc, sizeof(char), data_length, handle );
-    if( bufout != data_length && ! fflush( handle ) ) // fg 20030514 - flush the record
+    if( bufout != data_length && ! FFLUSH( handle ) ) // fg 20030514 - flush the record
     {
         state = SIO_STATE_ERROR;
         if( verbosity >= SIO_ERRORS )
@@ -1373,7 +1352,7 @@
     // Write the compressed record data.
     //
     bufout = FWRITE( cmploc, sizeof(char), data_length, handle );
-    if( bufout != data_length && ! fflush(handle) ) // fg 20030514 - flush the record
+    if( bufout != data_length && ! FFLUSH(handle) ) // fg 20030514 - flush the record
     {
         state = SIO_STATE_ERROR;
         if( verbosity >= SIO_ERRORS )
@@ -1394,7 +1373,7 @@
     if( newlen > 0 )
     {
         bufout = FWRITE( pad, sizeof(char), newlen, handle );
-        if( bufout != newlen && ! fflush(handle))// fg 20030514 - flush the record
+        if( bufout != newlen && ! FFLUSH(handle))// fg 20030514 - flush the record
         {
             state = SIO_STATE_ERROR;
             if( verbosity >= SIO_ERRORS )

lcio/src/cpp/src/SIO
SIOReader.cc 1.54 -> 1.55
diff -u -r1.54 -r1.55
--- SIOReader.cc	5 Jun 2009 10:05:34 -0000	1.54
+++ SIOReader.cc	27 Oct 2009 16:01:17 -0000	1.55
@@ -30,7 +30,7 @@
 #include <climits>
 //#include <limits>
 
-#include <sys/stat.h> 
+//#include <sys/stat.h> 
 
 using namespace EVENT ;
 using namespace IO ;
@@ -141,16 +141,16 @@
     
     // JE: first we check if all files exist
     for(i=0; i < filenames.size(); i++){
-        
-        if ( stat( filenames[i].c_str(), &fileinfo ) != 0 ){
-            missing_files += filenames[i] ;
-            missing_files += "  " ;
-        }
+      
+      if ( FSTAT( filenames[i].c_str(), &fileinfo ) != 0 ){
+	missing_files += filenames[i] ;
+	missing_files += "  " ;
+      }
     }
-
+    
     // JE: if not raise IOException
     if( missing_files.size() != 0 ){
-        throw IOException( std::string( "[SIOReader::open()] File(s) not found:  " + missing_files )) ;
+      throw IOException( std::string( "[SIOReader::open()] File(s) not found:  " + missing_files )) ;
     }
     
     _myFilenames = &filenames ;

lcio/src/cpp/src/SIO
SIOWriter.cc 1.36 -> 1.37
diff -u -r1.36 -r1.37
--- SIOWriter.cc	28 May 2008 14:02:09 -0000	1.36
+++ SIOWriter.cc	27 Oct 2009 16:01:17 -0000	1.37
@@ -90,7 +90,7 @@
 
     // if the file exists we throw an exception
 
-    FILE* f = fopen( sioFilename.c_str() , "r") ;
+    FILE* f = FOPEN( sioFilename.c_str() , "r") ;
     if( f != 0 ){
       fclose(f) ;
       throw IOException( std::string( "[SIOWriter::open()] File already exists: " 
CVSspam 0.2.8