From cc6946c95b99baa1c9856a5088ce78557243793a Mon Sep 17 00:00:00 2001 From: Thulinma Date: Sun, 7 Sep 2014 23:41:59 +0200 Subject: [PATCH] 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. --- lib/dtsc.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/dtsc.cpp b/lib/dtsc.cpp index a4d2190e..e9cf21cc 100644 --- a/lib/dtsc.cpp +++ b/lib/dtsc.cpp @@ -608,18 +608,11 @@ DTSC::File::File(std::string filename, bool create) { return; } if (memcmp(buffer, DTSC::Magic_Header, 4) != 0) { - if (memcmp(buffer, DTSC::Magic_Packet2, 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()); - fclose(F); - F = 0; - return; - } + if (memcmp(buffer, DTSC::Magic_Packet2, 4) != 0 && memcmp(buffer, DTSC::Magic_Packet, 4) != 0) { + DEBUG_MSG(DLVL_ERROR, "%s is not a valid DTSC file", filename.c_str()); + fclose(F); + F = 0; + return; } else { metadata.moreheader = -1; }