fix flat-db:
- no reason to read twice on load - should read using temp object instead the one we want to save on dump
This commit is contained in:
parent
2c3e480681
commit
f89635f73a
@ -173,6 +173,7 @@ public:
|
|||||||
|
|
||||||
bool Load(T& objToLoad)
|
bool Load(T& objToLoad)
|
||||||
{
|
{
|
||||||
|
LogPrintf("Reading info from %s...\n", strFilename);
|
||||||
ReadResult readResult = Read(objToLoad);
|
ReadResult readResult = Read(objToLoad);
|
||||||
if (readResult == FileError)
|
if (readResult == FileError)
|
||||||
LogPrintf("Missing file - %s, will try to recreate\n", strFilename);
|
LogPrintf("Missing file - %s, will try to recreate\n", strFilename);
|
||||||
@ -189,10 +190,6 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrintf("Reading info from %s...\n", strFilename);
|
|
||||||
Read(objToLoad);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,25 +198,23 @@ public:
|
|||||||
int64_t nStart = GetTimeMillis();
|
int64_t nStart = GetTimeMillis();
|
||||||
|
|
||||||
LogPrintf("Verifying %s format...\n", strFilename);
|
LogPrintf("Verifying %s format...\n", strFilename);
|
||||||
|
T tmpObjToLoad;
|
||||||
|
ReadResult readResult = Read(tmpObjToLoad, true);
|
||||||
|
|
||||||
// 12.1 -- pls fix -- causing corruption of the dat files ---
|
// there was an error and it was not an error on file opening => do not proceed
|
||||||
|
if (readResult == FileError)
|
||||||
// ReadResult readResult = Read(objToSave, true);
|
LogPrintf("Missing file - %s, will try to recreate\n", strFilename);
|
||||||
|
else if (readResult != Ok)
|
||||||
// // there was an error and it was not an error on file opening => do not proceed
|
{
|
||||||
// if (readResult == FileError)
|
LogPrintf("Error reading %s: ", strFilename);
|
||||||
// LogPrintf("Missing file - %s, will try to recreate\n", strFilename);
|
if(readResult == IncorrectFormat)
|
||||||
// else if (readResult != Ok)
|
LogPrintf("magic is ok but data has invalid format, will try to recreate\n");
|
||||||
// {
|
else
|
||||||
// LogPrintf("Error reading %s: ", strFilename);
|
{
|
||||||
// if(readResult == IncorrectFormat)
|
LogPrintf("file format is unknown or invalid, please fix it manually\n");
|
||||||
// LogPrintf("magic is ok but data has invalid format, will try to recreate\n");
|
return false;
|
||||||
// else
|
}
|
||||||
// {
|
}
|
||||||
// LogPrintf("file format is unknown or invalid, please fix it manually\n");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
LogPrintf("Writting info to %s...\n", strFilename);
|
LogPrintf("Writting info to %s...\n", strFilename);
|
||||||
Write(objToSave);
|
Write(objToSave);
|
||||||
|
Loading…
Reference in New Issue
Block a user