[casacore] r21584 committed - Fixed a compiler problem

2 views
Skip to first unread message

casa...@googlecode.com

unread,
Mar 24, 2015, 11:33:07 AM3/24/15
to casacor...@googlegroups.com
Revision: 21584
Author: gervandiepen
Date: Tue Mar 24 15:32:48 2015 UTC
Log: Fixed a compiler problem
https://code.google.com/p/casacore/source/detail?r=21584

Modified:
/branches/nov14/casa/IO/MultiFile.cc
/branches/nov14/casa/IO/MultiFile.h
/branches/nov14/casa/IO/MultiFileBase.cc
/branches/nov14/casa/IO/MultiFileBase.h
/branches/nov14/casa/IO/MultiHDF5.cc

=======================================
--- /branches/nov14/casa/IO/MultiFile.cc Tue Mar 24 14:43:31 2015 UTC
+++ /branches/nov14/casa/IO/MultiFile.cc Tue Mar 24 15:32:48 2015 UTC
@@ -42,12 +42,13 @@

MultiFile::MultiFile (const String& name, ByteIO::OpenOption option,
Int blockSize)
- : MultiFileBase (name, option, blockSize)
+ : MultiFileBase (name, blockSize)
{
itsFD = RegularFileIO::openCreate (itsName, option);
itsIO.attach (itsFD, itsName);
if (option == ByteIO::New || option == ByteIO::NewNoReplace) {
// New file; first block is for administration.
+ setNewFile();
itsNrBlock = 1;
} else {
readHeader();
=======================================
--- /branches/nov14/casa/IO/MultiFile.h Tue Mar 24 14:43:31 2015 UTC
+++ /branches/nov14/casa/IO/MultiFile.h Tue Mar 24 15:32:48 2015 UTC
@@ -145,9 +145,10 @@
virtual void readBlock (MultiFileInfo& info, Int64 blknr,
void* buffer);

- protected:
+ private:
//# Data members
- FiledesIO itsIO;
+ FiledesIO itsIO;
+ int itsFD;
};


=======================================
--- /branches/nov14/casa/IO/MultiFileBase.cc Tue Mar 24 14:43:31 2015 UTC
+++ /branches/nov14/casa/IO/MultiFileBase.cc Tue Mar 24 15:32:48 2015 UTC
@@ -33,6 +33,7 @@
#include <casacore/casa/Exceptions/Error.h>
#include <casacore/casa/OS/File.h> // for fileFSTAT
#include <sys/stat.h> // needed for stat or stat64
+#include <string.h>

namespace casacore { //# NAMESPACE CASACORE - BEGIN

@@ -45,26 +46,27 @@
{ ios >> info.name >> info.blockNrs >> info.fsize; }


- MultiFileBase::MultiFileBase (const String& name, ByteIO::OpenOption
option,
- Int blockSize)
+ MultiFileBase::MultiFileBase (const String& name, Int blockSize)
: itsBlockSize (blockSize),
itsNrBlock (0),
itsHdrCounter (0),
itsChanged (False)
{
itsName = Path(name).expandedName();
- if (option == ByteIO::New || option == ByteIO::NewNoReplace) {
- // New file.
- itsChanged = True;
- // Use file system block size, but not less than given size.
- if (itsBlockSize <= 0) {
- struct fileSTAT sfs;
- fileFSTAT (itsFD, &sfs);
- Int64 blksz = sfs.st_blksize;
- itsBlockSize = std::max (-itsBlockSize, blksz);
- }
- AlwaysAssert (itsBlockSize > 0, AipsError);
+ }
+
+ void MultiFileBase::setNewFile()
+ {
+ // New file.
+ itsChanged = True;
+ // Use file system block size, but not less than given size.
+ if (itsBlockSize <= 0) {
+ struct fileSTAT sfs;
+ fileSTAT (itsName.c_str(), &sfs);
+ Int64 blksz = sfs.st_blksize;
+ itsBlockSize = std::max (-itsBlockSize, blksz);
}
+ AlwaysAssert (itsBlockSize > 0, AipsError);
}

MultiFileBase::~MultiFileBase()
=======================================
--- /branches/nov14/casa/IO/MultiFileBase.h Tue Mar 24 14:43:31 2015 UTC
+++ /branches/nov14/casa/IO/MultiFileBase.h Tue Mar 24 15:32:48 2015 UTC
@@ -137,7 +137,7 @@
// Open or create a MultiFileBase with the given name.
// Upon creation the block size can be given. If 0, it uses the block
size
// of the file system the file is on.
- MultiFileBase (const String& name, ByteIO::OpenOption, Int
blockSize=0);
+ MultiFileBase (const String& name, Int blockSize=0);

// The destructor flushes and closes the file.
virtual ~MultiFileBase();
@@ -232,13 +232,15 @@
void* buffer) = 0;

protected:
+ // Set the flags and blockSize for a new MultiFile/HDF5.
+ void setNewFile();
+
//# Data members
String itsName;
Int64 itsBlockSize; // The blocksize used
Int64 itsNrBlock; // The total nr of blocks actually used
Int64 itsHdrCounter; // Counter of header changes
vector<MultiFileInfo> itsInfo;
- int itsFD;
Bool itsWritable; // Is the file writable?
Bool itsChanged; // Has header info changed since
last flush?
vector<Int64> itsFreeBlocks;
=======================================
--- /branches/nov14/casa/IO/MultiHDF5.cc Tue Mar 24 14:43:31 2015 UTC
+++ /branches/nov14/casa/IO/MultiHDF5.cc Tue Mar 24 15:32:48 2015 UTC
@@ -36,10 +36,12 @@

MultiHDF5::MultiHDF5 (const String& name, ByteIO::OpenOption option,
Int blockSize)
- : MultiFileBase (name, option, blockSize),
+ : MultiFileBase (name, blockSize),
itsFile (itsName, option)
{
- if (option != ByteIO::New && option != ByteIO::NewNoReplace) {
+ if (option == ByteIO::New || option == ByteIO::NewNoReplace) {
+ setNewFile();
+ } else {
readHeader();
}
itsWritable = itsFile.isWritable();
Reply all
Reply to author
Forward
0 new messages