1
Fork 0

Move LZO stuff into it's own folder

This commit is contained in:
Joshua Goins 2022-02-28 12:30:08 -04:00
parent 5e0937f86d
commit d3c77e3713
15 changed files with 16 additions and 282 deletions

Binary file not shown.

100
Makefile
View file

@ -1,100 +0,0 @@
#
# 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

View file

@ -11,8 +11,6 @@
030F700E2415C6B500A43F01 /* PreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030F700D2415C6B500A43F01 /* PreviewViewController.swift */; };
030F70112415C6B500A43F01 /* PreviewViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 030F700F2415C6B500A43F01 /* PreviewViewController.xib */; };
030F70162415C6B500A43F01 /* QuickLook.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 030F70082415C6B500A43F01 /* QuickLook.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
0357A94D26F9C7370075D5BC /* minilzo.c in Sources */ = {isa = PBXBuildFile; fileRef = 0357A94A26F9C7370075D5BC /* minilzo.c */; };
0357A94E26F9C7370075D5BC /* lzoconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 0357A94C26F9C7370075D5BC /* lzoconf.h */; };
035D1A0426F0927200B332BE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035D19F826F0927200B332BE /* ViewController.swift */; };
035D1A0526F0927200B332BE /* cbridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 035D19FA26F0927200B332BE /* cbridge.c */; };
035D1A0626F0927200B332BE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 035D19FB26F0927200B332BE /* Assets.xcassets */; };
@ -32,9 +30,10 @@
0371996727BACD8700EE1DFD /* ExportAccessoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0371996627BACD8700EE1DFD /* ExportAccessoryView.xib */; };
0371996927BACDE800EE1DFD /* ExportAccessoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0371996827BACDE800EE1DFD /* ExportAccessoryView.swift */; };
03A2FE7B27CC3034004CDE91 /* libPSDWriter-Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03A2FE7927CC2EED004CDE91 /* libPSDWriter-Mac.a */; };
03C39DE726F90734005555AE /* lzodefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 03C39DE226F90733005555AE /* lzodefs.h */; };
03C39DE826F90734005555AE /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = 03C39DE426F90734005555AE /* Makefile */; };
03C39DEA26F90734005555AE /* minilzo.h in Headers */ = {isa = PBXBuildFile; fileRef = 03C39DE626F90734005555AE /* minilzo.h */; };
03A2FE9427CD3DFF004CDE91 /* lzoconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A2FE9127CD3DFF004CDE91 /* lzoconf.h */; };
03A2FE9527CD3DFF004CDE91 /* minilzo.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A2FE9227CD3DFF004CDE91 /* minilzo.h */; };
03A2FE9627CD3DFF004CDE91 /* lzodefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A2FE9327CD3DFF004CDE91 /* lzodefs.h */; };
03A2FE9827CD3E0A004CDE91 /* minilzo.c in Sources */ = {isa = PBXBuildFile; fileRef = 03A2FE9727CD3E0A004CDE91 /* minilzo.c */; };
03CB383B2419CA2D0078B3E5 /* libLZO.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03CB382E2419C9DB0078B3E5 /* libLZO.a */; };
03CB3840241A5AED0078B3E5 /* Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03CB383F241A5AED0078B3E5 /* Shared.swift */; };
03CB3841241A5AED0078B3E5 /* Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03CB383F241A5AED0078B3E5 /* Shared.swift */; };
@ -102,10 +101,6 @@
030F70102415C6B500A43F01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreviewViewController.xib; sourceTree = "<group>"; };
030F70122415C6B500A43F01 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
030F70132415C6B500A43F01 /* Quicklook.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Quicklook.entitlements; sourceTree = "<group>"; };
0357A94926F9C7370075D5BC /* README.LZO */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.LZO; sourceTree = "<group>"; };
0357A94A26F9C7370075D5BC /* minilzo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = minilzo.c; sourceTree = "<group>"; };
0357A94B26F9C7370075D5BC /* testmini */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = testmini; sourceTree = "<group>"; };
0357A94C26F9C7370075D5BC /* lzoconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lzoconf.h; sourceTree = "<group>"; };
035D19F826F0927200B332BE /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
035D19F926F0927200B332BE /* SilicaViewer.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = SilicaViewer.entitlements; sourceTree = "<group>"; };
035D19FA26F0927200B332BE /* cbridge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbridge.c; sourceTree = "<group>"; };
@ -128,10 +123,10 @@
0371996627BACD8700EE1DFD /* ExportAccessoryView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ExportAccessoryView.xib; sourceTree = "<group>"; };
0371996827BACDE800EE1DFD /* ExportAccessoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportAccessoryView.swift; sourceTree = "<group>"; };
03A2FE7427CC2EED004CDE91 /* PSDWriter-Mac.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "PSDWriter-Mac.xcodeproj"; path = "Dependencies/PSDWriter/PSDWriter-Mac.xcodeproj"; sourceTree = "<group>"; };
03C39DE226F90733005555AE /* lzodefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lzodefs.h; sourceTree = "<group>"; };
03C39DE326F90733005555AE /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = "<group>"; };
03C39DE426F90734005555AE /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
03C39DE626F90734005555AE /* minilzo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = minilzo.h; sourceTree = "<group>"; };
03A2FE9127CD3DFF004CDE91 /* lzoconf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lzoconf.h; path = Dependencies/MiniLZO/lzoconf.h; sourceTree = "<group>"; };
03A2FE9227CD3DFF004CDE91 /* minilzo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = minilzo.h; path = Dependencies/MiniLZO/minilzo.h; sourceTree = "<group>"; };
03A2FE9327CD3DFF004CDE91 /* lzodefs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = lzodefs.h; path = Dependencies/MiniLZO/lzodefs.h; sourceTree = "<group>"; };
03A2FE9727CD3E0A004CDE91 /* minilzo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = minilzo.c; path = Dependencies/MiniLZO/minilzo.c; sourceTree = "<group>"; };
03CB382E2419C9DB0078B3E5 /* libLZO.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLZO.a; sourceTree = BUILT_PRODUCTS_DIR; };
03CB383F241A5AED0078B3E5 /* Shared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shared.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -186,9 +181,12 @@
030F6FE52415C5E300A43F01 = {
isa = PBXGroup;
children = (
03A2FE9727CD3E0A004CDE91 /* minilzo.c */,
03A2FE9127CD3DFF004CDE91 /* lzoconf.h */,
03A2FE9327CD3DFF004CDE91 /* lzodefs.h */,
03A2FE9227CD3DFF004CDE91 /* minilzo.h */,
03A2FE7427CC2EED004CDE91 /* PSDWriter-Mac.xcodeproj */,
0371995827BAC52900EE1DFD /* SilicaViewer.xctestplan */,
0357A94826F9C71E0075D5BC /* LZO */,
035D19F726F0927200B332BE /* SilicaViewer */,
03CB383E241A5ACD0078B3E5 /* Shared */,
030F700C2415C6B500A43F01 /* Quicklook */,
@ -231,21 +229,6 @@
path = Quicklook;
sourceTree = "<group>";
};
0357A94826F9C71E0075D5BC /* LZO */ = {
isa = PBXGroup;
children = (
0357A94C26F9C7370075D5BC /* lzoconf.h */,
0357A94A26F9C7370075D5BC /* minilzo.c */,
0357A94926F9C7370075D5BC /* README.LZO */,
0357A94B26F9C7370075D5BC /* testmini */,
03C39DE326F90733005555AE /* COPYING */,
03C39DE226F90733005555AE /* lzodefs.h */,
03C39DE426F90734005555AE /* Makefile */,
03C39DE626F90734005555AE /* minilzo.h */,
);
name = LZO;
sourceTree = "<group>";
};
035D19F726F0927200B332BE /* SilicaViewer */ = {
isa = PBXGroup;
children = (
@ -307,9 +290,9 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
03C39DE726F90734005555AE /* lzodefs.h in Headers */,
0357A94E26F9C7370075D5BC /* lzoconf.h in Headers */,
03C39DEA26F90734005555AE /* minilzo.h in Headers */,
03A2FE9427CD3DFF004CDE91 /* lzoconf.h in Headers */,
03A2FE9527CD3DFF004CDE91 /* minilzo.h in Headers */,
03A2FE9627CD3DFF004CDE91 /* lzodefs.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -566,8 +549,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
03C39DE826F90734005555AE /* Makefile in Sources */,
0357A94D26F9C7370075D5BC /* minilzo.c in Sources */,
03A2FE9827CD3E0A004CDE91 /* minilzo.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

BIN
testmini

Binary file not shown.

View file

@ -1,148 +0,0 @@
/* testmini.c -- very simple test program for the miniLZO 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
<markus@oberhumer.com>
http://www.oberhumer.com/opensource/lzo/
*/
#include <stdio.h>
#include <stdlib.h>
/*************************************************************************
// This program shows the basic usage of the LZO library.
// We will compress a block of data and decompress again.
//
// For more information, documentation, example programs and other support
// files (like Makefiles and build scripts) please download the full LZO
// package from
// http://www.oberhumer.com/opensource/lzo/
**************************************************************************/
/* First let's include "minizo.h". */
#include "minilzo.h"
/* We want to compress the data block at 'in' with length 'IN_LEN' to
* the block at 'out'. Because the input block may be incompressible,
* we must provide a little more output space in case that compression
* is not possible.
*/
#define IN_LEN (128*1024ul)
#define OUT_LEN (IN_LEN + IN_LEN / 16 + 64 + 3)
static unsigned char __LZO_MMODEL in [ IN_LEN ];
static unsigned char __LZO_MMODEL out [ OUT_LEN ];
/* Work-memory needed for compression. Allocate memory in units
* of 'lzo_align_t' (instead of 'char') to make sure it is properly aligned.
*/
#define HEAP_ALLOC(var,size) \
lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]
static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS);
/*************************************************************************
//
**************************************************************************/
int main(int argc, char *argv[])
{
int r;
lzo_uint in_len;
lzo_uint out_len;
lzo_uint new_len;
if (argc < 0 && argv == NULL) /* avoid warning about unused args */
return 0;
printf("\nLZO real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
printf("Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
/*
* Step 1: initialize the LZO library
*/
if (lzo_init() != LZO_E_OK)
{
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;
}
/*
* Step 2: prepare the input block that will get compressed.
* We just fill it with zeros in this example program,
* but you would use your real-world data here.
*/
in_len = IN_LEN;
lzo_memset(in,0,in_len);
/*
* Step 3: compress from 'in' to 'out' with LZO1X-1
*/
r = lzo1x_1_compress(in,in_len,out,&out_len,wrkmem);
if (r == LZO_E_OK)
printf("compressed %lu bytes into %lu bytes\n",
(unsigned long) in_len, (unsigned long) out_len);
else
{
/* this should NEVER happen */
printf("internal error - compression failed: %d\n", r);
return 2;
}
/* check for an incompressible block */
if (out_len >= in_len)
{
printf("This block contains incompressible data.\n");
return 0;
}
/*
* Step 4: decompress again, now going from 'out' to 'in'
*/
new_len = in_len;
r = lzo1x_decompress(out,out_len,in,&new_len,NULL);
if (r == LZO_E_OK && new_len == in_len)
printf("decompressed %lu bytes back into %lu bytes\n",
(unsigned long) out_len, (unsigned long) in_len);
else
{
/* this should NEVER happen */
printf("internal error - decompression failed: %d\n", r);
return 1;
}
printf("\nminiLZO simple compression test passed.\n");
return 0;
}
/* vim:set ts=4 sw=4 et: */