TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CascDecompress.cpp File Reference
#include "CascLib.h"
#include "CascCommon.h"
+ Include dependency graph for CascDecompress.cpp:

Macros

#define __CASCLIB_SELF__
 

Functions

int CascDecompress (LPBYTE pbOutBuffer, PDWORD pcbOutBuffer, LPBYTE pbInBuffer, DWORD cbInBuffer)
 

Macro Definition Documentation

#define __CASCLIB_SELF__

Function Documentation

int CascDecompress ( LPBYTE  pbOutBuffer,
PDWORD  pcbOutBuffer,
LPBYTE  pbInBuffer,
DWORD  cbInBuffer 
)
19 {
20  z_stream z; // Stream information for zlib
21  int nResult;
22 
23  // Fill the stream structure for zlib
24  z.next_in = pbInBuffer;
25  z.avail_in = cbInBuffer;
26  z.total_in = cbInBuffer;
27  z.next_out = pbOutBuffer;
28  z.avail_out = *pcbOutBuffer;
29  z.total_out = 0;
30  z.zalloc = NULL;
31  z.zfree = NULL;
32 
33  // Initialize the decompression structure
34  if((nResult = inflateInit(&z)) == Z_OK)
35  {
36  // Call zlib to decompress the data
37  nResult = inflate(&z, Z_NO_FLUSH);
38  inflateEnd(&z);
39 
40  // Give the size of the uncompressed data
41  *pcbOutBuffer = z.total_out;
42  }
43 
44  // Return an error code
45  return (nResult == Z_OK || nResult == Z_STREAM_END) ? ERROR_SUCCESS : ERROR_FILE_CORRUPT;
46 }
#define Z_NO_FLUSH
Definition: zlib.h:164
uInt avail_in
Definition: zlib.h:87
#define ERROR_FILE_CORRUPT
Definition: CascPort.h:218
arena_t NULL
Definition: jemalloc_internal.h:624
free_func zfree
Definition: zlib.h:98
uLong total_in
Definition: zlib.h:88
G3D::int16 z
Definition: Vector3int16.h:46
#define Z_STREAM_END
Definition: zlib.h:174
alloc_func zalloc
Definition: zlib.h:97
Bytef * next_out
Definition: zlib.h:90
uLong total_out
Definition: zlib.h:92
#define inflateInit(strm)
Definition: zlib.h:1649
uInt avail_out
Definition: zlib.h:91
z_const Bytef * next_in
Definition: zlib.h:86
#define Z_OK
Definition: zlib.h:173
Definition: zlib.h:85
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the caller graph for this function: