mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 00:21:43 +00:00
- Added textual descriptions of the zlib errors.
SVN r3689 (trunk)
This commit is contained in:
parent
c197d0687c
commit
08272a29ad
6 changed files with 39 additions and 5 deletions
|
@ -54,6 +54,7 @@
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
|
#include "m_misc.h"
|
||||||
#include "dobject.h"
|
#include "dobject.h"
|
||||||
|
|
||||||
// These are special tokens found in the data stream of an archive.
|
// These are special tokens found in the data stream of an archive.
|
||||||
|
@ -408,7 +409,7 @@ void FCompressedFile::Explode ()
|
||||||
_heapchk();
|
_heapchk();
|
||||||
M_Free (expand);
|
M_Free (expand);
|
||||||
_heapchk();
|
_heapchk();
|
||||||
I_Error ("Could not decompress cfile");
|
I_Error ("Could not decompress buffer: %s", M_ZLibError(r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
|
#include "m_misc.h"
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -223,7 +224,7 @@ FileReaderZ::FileReaderZ (FileReader &file, bool zip)
|
||||||
|
|
||||||
if (err != Z_OK)
|
if (err != Z_OK)
|
||||||
{
|
{
|
||||||
I_Error ("FileReaderZ: inflateInit failed: %d\n", err);
|
I_Error ("FileReaderZ: inflateInit failed: %s\n", M_ZLibError(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2513,7 +2513,7 @@ bool G_ProcessIFFDemo (char *mapname)
|
||||||
int r = uncompress (uncompressed, &uncompSize, demo_p, uLong(zdembodyend - demo_p));
|
int r = uncompress (uncompressed, &uncompSize, demo_p, uLong(zdembodyend - demo_p));
|
||||||
if (r != Z_OK)
|
if (r != Z_OK)
|
||||||
{
|
{
|
||||||
Printf ("Could not decompress demo!\n");
|
Printf ("Could not decompress demo! %s\n", M_ZLibError(r));
|
||||||
delete[] uncompressed;
|
delete[] uncompressed;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "st_start.h"
|
#include "st_start.h"
|
||||||
|
#include "m_misc.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
|
|
||||||
#include "i_net.h"
|
#include "i_net.h"
|
||||||
|
@ -303,7 +303,7 @@ void PacketGet (void)
|
||||||
// Printf("recv %d/%lu\n", c, msgsize + 1);
|
// Printf("recv %d/%lu\n", c, msgsize + 1);
|
||||||
if (err != Z_OK)
|
if (err != Z_OK)
|
||||||
{
|
{
|
||||||
Printf("Net decompression failed (zlib error %d)\n", err);
|
Printf("Net decompression failed (zlib error %s)\n", M_ZLibError(err));
|
||||||
// Pretend no packet
|
// Pretend no packet
|
||||||
doomcom.remotenode = -1;
|
doomcom.remotenode = -1;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -780,3 +780,33 @@ CCMD (screenshot)
|
||||||
else
|
else
|
||||||
G_ScreenShot (argv[1]);
|
G_ScreenShot (argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -47,4 +47,6 @@ void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection, siz
|
||||||
// Prepends ~/.zdoom to path
|
// Prepends ~/.zdoom to path
|
||||||
FString GetUserFile (const char *path);
|
FString GetUserFile (const char *path);
|
||||||
|
|
||||||
|
FString M_ZLibError(int zerrnum);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue