Skip to content

Commit

Permalink
Code cleanup / speedup and preparing for LZX.
Browse files Browse the repository at this point in the history
  • Loading branch information
GHFear authored Dec 26, 2023
1 parent e83c38d commit 4d98d55
Show file tree
Hide file tree
Showing 15 changed files with 3,000 additions and 1,985 deletions.
864 changes: 864 additions & 0 deletions RW4ArchiveTool/Archives/Compression/lzx/lzx.c

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions RW4ArchiveTool/Archives/Compression/lzx/lzx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#pragma once

/***************************************************************************
* lzx.h - LZX decompression routines *
* ------------------- *
* *
* maintainer: Jed Wing <jedwin@ugcs.caltech.edu> *
* source: modified lzx.c from cabextract v0.5 *
* notes: This file was taken from cabextract v0.5, which was, *
* itself, a modified version of the lzx decompression code *
* from unlzx. *
***************************************************************************/

/***************************************************************************
* *
* 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. Note that an exemption to this *
* license has been granted by Stuart Caie for the purposes of *
* distribution with chmlib. This does not, to the best of my *
* knowledge, constitute a change in the license of this (the LZX) code *
* in general. *
* *
***************************************************************************/

#ifndef INCLUDED_LZX_H
#define INCLUDED_LZX_H

#ifdef __cplusplus
extern "C" {
#endif
/* return codes */
#define DECR_OK (0)
#define DECR_DATAFORMAT (1)
#define DECR_ILLEGALDATA (2)
#define DECR_NOMEMORY (3)

/* opaque state structure */
struct lzx_state;

/* create an lzx state object */
struct lzx_state* lzx_init(int window);

/* destroy an lzx state object */
void lzx_teardown(struct lzx_state* pState);

/* reset an lzx stream */
void lzx_reset(struct lzx_state* pState);

/* decompress an LZX compressed block */
int lzx_decompress(struct lzx_state* pState, unsigned char* inpos, unsigned char* outpos, int inlen,
int outlen);

#ifdef __cplusplus
}
#endif

#endif /* INCLUDED_LZX_H */
Loading

0 comments on commit 4d98d55

Please sign in to comment.