From: darcagn <da...@us...> - 2023-06-18 17:23:55
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A serial program loader for the Dreamcast.". The branch, master has been updated via 4d28558a2c09c7abb2678c12e9957aa4dad53ca3 (commit) from 91830faef38d8f3f52bfbbd23f867e446763f6b3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4d28558a2c09c7abb2678c12e9957aa4dad53ca3 Author: Tim Riemann <tri...@oc...> Date: Sun Jun 18 16:02:58 2023 +0200 Use MiniLZO v2.10 (#12) * add minilzo v2.10 * remove old minilzo version * use minilzo v2.10 ----------------------------------------------------------------------- Summary of changes: host-src/misc/Makefile | 2 +- host-src/misc/lzo.c | 119 +- host-src/tool/Makefile | 2 +- host-src/tool/dc-tool.c | 4 +- {minilzo.106 => minilzo-2.10}/COPYING | 29 +- minilzo-2.10/Makefile | 100 + minilzo-2.10/lzoconf.h | 453 +++ minilzo-2.10/lzodefs.h | 3268 ++++++++++++++++ minilzo-2.10/minilzo.c | 6365 +++++++++++++++++++++++++++++++ {minilzo.106 => minilzo-2.10}/minilzo.h | 48 +- minilzo-2.10/testmini.c | 148 + minilzo.106/Makefile | 58 - minilzo.106/README.LZO | 136 - minilzo.106/lzoconf.h | 369 -- minilzo.106/minilzo.c | 2846 -------------- minilzo.106/testmini.c | 154 - target-src/dcload/Makefile | 2 +- target-src/dcload/dcload.c | 4 +- 18 files changed, 10445 insertions(+), 3662 deletions(-) rename {minilzo.106 => minilzo-2.10}/COPYING (97%) create mode 100644 minilzo-2.10/Makefile create mode 100644 minilzo-2.10/lzoconf.h create mode 100644 minilzo-2.10/lzodefs.h create mode 100644 minilzo-2.10/minilzo.c rename {minilzo.106 => minilzo-2.10}/minilzo.h (63%) create mode 100644 minilzo-2.10/testmini.c delete mode 100644 minilzo.106/Makefile delete mode 100644 minilzo.106/README.LZO delete mode 100644 minilzo.106/lzoconf.h delete mode 100644 minilzo.106/minilzo.c delete mode 100644 minilzo.106/testmini.c diff --git a/host-src/misc/Makefile b/host-src/misc/Makefile index a0e34a3..4f33df5 100644 --- a/host-src/misc/Makefile +++ b/host-src/misc/Makefile @@ -1,6 +1,6 @@ include ../../Makefile.cfg -LZOPATH = ../../minilzo.106 +LZOPATH = ../../minilzo-2.10 CC = $(HOSTCC) CFLAGS = $(HOSTCFLAGS) diff --git a/host-src/misc/lzo.c b/host-src/misc/lzo.c index 5a61ae4..db4b041 100644 --- a/host-src/misc/lzo.c +++ b/host-src/misc/lzo.c @@ -37,63 +37,66 @@ void usage(void) { exit(1); } -int main(int argc, char *argv[]) { - int in, out; - unsigned char *data; - unsigned char *cdata; - int r; - unsigned int length, clength; - - if(argc != 3) - usage(); - - in = open(argv[1], O_RDONLY); - - if(in < 0) { - perror(argv[1]); - exit(1); - } - - out = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644); - - if(out < 0) { - perror(argv[2]); - exit(1); - } - - length = lseek(in, 0, SEEK_END); - lseek(in, 0, SEEK_SET); - - data = malloc(length); - cdata = malloc(length+length/64 + 16 + 3); - - read(in, data, length); - - if(lzo_init() != LZO_E_OK) { - printf("lzo_init() failed !!!\n"); - exit(1); - } - - r = lzo1x_1_compress(data,length,cdata,&clength,wrkmem); - if(r == LZO_E_OK) - printf("compressed %lu bytes into %lu bytes\n", - (long) length, (long) clength); - else { - /* this should NEVER happen */ - printf("internal error - compression failed: %d\n", r); - return 2; - } - - /* check for an incompressible block */ - if(clength >= length) { - printf("This block contains incompressible data.\n"); - return 0; - } - - write(out, cdata, clength); - - close(in); - close(out); - exit(0); +int main(int argc, char *argv[]) +{ + int in, out; + unsigned char * data; + unsigned char * cdata; + int r; + lzo_uint length,clength; + + if (argc != 3) + usage(); + + in = open(argv[1], O_RDONLY); + + if (in < 0) { + perror(argv[1]); + exit(1); + } + + out = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644); + + if (out < 0) { + perror(argv[2]); + exit(1); + } + + length = lseek(in, 0, SEEK_END); + lseek(in, 0, SEEK_SET); + + data = malloc(length); + cdata = malloc(length+length/64 + 16 + 3); + + read(in, data, length); + + if (lzo_init() != LZO_E_OK) + { + printf("lzo_init() failed !!!\n"); + exit(1); + } + + r = lzo1x_1_compress(data,length,cdata,&clength,wrkmem); + if (r == LZO_E_OK) + printf("compressed %lu bytes into %lu bytes\n", + (long) length, (long) clength); + else + { + /* this should NEVER happen */ + printf("internal error - compression failed: %d\n", r); + return 2; + } + /* check for an incompressible block */ + if (clength >= length) + { + printf("This block contains incompressible data.\n"); + return 0; + } + + write(out, cdata, clength); + + close(in); + close(out); + exit(0); } diff --git a/host-src/tool/Makefile b/host-src/tool/Makefile index d7b35fe..75eb877 100644 --- a/host-src/tool/Makefile +++ b/host-src/tool/Makefile @@ -1,6 +1,6 @@ include ../../Makefile.cfg -LZOPATH = ../../minilzo.106 +LZOPATH = ../../minilzo-2.10 CC = $(HOSTCC) CFLAGS = $(HOSTCFLAGS) -DDCLOAD_VERSION=\"$(VERSION)\" -DDEFAULT_SPEED=$(TOOL_DEFAULT_SPEED) -DSERIALDEVICE="\"$(SERIALDEVICE)\"" -DHAVE_GETOPT -DB1500000 -DB500000 diff --git a/host-src/tool/dc-tool.c b/host-src/tool/dc-tool.c index 04ec33e..ff3e047 100644 --- a/host-src/tool/dc-tool.c +++ b/host-src/tool/dc-tool.c @@ -362,7 +362,7 @@ unsigned int recv_uint(void) { /* receive total bytes from dc and store in data */ void recv_data(void *data, unsigned int total, unsigned int verbose) { unsigned char type, sum, ok; - unsigned int size, newsize; + lzo_uint size, newsize; unsigned char *tmp; if(verbose) { @@ -425,7 +425,7 @@ void send_data(unsigned char * addr, unsigned int size, unsigned int verbose) { unsigned char *location = (unsigned char *) addr; unsigned char sum = 0; unsigned char data; - unsigned int csize; + lzo_uint csize; unsigned int sendsize; unsigned char c; unsigned char * buffer; diff --git a/minilzo.106/COPYING b/minilzo-2.10/COPYING similarity index 97% rename from minilzo.106/COPYING rename to minilzo-2.10/COPYING index b4951ab..d159169 100644 --- a/minilzo.106/COPYING +++ b/minilzo-2.10/COPYING @@ -1,8 +1,8 @@ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest @@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> + Copyright (C) <year> <name of author> 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 @@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; 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 this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/minilzo-2.10/Makefile b/minilzo-2.10/Makefile new file mode 100644 index 0000000..ae4d6d4 --- /dev/null +++ b/minilzo-2.10/Makefile @@ -0,0 +1,100 @@ +# +# a very simple Makefile for miniLZO +# +# Copyright (C) 1996-2017 Markus F.X.J. Oberhumer +# + +PROGRAM = testmini +SOURCES = testmini.c minilzo.c + +default: + @echo "" + @echo "Welcome to miniLZO. Please choose one of the following 'make' targets:" + @echo "" + @echo " gcc: gcc" + @echo " unix: hpux hpux9" + @echo " win32: win32-bc win32-cygwin win32-dm win32-lccwin32" + @echo " win32-intelc win32-mingw win32-vc win32-watcomc" + @echo " dos32: dos32-djgpp2 dos32-wc" + @echo "" + + +# Make sure that minilzo.h, lzoconf.h and lzodefs.h are in the +# current dircectory. Otherwise you may want to adjust CPPFLAGS. +CPPFLAGS = -I. -I../include/lzo + +GCC_CFLAGS = -s -Wall -O2 -fomit-frame-pointer + + +# +# gcc (generic) +# + +gcc: + gcc $(CPPFLAGS) $(GCC_CFLAGS) -o $(PROGRAM) $(SOURCES) + +cc: + cc $(CPPFLAGS) -o $(PROGRAM) $(SOURCES) + + +# +# UNIX +# + +hpux: + cc -Ae $(CPPFLAGS) -o $(PROGRAM) $(SOURCES) + +hpux9: + 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 -MT -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 -MT -W3 -O2 -GF $(CPPFLAGS) $(SOURCES) + +win32-watcomc win32-wc: + wcl386 -bt=nt -zq -mf -5r -zc -w5 -oneatx $(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 +# + +clean: + rm -f $(PROGRAM) $(PROGRAM).exe $(PROGRAM).map $(PROGRAM).tds + rm -f *.err *.o *.obj + +.PHONY: default clean diff --git a/minilzo-2.10/lzoconf.h b/minilzo-2.10/lzoconf.h new file mode 100644 index 0000000..f9a8bdb --- /dev/null +++ b/minilzo-2.10/lzoconf.h @@ -0,0 +1,453 @@ +/* lzoconf.h -- configuration of the LZO data compression library + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library 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. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + <ma...@ob...> + http://www.oberhumer.com/opensource/lzo/ + */ + + +#ifndef __LZOCONF_H_INCLUDED +#define __LZOCONF_H_INCLUDED 1 + +#define LZO_VERSION 0x20a0 /* 2.10 */ +#define LZO_VERSION_STRING "2.10" +#define LZO_VERSION_DATE "Mar 01 2017" + +/* internal Autoconf configuration file - only used when building LZO */ +#if defined(LZO_HAVE_CONFIG_H) +# include <config.h> +#endif +#include <limits.h> +#include <stddef.h> + + +/*********************************************************************** +// LZO requires a conforming <limits.h> +************************************************************************/ + +#if !defined(CHAR_BIT) || (CHAR_BIT != 8) +# error "invalid CHAR_BIT" +#endif +#if !defined(UCHAR_MAX) || !defined(USHRT_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) +# error "check your compiler installation" +#endif +#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) +# error "your limits.h macros are broken" +#endif + +/* get OS and architecture defines */ +#ifndef __LZODEFS_H_INCLUDED +#include <lzo/lzodefs.h> +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************** +// some core defines +************************************************************************/ + +/* memory checkers */ +#if !defined(__LZO_CHECKER) +# if defined(__BOUNDS_CHECKING_ON) +# define __LZO_CHECKER 1 +# elif defined(__CHECKER__) +# define __LZO_CHECKER 1 +# elif defined(__INSURE__) +# define __LZO_CHECKER 1 +# elif defined(__PURIFY__) +# define __LZO_CHECKER 1 +# endif ...<truncated>... hooks/post-receive -- A serial program loader for the Dreamcast. |