- uncoupled the decompressors from ZDoom's internal error handling.

This code made it hard to repurpose this code for other tools, so now the error handler must be passed as a callback to OpenDecompressor.
This commit is contained in:
Christoph Oelckers 2019-08-20 22:34:35 +02:00
commit 0abc66dbff
10 changed files with 115 additions and 68 deletions

View file

@ -995,3 +995,33 @@ bool IsAbsPath(const char *name)
#endif /* _WIN32 */
return 0;
}
//
// M_ZlibError
//
FString M_ZLibError(int zerr)
{
if (zerr >= 0)
{
return "OK";
}
else if (zerr < -6)
{
FString out;
out.Format("%d", zerr);
return out;
}
else
{
static const char* errs[6] =
{
"Errno",
"Stream Error",
"Data Error",
"Memory Error",
"Buffer Error",
"Version Error"
};
return errs[-zerr - 1];
}
}