]> git.treefish.org Git - phys/latlib.git/blobdiff - datread.cpp
Made c++11 standard dependency obsolete.
[phys/latlib.git] / datread.cpp
index 4a0e31dc5d112ad182360e074d45372edd33350e..f4bf393999ef6417c1939c60716796c24719d88d 100644 (file)
@@ -16,17 +16,20 @@ int datread::openFile (const string& filename)
   if ( ! infile.is_open() ) return -1;
   
   if( filename.substr(filename.size()-4) == ".dat" ) {
   if ( ! infile.is_open() ) return -1;
   
   if( filename.substr(filename.size()-4) == ".dat" ) {
-    format = Format::DAT;
+    format = DAT;
   }
   else if( filename.substr(filename.size()-4) == "edat" ) {
   }
   else if( filename.substr(filename.size()-4) == "edat" ) {
-    format = Format::EDAT;
+    format = EDAT;
   }
   else if( filename.substr(filename.size()-4) == "sdat" ) {
   }
   else if( filename.substr(filename.size()-4) == "sdat" ) {
-    format = Format::SDAT;
+    format = SDAT;
     getline(infile, parastring);
   }
 
     getline(infile, parastring);
   }
 
-  inbuffer = unique_ptr<boost::iostreams::filtering_istreambuf>(new boost::iostreams::filtering_istreambuf);
+  if ( inbuffer != NULL )
+    delete inbuffer;
+  
+  inbuffer = new boost::iostreams::filtering_istreambuf;
   inbuffer->push( boost::iostreams::bzip2_decompressor() );
   inbuffer->push(infile);
 
   inbuffer->push( boost::iostreams::bzip2_decompressor() );
   inbuffer->push(infile);
 
@@ -121,7 +124,7 @@ int datread::readFullBlock (char *tmpData)
     return -4;
     
   /* try to read header */
     return -4;
     
   /* try to read header */
-  if ( format == Format::EDAT || format == Format::SDAT )
+  if ( format == EDAT || format == SDAT )
     if ( ! readAllHeaders() ) {
       infile.close();
       return -1;
     if ( ! readAllHeaders() ) {
       infile.close();
       return -1;
@@ -173,3 +176,9 @@ void datread::closeFile ()
   if ( infile.is_open() )
     infile.close();
 }
   if ( infile.is_open() )
     infile.close();
 }
+
+datread::~datread ()
+{
+  if ( inbuffer != NULL )
+    delete inbuffer;
+}