dernc.h File Reference


Detailed Description

RNC decompression support.

Purpose:
Header file. Defines exported routines from dernc.c.
Comment:
None.
Author:
Jon Skeet
Date:
14 Oct 1997 - 22 Jul 2008
Copying and copyrights:
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file dernc.h.

Go to the source code of this file.

Defines

#define RNC_FILE_IS_NOT_RNC   -1
#define RNC_HUF_DECODE_ERROR   -2
#define RNC_FILE_SIZE_MISMATCH   -3
#define RNC_PACKED_CRC_ERROR   -4
#define RNC_UNPACKED_CRC_ERROR   -5
#define RNC_HEADER_VAL_ERROR   -6
#define RNC_HUF_EXCEEDS_RANGE   -7
#define RNC_MAX_FILESIZE   1<<30
 Limit of the compressed & decompressed file sizes.
#define SIZEOF_RNC_HEADER   18
 Length of the RNC file header, in bytes.

Typedefs

typedef long(* rnc_callback )(long done, long total)

Enumerations

enum  EXTRA_OBJ_LOAD {
  RNC_IGNORE_NONE = 0x0000, RNC_IGNORE_FILE_IS_NOT_RNC = 0x0001, RNC_IGNORE_HUF_DECODE_ERROR = 0x0002, RNC_IGNORE_FILE_SIZE_MISMATCH = 0x0004,
  RNC_IGNORE_PACKED_CRC_ERROR = 0x0008, RNC_IGNORE_UNPACKED_CRC_ERROR = 0x0010, RNC_IGNORE_HEADER_VAL_ERROR = 0x0020, RNC_IGNORE_HUF_EXCEEDS_RANGE = 0x0040,
  EXLD_THING = 0x01, EXLD_ACTNPT = 0x02, EXLD_STLGHT = 0x04
}
 Flags to ignore errors. More...

Functions

long rnc_plen (void *packed)
 Return the compressed length of a packed data block.
long rnc_ulen (void *packed)
 Return the uncompressed length of a packed data block.
long rnc_unpack (const void *packed, void *unpacked, const unsigned int flags)
 Decompress a packed data block.
long rnc_nocallback (long done, long total)
 Empty callback - for use if no callback is needed.
long rnc_printcallback (long done, long total)
 Console print callback - for use in console tools.
char * rnc_error (long errcode)
 Returns an error string corresponding to an error code.
long rnc_crc (const void *data, unsigned long len)
 Calculate a CRC, the RNC way.


Define Documentation

#define RNC_FILE_IS_NOT_RNC   -1

Definition at line 44 of file dernc.h.

Referenced by memfile_read(), rnc_plen(), and rnc_ulen().

#define RNC_FILE_SIZE_MISMATCH   -3

Definition at line 46 of file dernc.h.

Referenced by rnc_unpack().

#define RNC_HEADER_VAL_ERROR   -6

Definition at line 49 of file dernc.h.

Referenced by rnc_unpack().

#define RNC_HUF_DECODE_ERROR   -2

Definition at line 45 of file dernc.h.

Referenced by rnc_unpack().

#define RNC_HUF_EXCEEDS_RANGE   -7

Definition at line 50 of file dernc.h.

Referenced by rnc_unpack().

#define RNC_MAX_FILESIZE   1<<30

Limit of the compressed & decompressed file sizes.

Definition at line 76 of file dernc.h.

Referenced by rnc_unpack().

#define RNC_PACKED_CRC_ERROR   -4

Definition at line 47 of file dernc.h.

Referenced by rnc_unpack().

#define RNC_UNPACKED_CRC_ERROR   -5

Definition at line 48 of file dernc.h.

Referenced by rnc_unpack().

#define SIZEOF_RNC_HEADER   18

Length of the RNC file header, in bytes.

Definition at line 81 of file dernc.h.

Referenced by memfile_read(), and rnc_unpack().


Typedef Documentation

typedef long(* rnc_callback)(long done, long total)

Definition at line 21 of file dernc.h.


Enumeration Type Documentation

Flags to ignore errors.

Enumerator:
RNC_IGNORE_NONE 
RNC_IGNORE_FILE_IS_NOT_RNC 
RNC_IGNORE_HUF_DECODE_ERROR 
RNC_IGNORE_FILE_SIZE_MISMATCH 
RNC_IGNORE_PACKED_CRC_ERROR 
RNC_IGNORE_UNPACKED_CRC_ERROR 
RNC_IGNORE_HEADER_VAL_ERROR 
RNC_IGNORE_HUF_EXCEEDS_RANGE 
EXLD_THING 
EXLD_ACTNPT 
EXLD_STLGHT 

Definition at line 55 of file dernc.h.


Function Documentation

long rnc_crc ( const void *  data,
unsigned long  len 
)

Calculate a CRC, the RNC way.

Parameters:
data The data buffer.
len data Length of the data buffer.
Returns:
The CRC value for given data.

Definition at line 715 of file dernc.c.

Referenced by rnc_unpack().

char* rnc_error ( long  errcode  ) 

Returns an error string corresponding to an error code.

Parameters:
errcode Error code returned by a function.
Returns:
Error message string.

Definition at line 272 of file dernc.c.

Referenced by memfile_error().

long rnc_nocallback ( long  done,
long  total 
)

Empty callback - for use if no callback is needed.

Definition at line 327 of file dernc.c.

long rnc_plen ( void *  packed  ) 

Return the compressed length of a packed data block.

The packed buffer must be longer than SIZEOF_RNC_HEADER.

Parameters:
packed Packed buffer.
Returns:
Returns compressed length of the packed block, or a negative error code.

Definition at line 316 of file dernc.c.

Referenced by memfile_read().

long rnc_printcallback ( long  done,
long  total 
)

Console print callback - for use in console tools.

Definition at line 333 of file dernc.c.

long rnc_ulen ( void *  packed  ) 

Return the uncompressed length of a packed data block.

The packed buffer must be longer than SIZEOF_RNC_HEADER.

Parameters:
packed Packed buffer.
Returns:
Uncompressed length of the packed block, or a negative error code.

Definition at line 301 of file dernc.c.

Referenced by memfile_read().

long rnc_unpack ( const void *  packed,
void *  unpacked,
const unsigned int  flags 
)

Decompress a packed data block.

Parameters:
packed Packed source data buffer.
unpacked Unpacked destination data buffer.
flags Option flags for the decompressor.
Returns:
Returns the unpacked length if successful, or negative error code if not. If COMPRESSOR is defined, it also returns the leeway number (which gets stored at offset 16 into the compressed-file header) in `*leeway', if `leeway' isn't NULL.

Definition at line 351 of file dernc.c.

Referenced by memfile_read().


Generated on Tue Sep 2 18:51:48 2008 for libAdikted by  doxygen 1.5.6