Skip to content

Commit

Permalink
validate only PKGV part, ignore number
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Maiquez <[email protected]>
  • Loading branch information
Almamu committed Dec 12, 2023
1 parent 89a2178 commit f89cc43
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions src/WallpaperEngine/Assets/CPackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,12 @@ void CPackage::validateHeader (FILE* fp)
{
char* pointer = this->readSizedString (fp);

// finally validate the header version
if (strcmp ("PKGV0001", pointer) != 0 &&
strcmp ("PKGV0002", pointer) != 0 &&
strcmp ("PKGV0003", pointer) != 0 &&
strcmp ("PKGV0004", pointer) != 0 &&
strcmp ("PKGV0005", pointer) != 0 &&
strcmp ("PKGV0006", pointer) != 0 &&
strcmp ("PKGV0007", pointer) != 0 &&
strcmp ("PKGV0008", pointer) != 0 &&
strcmp ("PKGV0009", pointer) != 0 &&
strcmp ("PKGV0010", pointer) != 0 &&
strcmp ("PKGV0012", pointer) != 0 &&
strcmp ("PKGV0013", pointer) != 0 &&
strcmp ("PKGV0014", pointer) != 0 &&
strcmp ("PKGV0015", pointer) != 0 &&
strcmp ("PKGV0016", pointer) != 0 &&
strcmp ("PKGV0017", pointer) != 0 &&
strcmp ("PKGV0018", pointer) != 0)
if (strncmp ("PKGV", pointer, 4) != 0)
{
std::stringstream msg;
msg << "Unsupported package version: " << pointer;
msg << "Expected PKGV indicator, found " << pointer;
delete[] pointer;
throw std::runtime_error (msg.str ());
throw std::runtime_error(msg.str());
}

// free memory
Expand Down

0 comments on commit f89cc43

Please sign in to comment.