-int configcache::readHeader()
-{
- long unsigned int headersize;
-
- if( readDataToMem((char *)&headersize, sizeof(long unsigned int)) == sizeof(long unsigned int) && inFile.is_open() ) {
- if ( headersize == 0 )
- return HEADER_READLAST;
-
- pair<unsigned long, void *> newHeader;
-
- if( readDataToMem((char *)&newHeader.first, sizeof(unsigned long)) == sizeof(unsigned long) && inFile.is_open() ) {
- newHeader.second = malloc(headersize);
-
- if( readDataToMem((char *)newHeader.second, headersize) == headersize && inFile.is_open() ) {
- headerStore.push_back(newHeader);
- return HEADER_READOK;
- }
- else {
- if(out) *out->log << "CCACHE: Could not read heade-data! Closing dat-file: " << openFileDesc.filename << endl << flush;
- inFile.close();
- return HEADER_READERR;
- }
- }
- else {
- if(out) *out->log << "CCACHE: Could not read headerid-hash! Closing dat-file: " << openFileDesc.filename << endl << flush;
- inFile.close();
- return HEADER_READERR;
- }
- }
- else {
- if(out) *out->log << "CCACHE: Could not read header size. Closing dat-file: " << openFileDesc.filename << endl << flush;
- inFile.close();
- return HEADER_READERR;
- }
-}
-
-bool configcache::readAllHeaders()
-{
- int readHeaderStatus;
-
- deleteHeaderStore();
-
- do {
- readHeaderStatus = readHeader();
- }
- while ( readHeaderStatus == HEADER_READOK );
-
- if ( readHeaderStatus == HEADER_READLAST ) return true;
- else if ( readHeaderStatus == HEADER_READERR ) return false;
-}
-