ZXC 0.15.0
High-performance asymmetric lossless compression library
Loading...
Searching...
No Matches
Error Handling

Enumerations

enum  zxc_error_t {
  ZXC_OK = 0 , ZXC_ERROR_MEMORY = -1 , ZXC_ERROR_DST_TOO_SMALL = -2 , ZXC_ERROR_SRC_TOO_SMALL = -3 ,
  ZXC_ERROR_BAD_MAGIC = -4 , ZXC_ERROR_BAD_VERSION = -5 , ZXC_ERROR_BAD_HEADER = -6 , ZXC_ERROR_BAD_CHECKSUM = -7 ,
  ZXC_ERROR_CORRUPT_DATA = -8 , ZXC_ERROR_BAD_OFFSET = -9 , ZXC_ERROR_OVERFLOW = -10 , ZXC_ERROR_IO = -11 ,
  ZXC_ERROR_NULL_INPUT = -12 , ZXC_ERROR_BAD_BLOCK_TYPE = -13 , ZXC_ERROR_BAD_BLOCK_SIZE = -14 , ZXC_ERROR_DICT_REQUIRED = -15 ,
  ZXC_ERROR_DICT_MISMATCH = -16 , ZXC_ERROR_DICT_TOO_LARGE = -17 , ZXC_ERROR_BAD_LEVEL = -18 , ZXC_ERROR_DICT_UNSUPPORTED = -19
}
 Error codes returned by ZXC library functions. More...
 

Functions

const char * zxc_error_name (const int code)
 Returns a readable name for the given error code.
 

Detailed Description

Enumeration Type Documentation

◆ zxc_error_t

Error codes returned by ZXC library functions.

All negative, returned in place of the int / int64_t result on failure, so result < 0 is the check.

Enumerator
ZXC_OK 

Success (no error).

ZXC_ERROR_MEMORY 

Memory allocation failure.

ZXC_ERROR_DST_TOO_SMALL 

Destination buffer too small.

ZXC_ERROR_SRC_TOO_SMALL 

Source buffer too small or truncated input.

ZXC_ERROR_BAD_MAGIC 

Invalid magic word in file header.

ZXC_ERROR_BAD_VERSION 

Unsupported file format version.

ZXC_ERROR_BAD_HEADER 

Corrupted or invalid header (checksum mismatch).

ZXC_ERROR_BAD_CHECKSUM 

A block's decoded bytes fail its checksum, or the archive digest mismatches.

Corrupt compressed bytes may trip the decoder first, with another code.

ZXC_ERROR_CORRUPT_DATA 

Corrupted compressed data.

ZXC_ERROR_BAD_OFFSET 

Invalid match offset during decompression.

ZXC_ERROR_OVERFLOW 

Buffer overflow detected during processing.

ZXC_ERROR_IO 

Read/write/seek failure on file.

ZXC_ERROR_NULL_INPUT 

Required input pointer is NULL.

ZXC_ERROR_BAD_BLOCK_TYPE 

Unknown or unexpected block type.

ZXC_ERROR_BAD_BLOCK_SIZE 

Invalid block size.

ZXC_ERROR_DICT_REQUIRED 

File requires a dictionary but none was provided.

ZXC_ERROR_DICT_MISMATCH 

Provided dictionary ID does not match the file header.

ZXC_ERROR_DICT_TOO_LARGE 

Dictionary exceeds maximum allowed size.

ZXC_ERROR_BAD_LEVEL 

Compression level not supported by this context's workspace.

ZXC_ERROR_DICT_UNSUPPORTED 

Dictionary not supported by this context's workspace.

Definition at line 37 of file zxc_error.h.

Function Documentation

◆ zxc_error_name()

const char * zxc_error_name ( const int  code)

Returns a readable name for the given error code.

Parameters
[in]codeA zxc_error_t code (or any integer).
Returns
A constant string such as "ZXC_OK" or "ZXC_ERROR_MEMORY", or "ZXC_UNKNOWN_ERROR" for an unrecognized code.

Returns a readable name for the given error code.

Definition at line 1100 of file zxc_common.c.

References ZXC_ERROR_BAD_BLOCK_SIZE, ZXC_ERROR_BAD_BLOCK_TYPE, ZXC_ERROR_BAD_CHECKSUM, ZXC_ERROR_BAD_HEADER, ZXC_ERROR_BAD_LEVEL, ZXC_ERROR_BAD_MAGIC, ZXC_ERROR_BAD_OFFSET, ZXC_ERROR_BAD_VERSION, ZXC_ERROR_CORRUPT_DATA, ZXC_ERROR_DICT_MISMATCH, ZXC_ERROR_DICT_REQUIRED, ZXC_ERROR_DICT_TOO_LARGE, ZXC_ERROR_DICT_UNSUPPORTED, ZXC_ERROR_DST_TOO_SMALL, ZXC_ERROR_IO, ZXC_ERROR_MEMORY, ZXC_ERROR_NULL_INPUT, ZXC_ERROR_OVERFLOW, ZXC_ERROR_SRC_TOO_SMALL, and ZXC_OK.