     var fileOffset : Int = 1
     
     // data.length + header.length;
-    let dataSize = sizeof(H) + sizeof(D)  // test as CUnsignedLongLong
+    let headerSize = sizeof(H)
+    let dataSize = sizeof(D)
+    let blockSize = sizeof(H) + sizeof(D)  // test as CUnsignedLongLong
     
     var endOfFile: CUnsignedLongLong = 0;
     var unusedDataSegments =  Dictionary<CUnsignedLongLong,Bool>()

            newFile = true
        }
        
        self.endOfFile = self.fileHandle.seekToEndOfFile()
        
        self.fileHandle = NSFileHandle.fileHandleForUpdatingURL(url, error: &self.error)
    }
    
    // override in subclasses and update fileOffset if required

        
        let pos = self.endOfFile
        
        self.endOfFile = pos + CUnsignedLongLong(blockSize)
        
        return pos;
    }
