Public Member Functions | Data Fields

# ZlibSaveFilter Struct Reference

Filter using Zlib compression. More...

Inheritance diagram for ZlibSaveFilter:

## Public Member Functions
| ZlibSaveFilter (SaveFilter *chain, byte compression_level)
| Initialise this filter.
| ~ZlibSaveFilter ()
| Clean up what we allocated.
void | WriteLoop (byte *p, size_t len, int mode)
| Helper loop for writing the data.
void | Write (byte *buf, size_t size)
| Write a given number of bytes into the savegame.
void | Finish ()
| Prepare everything to finish writing the savegame.
## Data Fields
z_stream | z
| Stream state we are writing to.

## Detailed Description

Filter using Zlib compression.

Definition at line 2044 of file saveload.cpp.

## Constructor & Destructor Documentation

ZlibSaveFilter::ZlibSaveFilter | ( | SaveFilter * | chain,
|  | byte | compression_level |
| ) |  |  | `[inline]`

Initialise this filter.

Parameters:

  | chain | The next filter in this chain.
  | compression_level | The requested level of compression.

Definition at line 2052 of file saveload.cpp.

References SlError(), and z.

ZlibSaveFilter::~ZlibSaveFilter | ( |  | ) | `[inline]`

Clean up what we allocated.

Definition at line 2059 of file saveload.cpp.

References z.

## Member Function Documentation

void ZlibSaveFilter::Write | ( | byte * | buf,
|  | size_t | len |
| ) |  |  | `[inline, virtual]`

Write a given number of bytes into the savegame.

Parameters:

  | buf | The bytes to write.
  | len | The number of bytes to write.

Implements SaveFilter.

Definition at line 2099 of file saveload.cpp.

References WriteLoop().

void ZlibSaveFilter::WriteLoop | ( | byte * | p,
|  | size_t | len,
|  | int | mode |
| ) |  |  | `[inline]`

Helper loop for writing the data.

Parameters:

  | p | The bytes to write.
  | len | Amount of bytes to write.
  | mode | Mode for deflate.

For the poor next soul who sees many valgrind warnings of the "Conditional jump or move depends on uninitialised value(s)" kind: According to the author of zlib it is not a bug and it won't be fixed. http://groups.google.com/group/comp.compression/browse_thread/thread/b154b8def8c2a3ef/cdf9b8729ce17ee2 [Mark Adler, Feb 24 2004, 'zlib-1.2.1 valgrind warnings' in the newgroup comp.compression]

Definition at line 2070 of file saveload.cpp.

References SaveFilter::chain, MEMORY_CHUNK_SIZE, SlError(), SaveFilter::Write(), and z.

Referenced by Finish(), and Write().

The documentation for this struct was generated from the following file:

- src/saveload/saveload.cpp