Fixed incorrect handling of the case where an invalid DTSC file has a valid DTSH file. Now correctly cancels reading, while previously threw up a whole bunch of error vomit. Yay.

This commit is contained in:
Thulinma 2014-09-07 23:41:59 +02:00
parent 5792097cc4
commit cc6946c95b

View file

@ -608,18 +608,11 @@ DTSC::File::File(std::string filename, bool create) {
return; return;
} }
if (memcmp(buffer, DTSC::Magic_Header, 4) != 0) { if (memcmp(buffer, DTSC::Magic_Header, 4) != 0) {
if (memcmp(buffer, DTSC::Magic_Packet2, 4) != 0) { if (memcmp(buffer, DTSC::Magic_Packet2, 4) != 0 && memcmp(buffer, DTSC::Magic_Packet, 4) != 0) {
File Fhead(filename + ".dtsh");
if (Fhead) {
metaStorage = Fhead.metaStorage;
metadata = metaStorage;
sepHeader = true;
} else {
DEBUG_MSG(DLVL_ERROR, "%s is not a valid DTSC file", filename.c_str()); DEBUG_MSG(DLVL_ERROR, "%s is not a valid DTSC file", filename.c_str());
fclose(F); fclose(F);
F = 0; F = 0;
return; return;
}
} else { } else {
metadata.moreheader = -1; metadata.moreheader = -1;
} }