mirror of https://github.com/OpenTTD/OpenTTD
(svn r17216) -Update: MiniLZO from 1.08 to 2.03.
parent
a8773bba2d
commit
d4adee0b1d
|
@ -2335,6 +2335,10 @@
|
||||||
RelativePath=".\..\src\3rdparty\minilzo\lzoconf.h"
|
RelativePath=".\..\src\3rdparty\minilzo\lzoconf.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\..\src\3rdparty\minilzo\lzodefs.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\..\src\3rdparty\minilzo\minilzo.c"
|
RelativePath=".\..\src\3rdparty\minilzo\minilzo.c"
|
||||||
>
|
>
|
||||||
|
|
|
@ -2332,6 +2332,10 @@
|
||||||
RelativePath=".\..\src\3rdparty\minilzo\lzoconf.h"
|
RelativePath=".\..\src\3rdparty\minilzo\lzoconf.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\..\src\3rdparty\minilzo\lzodefs.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\..\src\3rdparty\minilzo\minilzo.c"
|
RelativePath=".\..\src\3rdparty\minilzo\minilzo.c"
|
||||||
>
|
>
|
||||||
|
|
|
@ -533,6 +533,7 @@ table/water_land.h
|
||||||
|
|
||||||
# MiniLZO
|
# MiniLZO
|
||||||
3rdparty/minilzo/lzoconf.h
|
3rdparty/minilzo/lzoconf.h
|
||||||
|
3rdparty/minilzo/lzodefs.h
|
||||||
3rdparty/minilzo/minilzo.c
|
3rdparty/minilzo/minilzo.c
|
||||||
3rdparty/minilzo/minilzo.h
|
3rdparty/minilzo/minilzo.h
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Version 2, June 1991
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,38 @@
|
||||||
#
|
#
|
||||||
# a very simple Makefile for miniLZO
|
# a very simple Makefile for miniLZO
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996-2002 Markus F.X.J. Oberhumer
|
# Copyright (C) 1996-2008 Markus F.X.J. Oberhumer
|
||||||
#
|
#
|
||||||
|
|
||||||
|
PROGRAM = testmini
|
||||||
SOURCES = testmini.c minilzo.c
|
SOURCES = testmini.c minilzo.c
|
||||||
|
|
||||||
default all:
|
default:
|
||||||
@echo "Please choose one of the following targets:"
|
@echo "Please choose one of the following targets:"
|
||||||
@echo " gcc gcc-i386 gcc-rs6000"
|
@echo " gcc: gcc"
|
||||||
@echo " visualc watcomc watcomc16"
|
@echo " unix: hpux hpux9"
|
||||||
@echo " hpux hpux9"
|
@echo " win32: win32-bc win32-cygwin win32-dm win32-lccwin32"
|
||||||
|
@echo " win32-intelc win32-mingw win32-vc win32-watcomc"
|
||||||
|
@echo " dos16: dos16-bc dos16-mc dos16-wc"
|
||||||
|
@echo " dos32: dos32-djgpp2 dos32-wc"
|
||||||
|
|
||||||
|
|
||||||
|
# Make sure that minilzo.h, lzoconf.h and lzodefs.h are in the
|
||||||
|
# current dircectory. Otherwise you may want to adjust CPPFLAGS.
|
||||||
|
##CPPFLAGS = -I../include/lzo -I.
|
||||||
|
|
||||||
|
GCC_CFLAGS = -s -Wall -O2 -fomit-frame-pointer
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# gcc
|
# gcc (generic)
|
||||||
#
|
#
|
||||||
|
|
||||||
gcc:
|
gcc:
|
||||||
gcc -Wall -O2 -s -o testmini $(SOURCES)
|
gcc $(CPPFLAGS) $(GCC_CFLAGS) -o $(PROGRAM) $(SOURCES)
|
||||||
|
|
||||||
gcc-i386:
|
cc:
|
||||||
gcc -Wall -O2 -fomit-frame-pointer -fno-strength-reduce -s -o testmini $(SOURCES)
|
cc $(CPPFLAGS) -o $(PROGRAM) $(SOURCES)
|
||||||
|
|
||||||
gcc-rs6000:
|
|
||||||
gcc -Wall -O2 -fno-schedule-insns -fno-schedule-insns2 -o testmini $(SOURCES)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Windows
|
|
||||||
#
|
|
||||||
visualc:
|
|
||||||
cl -nologo -ML -W3 -O2 -GF $(SOURCES)
|
|
||||||
|
|
||||||
watcomc:
|
|
||||||
wcl386 -zq -mf -5r -zc -wx -oneatx $(SOURCES)
|
|
||||||
|
|
||||||
watcomc16:
|
|
||||||
wcl -zq -ml -5 -zc -wx -oneatx $(SOURCES)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -44,15 +40,74 @@ watcomc16:
|
||||||
#
|
#
|
||||||
|
|
||||||
hpux:
|
hpux:
|
||||||
cc -Ae -o testmini $(SOURCES)
|
cc -Ae $(CPPFLAGS) -o $(PROGRAM) $(SOURCES)
|
||||||
|
|
||||||
hpux9:
|
hpux9:
|
||||||
cc -Aa -D_HPUX_SOURCE -o testmini $(SOURCES)
|
cc -Aa -D_HPUX_SOURCE $(CPPFLAGS) -o $(PROGRAM) $(SOURCES)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Windows (32-bit)
|
||||||
|
#
|
||||||
|
|
||||||
|
win32-borlandc win32-bc:
|
||||||
|
bcc32 -O2 -d -w -w-aus $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
win32-cygwin32 win32-cygwin:
|
||||||
|
gcc -mcygwin $(CPPFLAGS) $(GCC_CFLAGS) -o $(PROGRAM).exe $(SOURCES)
|
||||||
|
|
||||||
|
win32-digitalmars win32-dm:
|
||||||
|
dmc -mn -o -w- $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
win32-intelc win32-ic:
|
||||||
|
icl -nologo -MD -W3 -O2 -GF $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
win32-lccwin32:
|
||||||
|
@echo "NOTE: need lcc 2002-07-25 or newer, older versions have bugs"
|
||||||
|
lc -A -unused -O $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
win32-mingw32 win32-mingw:
|
||||||
|
gcc -mno-cygwin $(CPPFLAGS) $(GCC_CFLAGS) -o $(PROGRAM).exe $(SOURCES)
|
||||||
|
|
||||||
|
win32-visualc win32-vc:
|
||||||
|
cl -nologo -MD -W3 -O2 -GF $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
win32-watcomc win32-wc:
|
||||||
|
wcl386 -bt=nt -zq -mf -5r -zc -w5 -oneatx $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# DOS (16-bit)
|
||||||
|
#
|
||||||
|
|
||||||
|
dos16-borlandc dos16-bc:
|
||||||
|
bcc -ml -w -d -O -4 $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
dos16-microsoftc dos16-msc dos16-mc:
|
||||||
|
cl -nologo -f- -AL -O -G2 -W3 $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
dos16-watcomc dos16-wc:
|
||||||
|
wcl -zq -ml -bt=dos -l=dos -ox -w5 $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# DOS (32-bit)
|
||||||
|
#
|
||||||
|
|
||||||
|
dos32-djgpp2 dos32-dj2:
|
||||||
|
gcc $(CPPFLAGS) $(GCC_CFLAGS) -o $(PROGRAM).exe $(SOURCES)
|
||||||
|
|
||||||
|
dos32-watcomc dos32-wc:
|
||||||
|
wcl386 -zq -mf -bt=dos -l=dos4g -5r -ox -zc $(CPPFLAGS) $(SOURCES)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# other targets
|
# other targets
|
||||||
#
|
#
|
||||||
clean:
|
|
||||||
rm -f testmini testmini.exe *.err *.o *.obj core
|
clean:
|
||||||
|
rm -f $(PROGRAM) $(PROGRAM).exe $(PROGRAM).map $(PROGRAM).tds
|
||||||
|
rm -f *.err *.o *.obj
|
||||||
|
|
||||||
|
.PHONY: default clean
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
-----BEGIN PGP SIGNED MESSAGE-----
|
|
||||||
Hash: SHA1
|
|
||||||
|
|
||||||
|
|
||||||
============================================================================
|
============================================================================
|
||||||
miniLZO -- mini subset of the LZO real-time data compression library
|
miniLZO -- mini subset of the LZO real-time data compression library
|
||||||
|
@ -9,8 +6,8 @@ Hash: SHA1
|
||||||
Author : Markus Franz Xaver Johannes Oberhumer
|
Author : Markus Franz Xaver Johannes Oberhumer
|
||||||
<markus@oberhumer.com>
|
<markus@oberhumer.com>
|
||||||
http://www.oberhumer.com/opensource/lzo/
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
Version : 1.08
|
Version : 2.03
|
||||||
Date : 12-Jul-2002
|
Date : 30 Apr 2008
|
||||||
|
|
||||||
I've created miniLZO for projects where it is inconvenient to
|
I've created miniLZO for projects where it is inconvenient to
|
||||||
include (or require) the full LZO source code just because you
|
include (or require) the full LZO source code just because you
|
||||||
|
@ -21,17 +18,16 @@ Hash: SHA1
|
||||||
for situations where you want to use pre-compressed data files (which
|
for situations where you want to use pre-compressed data files (which
|
||||||
must have been compressed with LZO1X-999).
|
must have been compressed with LZO1X-999).
|
||||||
|
|
||||||
miniLZO consists of one C source file and two header files:
|
miniLZO consists of one C source file and three header files:
|
||||||
minilzo.c
|
minilzo.c
|
||||||
minilzo.h
|
minilzo.h, lzoconf.h, lzodefs.h
|
||||||
lzoconf.h
|
|
||||||
|
|
||||||
To use miniLZO just copy these files into your source directory, add
|
To use miniLZO just copy these files into your source directory, add
|
||||||
minilzo.c to your Makefile and #include minilzo.h from your program.
|
minilzo.c to your Makefile and #include minilzo.h from your program.
|
||||||
Note: you also must distribute this file (`README.LZO') with your project.
|
Note: you also must distribute this file (`README.LZO') with your project.
|
||||||
|
|
||||||
minilzo.o compiles to about 6 kB (using gcc or Visual C on a i386), and
|
minilzo.o compiles to about 6 kB (using gcc or Visual C on a i386), and
|
||||||
the sources are about 14 kB when packed with zip - so there's no more
|
the sources are about 30 kB when packed with zip - so there's no more
|
||||||
excuse that your application doesn't support data compression :-)
|
excuse that your application doesn't support data compression :-)
|
||||||
|
|
||||||
For more information, documentation, example programs and other support
|
For more information, documentation, example programs and other support
|
||||||
|
@ -96,12 +92,14 @@ Hash: SHA1
|
||||||
Checks for typedefs and structures
|
Checks for typedefs and structures
|
||||||
AC_CHECK_TYPE(ptrdiff_t,long)
|
AC_CHECK_TYPE(ptrdiff_t,long)
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
AC_CHECK_SIZEOF(unsigned short)
|
AC_CHECK_SIZEOF(short)
|
||||||
AC_CHECK_SIZEOF(unsigned)
|
AC_CHECK_SIZEOF(int)
|
||||||
AC_CHECK_SIZEOF(unsigned long)
|
AC_CHECK_SIZEOF(long)
|
||||||
AC_CHECK_SIZEOF(char *)
|
AC_CHECK_SIZEOF(long long)
|
||||||
AC_CHECK_SIZEOF(ptrdiff_t)
|
AC_CHECK_SIZEOF(__int64)
|
||||||
|
AC_CHECK_SIZEOF(void *)
|
||||||
AC_CHECK_SIZEOF(size_t)
|
AC_CHECK_SIZEOF(size_t)
|
||||||
|
AC_CHECK_SIZEOF(ptrdiff_t)
|
||||||
|
|
||||||
Checks for compiler characteristics
|
Checks for compiler characteristics
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
|
@ -112,8 +110,8 @@ Hash: SHA1
|
||||||
|
|
||||||
Appendix D: Copyright
|
Appendix D: Copyright
|
||||||
---------------------
|
---------------------
|
||||||
LZO and miniLZO are Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
LZO and miniLZO are Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
Markus Franz Xaver Johannes Oberhumer
|
2003, 2004, 2005, 2006, 2007, 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
LZO and miniLZO are distributed under the terms of the GNU General
|
LZO and miniLZO are distributed under the terms of the GNU General
|
||||||
Public License (GPL). See the file COPYING.
|
Public License (GPL). See the file COPYING.
|
||||||
|
@ -123,11 +121,3 @@ Hash: SHA1
|
||||||
are available by contacting the author.
|
are available by contacting the author.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
Version: GnuPG v1.0.7 (GNU/Linux)
|
|
||||||
|
|
||||||
iD8DBQE9LPb4TWFXqwsgQ8kRAi/wAKCZ9Iej+voGhmKATaViOPS9chxGUwCgh5Dk
|
|
||||||
uwMS2PQ7BXHT0vf4yz+3tTc=
|
|
||||||
=PsNp
|
|
||||||
-----END PGP SIGNATURE-----
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
/* $Id$ */
|
/* lzoconf.h -- configuration for the LZO real-time data compression library
|
||||||
|
|
||||||
/** @file lzoconf.h -- configuration for the LZO real-time data compression library
|
|
||||||
|
|
||||||
This file is part of the LZO real-time data compression library.
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
@ -26,34 +30,32 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with the LZO library; see the file COPYING.
|
along with the LZO library; see the file COPYING.
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer
|
Markus F.X.J. Oberhumer
|
||||||
<markus@oberhumer.com> http://www.oberhumer.com/opensource/lzo/
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef LZOCONF_H
|
#ifndef __LZOCONF_H_INCLUDED
|
||||||
#define LZOCONF_H
|
#define __LZOCONF_H_INCLUDED
|
||||||
|
|
||||||
#define LZO_VERSION 0x1080
|
#define LZO_VERSION 0x2030
|
||||||
#define LZO_VERSION_STRING "1.08"
|
#define LZO_VERSION_STRING "2.03"
|
||||||
#define LZO_VERSION_DATE "Jul 12 2002"
|
#define LZO_VERSION_DATE "Apr 30 2008"
|
||||||
|
|
||||||
/* internal Autoconf configuration file - only used when building LZO */
|
/* internal Autoconf configuration file - only used when building LZO */
|
||||||
#if defined(LZO_HAVE_CONFIG_H)
|
#if defined(LZO_HAVE_CONFIG_H)
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stddef.h>
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* LZO requires a conforming <limits.h>
|
// LZO requires a conforming <limits.h>
|
||||||
***********************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
||||||
# error "invalid CHAR_BIT"
|
# error "invalid CHAR_BIT"
|
||||||
|
@ -65,90 +67,78 @@ extern "C" {
|
||||||
# error "your limits.h macros are broken"
|
# error "your limits.h macros are broken"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* workaround a cpp bug under hpux 10.20 */
|
/* get OS and architecture defines */
|
||||||
#define LZO_0xffffffffL 4294967295ul
|
#ifndef __LZODEFS_H_INCLUDED
|
||||||
|
#include "lzodefs.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// some core defines
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
#if !defined(LZO_UINT32_C)
|
#if !defined(LZO_UINT32_C)
|
||||||
# if (UINT_MAX < LZO_0xffffffffL)
|
# if (UINT_MAX < LZO_0xffffffffL)
|
||||||
# define LZO_UINT32_C(c) c ## UL
|
# define LZO_UINT32_C(c) c ## UL
|
||||||
# else
|
# else
|
||||||
# define LZO_UINT32_C(c) c ## U
|
# define LZO_UINT32_C(c) ((c) + 0U)
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* architecture defines
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
#if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2)
|
|
||||||
# if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
|
|
||||||
# define __LZO_WIN
|
|
||||||
# elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
|
||||||
# define __LZO_WIN
|
|
||||||
# elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
|
|
||||||
# define __LZO_WIN
|
|
||||||
# elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
|
|
||||||
# define __LZO_DOS
|
|
||||||
# elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
|
|
||||||
# define __LZO_OS2
|
|
||||||
# elif defined(__palmos__)
|
|
||||||
# define __LZO_PALMOS
|
|
||||||
# elif defined(__TOS__) || defined(__atarist__)
|
|
||||||
# define __LZO_TOS
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (UINT_MAX < LZO_0xffffffffL)
|
|
||||||
# if defined(__LZO_WIN)
|
|
||||||
# define __LZO_WIN16
|
|
||||||
# elif defined(__LZO_DOS)
|
|
||||||
# define __LZO_DOS16
|
|
||||||
# elif defined(__LZO_PALMOS)
|
|
||||||
# define __LZO_PALMOS16
|
|
||||||
# elif defined(__LZO_TOS)
|
|
||||||
# define __LZO_TOS16
|
|
||||||
# elif defined(__C166__)
|
|
||||||
# else
|
|
||||||
/* porting hint: for pure 16-bit architectures try compiling
|
|
||||||
* everything with -D__LZO_STRICT_16BIT */
|
|
||||||
# error "16-bit target not supported - contact me for porting hints"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(__LZO_i386)
|
|
||||||
# if defined(__LZO_DOS) || defined(__LZO_WIN16)
|
|
||||||
# define __LZO_i386
|
|
||||||
# elif defined(__i386__) || defined(__386__) || defined(_M_IX86)
|
|
||||||
# define __LZO_i386
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__LZO_STRICT_16BIT)
|
|
||||||
# if (UINT_MAX < LZO_0xffffffffL)
|
|
||||||
# include <lzo16bit.h>
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* memory checkers */
|
/* memory checkers */
|
||||||
#if !defined(__LZO_CHECKER)
|
#if !defined(__LZO_CHECKER)
|
||||||
# if defined(__BOUNDS_CHECKING_ON)
|
# if defined(__BOUNDS_CHECKING_ON)
|
||||||
# define __LZO_CHECKER
|
# define __LZO_CHECKER 1
|
||||||
# elif defined(__CHECKER__)
|
# elif defined(__CHECKER__)
|
||||||
# define __LZO_CHECKER
|
# define __LZO_CHECKER 1
|
||||||
# elif defined(__INSURE__)
|
# elif defined(__INSURE__)
|
||||||
# define __LZO_CHECKER
|
# define __LZO_CHECKER 1
|
||||||
# elif defined(__PURIFY__)
|
# elif defined(__PURIFY__)
|
||||||
# define __LZO_CHECKER
|
# define __LZO_CHECKER 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* integral and pointer types
|
// integral and pointer types
|
||||||
***********************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/* Integral types with 32 bits or more */
|
/* lzo_uint should match size_t */
|
||||||
|
#if !defined(LZO_UINT_MAX)
|
||||||
|
# if defined(LZO_ABI_LLP64) /* WIN64 */
|
||||||
|
# if defined(LZO_OS_WIN64)
|
||||||
|
typedef unsigned __int64 lzo_uint;
|
||||||
|
typedef __int64 lzo_int;
|
||||||
|
# else
|
||||||
|
typedef unsigned long long lzo_uint;
|
||||||
|
typedef long long lzo_int;
|
||||||
|
# endif
|
||||||
|
# define LZO_UINT_MAX 0xffffffffffffffffull
|
||||||
|
# define LZO_INT_MAX 9223372036854775807LL
|
||||||
|
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||||
|
# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||||
|
typedef unsigned int lzo_uint;
|
||||||
|
typedef int lzo_int;
|
||||||
|
# define LZO_UINT_MAX UINT_MAX
|
||||||
|
# define LZO_INT_MAX INT_MAX
|
||||||
|
# define LZO_INT_MIN INT_MIN
|
||||||
|
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||||
|
typedef unsigned long lzo_uint;
|
||||||
|
typedef long lzo_int;
|
||||||
|
# define LZO_UINT_MAX ULONG_MAX
|
||||||
|
# define LZO_INT_MAX LONG_MAX
|
||||||
|
# define LZO_INT_MIN LONG_MIN
|
||||||
|
# else
|
||||||
|
# error "lzo_uint"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Integral types with 32 bits or more. */
|
||||||
#if !defined(LZO_UINT32_MAX)
|
#if !defined(LZO_UINT32_MAX)
|
||||||
# if (UINT_MAX >= LZO_0xffffffffL)
|
# if (UINT_MAX >= LZO_0xffffffffL)
|
||||||
typedef unsigned int lzo_uint32;
|
typedef unsigned int lzo_uint32;
|
||||||
|
@ -167,70 +157,26 @@ extern "C" {
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* lzo_uint is used like size_t */
|
/* The larger type of lzo_uint and lzo_uint32. */
|
||||||
#if !defined(LZO_UINT_MAX)
|
#if (LZO_UINT_MAX >= LZO_UINT32_MAX)
|
||||||
# if (UINT_MAX >= LZO_0xffffffffL)
|
# define lzo_xint lzo_uint
|
||||||
typedef unsigned int lzo_uint;
|
|
||||||
typedef int lzo_int;
|
|
||||||
# define LZO_UINT_MAX UINT_MAX
|
|
||||||
# define LZO_INT_MAX INT_MAX
|
|
||||||
# define LZO_INT_MIN INT_MIN
|
|
||||||
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
|
||||||
typedef unsigned long lzo_uint;
|
|
||||||
typedef long lzo_int;
|
|
||||||
# define LZO_UINT_MAX ULONG_MAX
|
|
||||||
# define LZO_INT_MAX LONG_MAX
|
|
||||||
# define LZO_INT_MIN LONG_MIN
|
|
||||||
#else
|
#else
|
||||||
# error "lzo_uint"
|
# define lzo_xint lzo_uint32
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int lzo_bool;
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* memory models
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
/* Memory model for the public code segment. */
|
|
||||||
#if !defined(__LZO_CMODEL)
|
|
||||||
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
|
||||||
# define __LZO_CMODEL __far
|
|
||||||
# elif defined(__LZO_i386) && defined(__WATCOMC__)
|
|
||||||
# define __LZO_CMODEL __near
|
|
||||||
# else
|
|
||||||
# define __LZO_CMODEL
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Memory model for the public data segment. */
|
|
||||||
#if !defined(__LZO_DMODEL)
|
|
||||||
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
|
||||||
# define __LZO_DMODEL __far
|
|
||||||
# elif defined(__LZO_i386) && defined(__WATCOMC__)
|
|
||||||
# define __LZO_DMODEL __near
|
|
||||||
# else
|
|
||||||
# define __LZO_DMODEL
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Memory model that allows to access memory at offsets of lzo_uint. */
|
/* Memory model that allows to access memory at offsets of lzo_uint. */
|
||||||
#if !defined(__LZO_MMODEL)
|
#if !defined(__LZO_MMODEL)
|
||||||
# if (LZO_UINT_MAX <= UINT_MAX)
|
# if (LZO_UINT_MAX <= UINT_MAX)
|
||||||
# define __LZO_MMODEL
|
# define __LZO_MMODEL
|
||||||
# elif defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
# elif defined(LZO_HAVE_MM_HUGE_PTR)
|
||||||
|
# define __LZO_MMODEL_HUGE 1
|
||||||
# define __LZO_MMODEL __huge
|
# define __LZO_MMODEL __huge
|
||||||
# define LZO_999_UNSUPPORTED
|
|
||||||
# elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16)
|
|
||||||
# define __LZO_MMODEL
|
|
||||||
# else
|
# else
|
||||||
# error "__LZO_MMODEL"
|
# define __LZO_MMODEL
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* no typedef here because of const-pointer issues */
|
/* no typedef here because of const-pointer issues */
|
||||||
#define lzo_byte unsigned char __LZO_MMODEL
|
|
||||||
#define lzo_bytep unsigned char __LZO_MMODEL *
|
#define lzo_bytep unsigned char __LZO_MMODEL *
|
||||||
#define lzo_charp char __LZO_MMODEL *
|
#define lzo_charp char __LZO_MMODEL *
|
||||||
#define lzo_voidp void __LZO_MMODEL *
|
#define lzo_voidp void __LZO_MMODEL *
|
||||||
|
@ -240,19 +186,20 @@ typedef int lzo_bool;
|
||||||
#define lzo_int32p lzo_int32 __LZO_MMODEL *
|
#define lzo_int32p lzo_int32 __LZO_MMODEL *
|
||||||
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
||||||
#define lzo_intp lzo_int __LZO_MMODEL *
|
#define lzo_intp lzo_int __LZO_MMODEL *
|
||||||
|
#define lzo_xintp lzo_xint __LZO_MMODEL *
|
||||||
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
||||||
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
||||||
|
/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
|
||||||
|
#define lzo_byte unsigned char __LZO_MMODEL
|
||||||
|
|
||||||
#ifndef lzo_sizeof_dict_t
|
typedef int lzo_bool;
|
||||||
# define lzo_sizeof_dict_t sizeof(lzo_bytep)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* calling conventions and function types
|
// function types
|
||||||
***********************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/* linkage */
|
/* name mangling */
|
||||||
#if !defined(__LZO_EXTERN_C)
|
#if !defined(__LZO_EXTERN_C)
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
# define __LZO_EXTERN_C extern "C"
|
# define __LZO_EXTERN_C extern "C"
|
||||||
|
@ -263,76 +210,8 @@ typedef int lzo_bool;
|
||||||
|
|
||||||
/* calling convention */
|
/* calling convention */
|
||||||
#if !defined(__LZO_CDECL)
|
#if !defined(__LZO_CDECL)
|
||||||
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
# define __LZO_CDECL __lzo_cdecl
|
||||||
# define __LZO_CDECL __LZO_CMODEL __cdecl
|
|
||||||
# elif defined(__LZO_i386) && defined(_MSC_VER)
|
|
||||||
# define __LZO_CDECL __LZO_CMODEL __cdecl
|
|
||||||
# elif defined(__LZO_i386) && defined(__WATCOMC__)
|
|
||||||
# define __LZO_CDECL __LZO_CMODEL __cdecl
|
|
||||||
# else
|
|
||||||
# define __LZO_CDECL __LZO_CMODEL
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if !defined(__LZO_ENTRY)
|
|
||||||
# define __LZO_ENTRY __LZO_CDECL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* C++ exception specification for extern "C" function types */
|
|
||||||
#if !defined(__cplusplus)
|
|
||||||
# undef LZO_NOTHROW
|
|
||||||
# define LZO_NOTHROW
|
|
||||||
#elif !defined(LZO_NOTHROW)
|
|
||||||
# define LZO_NOTHROW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef int
|
|
||||||
(__LZO_ENTRY *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len,
|
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
|
||||||
lzo_voidp wrkmem );
|
|
||||||
|
|
||||||
typedef int
|
|
||||||
(__LZO_ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint src_len,
|
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
|
||||||
lzo_voidp wrkmem );
|
|
||||||
|
|
||||||
typedef int
|
|
||||||
(__LZO_ENTRY *lzo_optimize_t) ( lzo_byte *src, lzo_uint src_len,
|
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
|
||||||
lzo_voidp wrkmem );
|
|
||||||
|
|
||||||
typedef int
|
|
||||||
(__LZO_ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint src_len,
|
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
|
||||||
lzo_voidp wrkmem,
|
|
||||||
const lzo_byte *dict, lzo_uint dict_len );
|
|
||||||
|
|
||||||
typedef int
|
|
||||||
(__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint src_len,
|
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
|
||||||
lzo_voidp wrkmem,
|
|
||||||
const lzo_byte *dict, lzo_uint dict_len );
|
|
||||||
|
|
||||||
|
|
||||||
/* assembler versions always use __cdecl */
|
|
||||||
typedef int
|
|
||||||
(__LZO_CDECL *lzo_compress_asm_t)( const lzo_byte *src, lzo_uint src_len,
|
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
|
||||||
lzo_voidp wrkmem );
|
|
||||||
|
|
||||||
typedef int
|
|
||||||
(__LZO_CDECL *lzo_decompress_asm_t)( const lzo_byte *src, lzo_uint src_len,
|
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
|
||||||
lzo_voidp wrkmem );
|
|
||||||
|
|
||||||
|
|
||||||
/* a progress indicator callback function */
|
|
||||||
typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* export information
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
/* DLL export information */
|
/* DLL export information */
|
||||||
#if !defined(__LZO_EXPORT1)
|
#if !defined(__LZO_EXPORT1)
|
||||||
|
@ -342,41 +221,84 @@ typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
|
||||||
# define __LZO_EXPORT2
|
# define __LZO_EXPORT2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* exported calling convention for C functions */
|
/* __cdecl calling convention for public C and assembly functions */
|
||||||
#if !defined(LZO_PUBLIC)
|
#if !defined(LZO_PUBLIC)
|
||||||
# define LZO_PUBLIC(_rettype) \
|
# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
||||||
__LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ENTRY
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LZO_EXTERN)
|
#if !defined(LZO_EXTERN)
|
||||||
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LZO_PRIVATE)
|
#if !defined(LZO_PRIVATE)
|
||||||
# define LZO_PRIVATE(_rettype) static _rettype __LZO_ENTRY
|
# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* exported __cdecl calling convention for assembler functions */
|
/* function types */
|
||||||
#if !defined(LZO_PUBLIC_CDECL)
|
typedef int
|
||||||
# define LZO_PUBLIC_CDECL(_rettype) \
|
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||||
__LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
#endif
|
lzo_voidp wrkmem );
|
||||||
#if !defined(LZO_EXTERN_CDECL)
|
|
||||||
# define LZO_EXTERN_CDECL(_rettype) __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* exported global variables (LZO currently uses no static variables and
|
typedef int
|
||||||
* is fully thread safe) */
|
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||||
#if !defined(LZO_PUBLIC_VAR)
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
# define LZO_PUBLIC_VAR(_type) \
|
lzo_voidp wrkmem );
|
||||||
__LZO_EXPORT1 _type __LZO_EXPORT2 __LZO_DMODEL
|
|
||||||
#endif
|
typedef int
|
||||||
#if !defined(LZO_EXTERN_VAR)
|
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
||||||
# define LZO_EXTERN_VAR(_type) extern LZO_PUBLIC_VAR(_type)
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
#endif
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem,
|
||||||
|
const lzo_bytep dict, lzo_uint dict_len );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem,
|
||||||
|
const lzo_bytep dict, lzo_uint dict_len );
|
||||||
|
|
||||||
|
|
||||||
|
/* Callback interface. Currently only the progress indicator ("nprogress")
|
||||||
|
* is used, but this may change in a future release. */
|
||||||
|
|
||||||
|
struct lzo_callback_t;
|
||||||
|
typedef struct lzo_callback_t lzo_callback_t;
|
||||||
|
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
||||||
|
|
||||||
|
/* malloc & free function types */
|
||||||
|
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
||||||
|
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
||||||
|
typedef void (__LZO_CDECL *lzo_free_func_t)
|
||||||
|
(lzo_callback_p self, lzo_voidp ptr);
|
||||||
|
|
||||||
|
/* a progress indicator callback function */
|
||||||
|
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
||||||
|
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
||||||
|
|
||||||
|
struct lzo_callback_t
|
||||||
|
{
|
||||||
|
/* custom allocators (set to 0 to disable) */
|
||||||
|
lzo_alloc_func_t nalloc; /* [not used right now] */
|
||||||
|
lzo_free_func_t nfree; /* [not used right now] */
|
||||||
|
|
||||||
|
/* a progress indicator callback function (set to 0 to disable) */
|
||||||
|
lzo_progress_func_t nprogress;
|
||||||
|
|
||||||
|
/* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
|
||||||
|
* callbacks points back to this struct, so you are free to store
|
||||||
|
* some extra info in the following variables. */
|
||||||
|
lzo_voidp user1;
|
||||||
|
lzo_xint user2;
|
||||||
|
lzo_xint user3;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* error codes and prototypes
|
// error codes and prototypes
|
||||||
***********************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/* Error codes for the compression/decompression functions. Negative
|
/* Error codes for the compression/decompression functions. Negative
|
||||||
* values are errors, positive values will be used for special but
|
* values are errors, positive values will be used for special but
|
||||||
|
@ -384,33 +306,38 @@ typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
|
||||||
*/
|
*/
|
||||||
#define LZO_E_OK 0
|
#define LZO_E_OK 0
|
||||||
#define LZO_E_ERROR (-1)
|
#define LZO_E_ERROR (-1)
|
||||||
#define LZO_E_OUT_OF_MEMORY (-2) /* not used right now */
|
#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
|
||||||
#define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now */
|
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
||||||
#define LZO_E_INPUT_OVERRUN (-4)
|
#define LZO_E_INPUT_OVERRUN (-4)
|
||||||
#define LZO_E_OUTPUT_OVERRUN (-5)
|
#define LZO_E_OUTPUT_OVERRUN (-5)
|
||||||
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
||||||
#define LZO_E_EOF_NOT_FOUND (-7)
|
#define LZO_E_EOF_NOT_FOUND (-7)
|
||||||
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
||||||
|
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef lzo_sizeof_dict_t
|
||||||
|
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* lzo_init() should be the first function you call.
|
/* lzo_init() should be the first function you call.
|
||||||
* Check the return code !
|
* Check the return code !
|
||||||
*
|
*
|
||||||
* lzo_init() is a macro to allow checking that the library and the
|
* lzo_init() is a macro to allow checking that the library and the
|
||||||
* compiler's view of various types are consistent.
|
* compiler's view of various types are consistent.
|
||||||
*/
|
*/
|
||||||
#define lzo_init() __lzo_init2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
||||||
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
|
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
|
||||||
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
||||||
(int)sizeof(lzo_compress_t))
|
(int)sizeof(lzo_callback_t))
|
||||||
LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int);
|
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
||||||
|
|
||||||
/* version functions (useful for shared libraries) */
|
/* version functions (useful for shared libraries) */
|
||||||
LZO_EXTERN(unsigned) lzo_version();
|
LZO_EXTERN(unsigned) lzo_version(void);
|
||||||
LZO_EXTERN(const char *) lzo_version_string();
|
LZO_EXTERN(const char *) lzo_version_string(void);
|
||||||
LZO_EXTERN(const char *) lzo_version_date();
|
LZO_EXTERN(const char *) lzo_version_date(void);
|
||||||
LZO_EXTERN(const lzo_charp) _lzo_version_string();
|
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
||||||
LZO_EXTERN(const lzo_charp) _lzo_version_date();
|
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
||||||
|
|
||||||
/* string functions */
|
/* string functions */
|
||||||
LZO_EXTERN(int)
|
LZO_EXTERN(int)
|
||||||
|
@ -424,13 +351,14 @@ lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
|
||||||
|
|
||||||
/* checksum functions */
|
/* checksum functions */
|
||||||
LZO_EXTERN(lzo_uint32)
|
LZO_EXTERN(lzo_uint32)
|
||||||
lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len);
|
lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len);
|
||||||
LZO_EXTERN(lzo_uint32)
|
LZO_EXTERN(lzo_uint32)
|
||||||
lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len);
|
lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len);
|
||||||
|
LZO_EXTERN(const lzo_uint32p)
|
||||||
|
lzo_get_crc32_table(void);
|
||||||
|
|
||||||
/* misc. */
|
/* misc. */
|
||||||
LZO_EXTERN(lzo_bool) lzo_assert(int _expr);
|
LZO_EXTERN(int) _lzo_config_check(void);
|
||||||
LZO_EXTERN(int) _lzo_config_check();
|
|
||||||
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
|
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
|
||||||
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
|
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
|
||||||
typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
|
typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
|
||||||
|
@ -440,12 +368,50 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
|
||||||
#define LZO_PTR_ALIGN_UP(_ptr,_size) \
|
#define LZO_PTR_ALIGN_UP(_ptr,_size) \
|
||||||
((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
|
((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
|
||||||
|
|
||||||
/* deprecated - only for backward compatibility */
|
|
||||||
#define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size)
|
/***********************************************************************
|
||||||
|
// deprecated macros - only for backward compatibility with LZO v1.xx
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
#if defined(LZO_CFG_COMPAT)
|
||||||
|
|
||||||
|
#define __LZOCONF_H 1
|
||||||
|
|
||||||
|
#if defined(LZO_ARCH_I086)
|
||||||
|
# define __LZO_i386 1
|
||||||
|
#elif defined(LZO_ARCH_I386)
|
||||||
|
# define __LZO_i386 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LZO_OS_DOS16)
|
||||||
|
# define __LZO_DOS 1
|
||||||
|
# define __LZO_DOS16 1
|
||||||
|
#elif defined(LZO_OS_DOS32)
|
||||||
|
# define __LZO_DOS 1
|
||||||
|
#elif defined(LZO_OS_WIN16)
|
||||||
|
# define __LZO_WIN 1
|
||||||
|
# define __LZO_WIN16 1
|
||||||
|
#elif defined(LZO_OS_WIN32)
|
||||||
|
# define __LZO_WIN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __LZO_CMODEL
|
||||||
|
#define __LZO_DMODEL
|
||||||
|
#define __LZO_ENTRY __LZO_CDECL
|
||||||
|
#define LZO_EXTERN_CDECL LZO_EXTERN
|
||||||
|
#define LZO_ALIGN LZO_PTR_ALIGN_UP
|
||||||
|
|
||||||
|
#define lzo_compress_asm_t lzo_compress_t
|
||||||
|
#define lzo_decompress_asm_t lzo_decompress_t
|
||||||
|
|
||||||
|
#endif /* LZO_CFG_COMPAT */
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* LZOCONF_H */
|
#endif /* already included */
|
||||||
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 et: */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,47 +1,53 @@
|
||||||
/* $Id$ */
|
/* minilzo.h -- mini subset of the LZO real-time data compression library
|
||||||
|
|
||||||
/**
|
This file is part of the LZO real-time data compression library.
|
||||||
* @file minilzo.h Mini subset of the LZO real-time data compression library
|
|
||||||
*
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
* This file is part of the LZO real-time data compression library.
|
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||||
*
|
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||||
* Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||||
* Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||||
* Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
* Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||||
* Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
* Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||||
* Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||||
* All Rights Reserved.
|
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||||
*
|
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||||
* The LZO library is free software; you can redistribute it and/or
|
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||||
* modify it under the terms of the GNU General Public License as
|
All Rights Reserved.
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License, or (at your option) any later version.
|
The LZO library is free software; you can redistribute it and/or
|
||||||
*
|
modify it under the terms of the GNU General Public License as
|
||||||
* The LZO library is distributed in the hope that it will be useful,
|
published by the Free Software Foundation; either version 2 of
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
the License, or (at your option) any later version.
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
The LZO library is distributed in the hope that it will be useful,
|
||||||
*
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* You should have received a copy of the GNU General Public License
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* along with the LZO library; see the file COPYING.
|
GNU General Public License for more details.
|
||||||
* If not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
You should have received a copy of the GNU General Public License
|
||||||
*
|
along with the LZO library; see the file COPYING.
|
||||||
* Markus F.X.J. Oberhumer
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
* <markus@oberhumer.com>
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* http://www.oberhumer.com/opensource/lzo/
|
|
||||||
*
|
Markus F.X.J. Oberhumer
|
||||||
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
* NOTE:
|
* NOTE:
|
||||||
* the full LZO package can be found at
|
* the full LZO package can be found at
|
||||||
* http://www.oberhumer.com/opensource/lzo/
|
* http://www.oberhumer.com/opensource/lzo/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MINILZO_H
|
|
||||||
#define MINILZO_H
|
|
||||||
|
|
||||||
#define MINILZO_VERSION 0x1080
|
#ifndef __MINILZO_H
|
||||||
|
#define __MINILZO_H
|
||||||
|
|
||||||
|
#define MINILZO_VERSION 0x2030
|
||||||
|
|
||||||
#ifdef __LZOCONF_H
|
#ifdef __LZOCONF_H
|
||||||
# error "you cannot use both LZO and miniLZO"
|
# error "you cannot use both LZO and miniLZO"
|
||||||
|
@ -60,6 +66,10 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
//
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
/* Memory required for the wrkmem parameter.
|
/* Memory required for the wrkmem parameter.
|
||||||
* When the required size is 0, you can also pass a NULL pointer.
|
* When the required size is 0, you can also pass a NULL pointer.
|
||||||
*/
|
*/
|
||||||
|
@ -71,20 +81,20 @@ extern "C" {
|
||||||
|
|
||||||
/* compression */
|
/* compression */
|
||||||
LZO_EXTERN(int)
|
LZO_EXTERN(int)
|
||||||
lzo1x_1_compress ( const lzo_byte *src, lzo_uint src_len,
|
lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
lzo_voidp wrkmem );
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
/* decompression */
|
/* decompression */
|
||||||
LZO_EXTERN(int)
|
LZO_EXTERN(int)
|
||||||
lzo1x_decompress ( const lzo_byte *src, lzo_uint src_len,
|
lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
lzo_voidp wrkmem /* NOT USED */ );
|
lzo_voidp wrkmem /* NOT USED */ );
|
||||||
|
|
||||||
/* safe decompression with overrun testing */
|
/* safe decompression with overrun testing */
|
||||||
LZO_EXTERN(int)
|
LZO_EXTERN(int)
|
||||||
lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
|
lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||||
lzo_byte *dst, lzo_uintp dst_len,
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
lzo_voidp wrkmem /* NOT USED */ );
|
lzo_voidp wrkmem /* NOT USED */ );
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,4 +102,5 @@ lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* MINILZO_H */
|
#endif /* already included */
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,20 @@
|
||||||
|
|
||||||
This file is part of the LZO real-time data compression library.
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
The LZO library is free software; you can redistribute it and/or
|
The LZO library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License as
|
modify it under the terms of the GNU General Public License as
|
||||||
|
@ -17,16 +30,16 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with the LZO library; see the file COPYING.
|
along with the LZO library; see the file COPYING.
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer
|
Markus F.X.J. Oberhumer
|
||||||
<markus@oberhumer.com>
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -51,14 +64,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__LZO_STRICT_16BIT)
|
#if defined(__LZO_STRICT_16BIT)
|
||||||
#define IN_LEN (8*1024)
|
#define IN_LEN (8*1024u)
|
||||||
|
#elif defined(LZO_ARCH_I086) && !defined(LZO_HAVE_MM_HUGE_ARRAY)
|
||||||
|
#define IN_LEN (60*1024u)
|
||||||
#else
|
#else
|
||||||
#define IN_LEN (128*1024L)
|
#define IN_LEN (128*1024ul)
|
||||||
#endif
|
#endif
|
||||||
#define OUT_LEN (IN_LEN + IN_LEN / 64 + 16 + 3)
|
#define OUT_LEN (IN_LEN + IN_LEN / 16 + 64 + 3)
|
||||||
|
|
||||||
static lzo_byte in [ IN_LEN ];
|
static unsigned char __LZO_MMODEL in [ IN_LEN ];
|
||||||
static lzo_byte out [ OUT_LEN ];
|
static unsigned char __LZO_MMODEL out [ OUT_LEN ];
|
||||||
|
|
||||||
|
|
||||||
/* Work-memory needed for compression. Allocate memory in units
|
/* Work-memory needed for compression. Allocate memory in units
|
||||||
|
@ -82,31 +97,23 @@ int main(int argc, char *argv[])
|
||||||
lzo_uint out_len;
|
lzo_uint out_len;
|
||||||
lzo_uint new_len;
|
lzo_uint new_len;
|
||||||
|
|
||||||
#if defined(__EMX__)
|
|
||||||
_response(&argc,&argv);
|
|
||||||
_wildcard(&argc,&argv);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (argc < 0 && argv == NULL) /* avoid warning about unused args */
|
if (argc < 0 && argv == NULL) /* avoid warning about unused args */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if 0
|
|
||||||
printf("\nLZO real-time data compression library (v%s, %s).\n",
|
printf("\nLZO real-time data compression library (v%s, %s).\n",
|
||||||
lzo_version_string(), lzo_version_date());
|
lzo_version_string(), lzo_version_date());
|
||||||
printf("Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer\n\n");
|
printf("Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 1: initialize the LZO library
|
* Step 1: initialize the LZO library
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
if (lzo_init() != LZO_E_OK)
|
if (lzo_init() != LZO_E_OK)
|
||||||
{
|
{
|
||||||
printf("lzo_init() failed !!!\n");
|
printf("internal error - lzo_init() failed !!!\n");
|
||||||
|
printf("(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable `-DLZO_DEBUG' for diagnostics)\n");
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 2: prepare the input block that will get compressed.
|
* Step 2: prepare the input block that will get compressed.
|
||||||
|
@ -114,7 +121,7 @@ int main(int argc, char *argv[])
|
||||||
* but you would use your real-world data here.
|
* but you would use your real-world data here.
|
||||||
*/
|
*/
|
||||||
in_len = IN_LEN;
|
in_len = IN_LEN;
|
||||||
memset(in,0,in_len);
|
lzo_memset(in,0,in_len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 3: compress from `in' to `out' with LZO1X-1
|
* Step 3: compress from `in' to `out' with LZO1X-1
|
||||||
|
@ -122,7 +129,7 @@ int main(int argc, char *argv[])
|
||||||
r = lzo1x_1_compress(in,in_len,out,&out_len,wrkmem);
|
r = lzo1x_1_compress(in,in_len,out,&out_len,wrkmem);
|
||||||
if (r == LZO_E_OK)
|
if (r == LZO_E_OK)
|
||||||
printf("compressed %lu bytes into %lu bytes\n",
|
printf("compressed %lu bytes into %lu bytes\n",
|
||||||
(long) in_len, (long) out_len);
|
(unsigned long) in_len, (unsigned long) out_len);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* this should NEVER happen */
|
/* this should NEVER happen */
|
||||||
|
@ -139,10 +146,11 @@ int main(int argc, char *argv[])
|
||||||
/*
|
/*
|
||||||
* Step 4: decompress again, now going from `out' to `in'
|
* Step 4: decompress again, now going from `out' to `in'
|
||||||
*/
|
*/
|
||||||
|
new_len = in_len;
|
||||||
r = lzo1x_decompress(out,out_len,in,&new_len,NULL);
|
r = lzo1x_decompress(out,out_len,in,&new_len,NULL);
|
||||||
if (r == LZO_E_OK && new_len == in_len)
|
if (r == LZO_E_OK && new_len == in_len)
|
||||||
printf("decompressed %lu bytes back into %lu bytes\n",
|
printf("decompressed %lu bytes back into %lu bytes\n",
|
||||||
(long) out_len, (long) in_len);
|
(unsigned long) out_len, (unsigned long) in_len);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* this should NEVER happen */
|
/* this should NEVER happen */
|
||||||
|
@ -155,6 +163,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
vi:ts=4
|
vi:ts=4:et
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ struct AboutWindow : public Window {
|
||||||
" Richard Kempton (richK) - additional airports, initial TGP implementation",
|
" Richard Kempton (richK) - additional airports, initial TGP implementation",
|
||||||
"",
|
"",
|
||||||
" Alberto Demichelis - Squirrel scripting language © 2003-2008",
|
" Alberto Demichelis - Squirrel scripting language © 2003-2008",
|
||||||
" Markus F.X.J. Oberhumer - (Mini)LZO for loading old savegames © 1996-2002",
|
" Markus F.X.J. Oberhumer - (Mini)LZO for loading old savegames © 1996-2008",
|
||||||
" Michael Blunck - Pre-Signals and Semaphores © 2003",
|
" Michael Blunck - Pre-Signals and Semaphores © 2003",
|
||||||
" George - Canal/Lock graphics © 2003-2004",
|
" George - Canal/Lock graphics © 2003-2004",
|
||||||
" David Dallaston - Tram tracks",
|
" David Dallaston - Tram tracks",
|
||||||
|
|
|
@ -1185,7 +1185,7 @@ static size_t ReadLZO()
|
||||||
byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
|
byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
|
||||||
uint32 tmp[2];
|
uint32 tmp[2];
|
||||||
uint32 size;
|
uint32 size;
|
||||||
uint len;
|
lzo_uint len;
|
||||||
|
|
||||||
/* Read header*/
|
/* Read header*/
|
||||||
if (fread(tmp, sizeof(tmp), 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE, "File read failed");
|
if (fread(tmp, sizeof(tmp), 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE, "File read failed");
|
||||||
|
@ -1217,10 +1217,10 @@ static void WriteLZO(size_t size)
|
||||||
{
|
{
|
||||||
byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
|
byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
|
||||||
byte wrkmem[sizeof(byte*) * 4096];
|
byte wrkmem[sizeof(byte*) * 4096];
|
||||||
uint outlen;
|
lzo_uint outlen;
|
||||||
|
|
||||||
lzo1x_1_compress(_sl.buf, (lzo_uint)size, out + sizeof(uint32) * 2, &outlen, wrkmem);
|
lzo1x_1_compress(_sl.buf, (lzo_uint)size, out + sizeof(uint32) * 2, &outlen, wrkmem);
|
||||||
((uint32*)out)[1] = TO_BE32(outlen);
|
((uint32*)out)[1] = TO_BE32((uint32)outlen);
|
||||||
((uint32*)out)[0] = TO_BE32(lzo_adler32(0, out + sizeof(uint32), outlen + sizeof(uint32)));
|
((uint32*)out)[0] = TO_BE32(lzo_adler32(0, out + sizeof(uint32), outlen + sizeof(uint32)));
|
||||||
if (fwrite(out, outlen + sizeof(uint32) * 2, 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
|
if (fwrite(out, outlen + sizeof(uint32) * 2, 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue