aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <git@madler.net>2026-01-12 09:54:42 -0800
committerMark Adler <git@madler.net>2026-01-12 10:13:28 -0800
commit6598de3581a2c3301a2cdddadeb8f07cf5995816 (patch)
treecb533e05ce11af22643c121d7bbd43370a35b919
parent4edb00de5aac7e4aa9110374bd1991c4d070eddb (diff)
downloadzlib-6598de3581a2c3301a2cdddadeb8f07cf5995816.tar.gz
zlib-6598de3581a2c3301a2cdddadeb8f07cf5995816.tar.bz2
zlib-6598de3581a2c3301a2cdddadeb8f07cf5995816.zip
Remove old subdirectory.
-rw-r--r--old/Makefile.emx69
-rw-r--r--old/Makefile.riscos151
-rw-r--r--old/README3
-rw-r--r--old/descrip.mms48
-rw-r--r--old/os2/Makefile.os2136
-rw-r--r--old/os2/zlib.def51
-rw-r--r--old/visual-basic.txt160
7 files changed, 0 insertions, 618 deletions
diff --git a/old/Makefile.emx b/old/Makefile.emx
deleted file mode 100644
index 612b0379..00000000
--- a/old/Makefile.emx
+++ /dev/null
@@ -1,69 +0,0 @@
1# Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98.
2# Copyright (C) 1995-1998 Jean-loup Gailly.
3# For conditions of distribution and use, see copyright notice in zlib.h
4
5# To compile, or to compile and test, type:
6#
7# make -fmakefile.emx; make test -fmakefile.emx
8#
9
10CC=gcc -Zwin32
11
12#CFLAGS=-MMD -O
13#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
14#CFLAGS=-MMD -g -DZLIB_DEBUG
15CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
16 -Wstrict-prototypes -Wmissing-prototypes
17
18# If cp.exe is available, replace "copy /Y" with "cp -fp" .
19CP=copy /Y
20# If gnu install.exe is available, replace $(CP) with ginstall.
21INSTALL=$(CP)
22# The default value of RM is "rm -f." If "rm.exe" is found, comment out:
23RM=del
24LDLIBS=-L. -lzlib
25LD=$(CC) -s -o
26LDSHARED=$(CC)
27
28INCL=zlib.h zconf.h
29LIBS=zlib.a
30
31AR=ar rcs
32
33prefix=/usr/local
34exec_prefix = $(prefix)
35
36OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
37 gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
38
39TEST_OBJS = example.o minigzip.o
40
41all: example.exe minigzip.exe
42
43test: all
44 ./example
45 echo hello world | .\minigzip | .\minigzip -d
46
47%.o : %.c
48 $(CC) $(CFLAGS) -c $< -o $@
49
50zlib.a: $(OBJS)
51 $(AR) $@ $(OBJS)
52
53%.exe : %.o $(LIBS)
54 $(LD) $@ $< $(LDLIBS)
55
56
57.PHONY : clean
58
59clean:
60 $(RM) *.d
61 $(RM) *.o
62 $(RM) *.exe
63 $(RM) zlib.a
64 $(RM) foo.gz
65
66DEPS := $(wildcard *.d)
67ifneq ($(DEPS),)
68include $(DEPS)
69endif
diff --git a/old/Makefile.riscos b/old/Makefile.riscos
deleted file mode 100644
index 0f503ff2..00000000
--- a/old/Makefile.riscos
+++ /dev/null
@@ -1,151 +0,0 @@
1# Project: zlib_1_03
2# Patched for zlib 1.1.2 rw@shadow.org.uk 19980430
3# test works out-of-the-box, installs `somewhere' on demand
4
5# Toolflags:
6CCflags = -c -depend !Depend -IC: -g -throwback -fah
7C++flags = -c -depend !Depend -IC: -throwback
8Linkflags = -aif -c++ -o $@
9ObjAsmflags = -throwback -NoCache -depend !Depend
10CMHGflags =
11LibFileflags = -c -l -o $@
12Squeezeflags = -o $@
13
14# change the line below to where _you_ want the library installed.
15libdest = lib:zlib
16
17# Final targets:
18@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
19 @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
20 @.o.uncompr @.o.zutil
21 LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
22 @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
23 @.o.trees @.o.uncompr @.o.zutil
24test: @.minigzip @.example @.lib
25 @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV
26 @echo running tests: hang on.
27 @/@.minigzip -f -9 libc
28 @/@.minigzip -d libc-gz
29 @/@.minigzip -f -1 libc
30 @/@.minigzip -d libc-gz
31 @/@.minigzip -h -9 libc
32 @/@.minigzip -d libc-gz
33 @/@.minigzip -h -1 libc
34 @/@.minigzip -d libc-gz
35 @/@.minigzip -9 libc
36 @/@.minigzip -d libc-gz
37 @/@.minigzip -1 libc
38 @/@.minigzip -d libc-gz
39 @diff @.lib @.libc
40 @echo that should have reported '@.lib and @.libc identical' if you have diff.
41 @/@.example @.fred @.fred
42 @echo that will have given lots of hello!'s.
43
44@.minigzip: @.o.minigzip @.lib C:o.Stubs
45 Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs
46@.example: @.o.example @.lib C:o.Stubs
47 Link $(Linkflags) @.o.example @.lib C:o.Stubs
48
49install: @.lib
50 cdir $(libdest)
51 cdir $(libdest).h
52 @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV
53 @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV
54 @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV
55 @echo okay, installed zlib in $(libdest)
56
57clean:; remove @.minigzip
58 remove @.example
59 remove @.libc
60 -wipe @.o.* F~r~cV
61 remove @.fred
62
63# User-editable dependencies:
64.c.o:
65 cc $(ccflags) -o $@ $<
66
67# Static dependencies:
68
69# Dynamic dependencies:
70o.example: c.example
71o.example: h.zlib
72o.example: h.zconf
73o.minigzip: c.minigzip
74o.minigzip: h.zlib
75o.minigzip: h.zconf
76o.adler32: c.adler32
77o.adler32: h.zlib
78o.adler32: h.zconf
79o.compress: c.compress
80o.compress: h.zlib
81o.compress: h.zconf
82o.crc32: c.crc32
83o.crc32: h.zlib
84o.crc32: h.zconf
85o.deflate: c.deflate
86o.deflate: h.deflate
87o.deflate: h.zutil
88o.deflate: h.zlib
89o.deflate: h.zconf
90o.gzio: c.gzio
91o.gzio: h.zutil
92o.gzio: h.zlib
93o.gzio: h.zconf
94o.infblock: c.infblock
95o.infblock: h.zutil
96o.infblock: h.zlib
97o.infblock: h.zconf
98o.infblock: h.infblock
99o.infblock: h.inftrees
100o.infblock: h.infcodes
101o.infblock: h.infutil
102o.infcodes: c.infcodes
103o.infcodes: h.zutil
104o.infcodes: h.zlib
105o.infcodes: h.zconf
106o.infcodes: h.inftrees
107o.infcodes: h.infblock
108o.infcodes: h.infcodes
109o.infcodes: h.infutil
110o.infcodes: h.inffast
111o.inffast: c.inffast
112o.inffast: h.zutil
113o.inffast: h.zlib
114o.inffast: h.zconf
115o.inffast: h.inftrees
116o.inffast: h.infblock
117o.inffast: h.infcodes
118o.inffast: h.infutil
119o.inffast: h.inffast
120o.inflate: c.inflate
121o.inflate: h.zutil
122o.inflate: h.zlib
123o.inflate: h.zconf
124o.inflate: h.infblock
125o.inftrees: c.inftrees
126o.inftrees: h.zutil
127o.inftrees: h.zlib
128o.inftrees: h.zconf
129o.inftrees: h.inftrees
130o.inftrees: h.inffixed
131o.infutil: c.infutil
132o.infutil: h.zutil
133o.infutil: h.zlib
134o.infutil: h.zconf
135o.infutil: h.infblock
136o.infutil: h.inftrees
137o.infutil: h.infcodes
138o.infutil: h.infutil
139o.trees: c.trees
140o.trees: h.deflate
141o.trees: h.zutil
142o.trees: h.zlib
143o.trees: h.zconf
144o.trees: h.trees
145o.uncompr: c.uncompr
146o.uncompr: h.zlib
147o.uncompr: h.zconf
148o.zutil: c.zutil
149o.zutil: h.zutil
150o.zutil: h.zlib
151o.zutil: h.zconf
diff --git a/old/README b/old/README
deleted file mode 100644
index 800bf079..00000000
--- a/old/README
+++ /dev/null
@@ -1,3 +0,0 @@
1This directory contains files that have not been updated for zlib 1.2.x
2
3(Volunteers are encouraged to help clean this up. Thanks.)
diff --git a/old/descrip.mms b/old/descrip.mms
deleted file mode 100644
index 7066da5b..00000000
--- a/old/descrip.mms
+++ /dev/null
@@ -1,48 +0,0 @@
1# descrip.mms: MMS description file for building zlib on VMS
2# written by Martin P.J. Zinser <m.zinser@gsi.de>
3
4cc_defs =
5c_deb =
6
7.ifdef __DECC__
8pref = /prefix=all
9.endif
10
11OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\
12 deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\
13 inftrees.obj, infcodes.obj, infutil.obj, inffast.obj
14
15CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF)
16
17all : example.exe minigzip.exe
18 @ write sys$output " Example applications available"
19libz.olb : libz.olb($(OBJS))
20 @ write sys$output " libz available"
21
22example.exe : example.obj libz.olb
23 link example,libz.olb/lib
24
25minigzip.exe : minigzip.obj libz.olb
26 link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
27
28clean :
29 delete *.obj;*,libz.olb;*
30
31
32# Other dependencies.
33adler32.obj : zutil.h zlib.h zconf.h
34compress.obj : zlib.h zconf.h
35crc32.obj : zutil.h zlib.h zconf.h
36deflate.obj : deflate.h zutil.h zlib.h zconf.h
37example.obj : zlib.h zconf.h
38gzio.obj : zutil.h zlib.h zconf.h
39infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
40infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
41inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
42inflate.obj : zutil.h zlib.h zconf.h infblock.h
43inftrees.obj : zutil.h zlib.h zconf.h inftrees.h
44infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h
45minigzip.obj : zlib.h zconf.h
46trees.obj : deflate.h zutil.h zlib.h zconf.h
47uncompr.obj : zlib.h zconf.h
48zutil.obj : zutil.h zlib.h zconf.h
diff --git a/old/os2/Makefile.os2 b/old/os2/Makefile.os2
deleted file mode 100644
index bb426c0d..00000000
--- a/old/os2/Makefile.os2
+++ /dev/null
@@ -1,136 +0,0 @@
1# Makefile for zlib under OS/2 using GCC (PGCC)
2# For conditions of distribution and use, see copyright notice in zlib.h
3
4# To compile and test, type:
5# cp Makefile.os2 ..
6# cd ..
7# make -f Makefile.os2 test
8
9# This makefile will build a static library z.lib, a shared library
10# z.dll and a import library zdll.lib. You can use either z.lib or
11# zdll.lib by specifying either -lz or -lzdll on gcc's command line
12
13CC=gcc -Zomf -s
14
15CFLAGS=-O6 -Wall
16#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
17#CFLAGS=-g -DZLIB_DEBUG
18#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
19# -Wstrict-prototypes -Wmissing-prototypes
20
21#################### BUG WARNING: #####################
22## infcodes.c hits a bug in pgcc-1.0, so you have to use either
23## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem)
24## This bug is reportedly fixed in pgcc >1.0, but this was not tested
25CFLAGS+=-fno-force-mem
26
27LDFLAGS=-s -L. -lzdll -Zcrtdll
28LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll
29
30VER=1.1.0
31ZLIB=z.lib
32SHAREDLIB=z.dll
33SHAREDLIBIMP=zdll.lib
34LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP)
35
36AR=emxomfar cr
37IMPLIB=emximp
38RANLIB=echo
39TAR=tar
40SHELL=bash
41
42prefix=/usr/local
43exec_prefix = $(prefix)
44
45OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
46 zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
47
48TEST_OBJS = example.o minigzip.o
49
50DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
51 algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
52 nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \
53 contrib/asm386/*.asm contrib/asm386/*.c \
54 contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
55 contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
56 contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
57
58all: example.exe minigzip.exe
59
60test: all
61 @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
62 echo hello world | ./minigzip | ./minigzip -d || \
63 echo ' *** minigzip test FAILED ***' ; \
64 if ./example; then \
65 echo ' *** zlib test OK ***'; \
66 else \
67 echo ' *** zlib test FAILED ***'; \
68 fi
69
70$(ZLIB): $(OBJS)
71 $(AR) $@ $(OBJS)
72 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
73
74$(SHAREDLIB): $(OBJS) os2/z.def
75 $(LDSHARED) -o $@ $^
76
77$(SHAREDLIBIMP): os2/z.def
78 $(IMPLIB) -o $@ $^
79
80example.exe: example.o $(LIBS)
81 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
82
83minigzip.exe: minigzip.o $(LIBS)
84 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
85
86clean:
87 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz
88
89distclean: clean
90
91zip:
92 mv Makefile Makefile~; cp -p Makefile.in Makefile
93 rm -f test.c ztest*.c
94 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
95 zip -ul9 zlib$$v $(DISTFILES)
96 mv Makefile~ Makefile
97
98dist:
99 mv Makefile Makefile~; cp -p Makefile.in Makefile
100 rm -f test.c ztest*.c
101 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
102 rm -f $$d.tar.gz; \
103 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
104 files=""; \
105 for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
106 cd ..; \
107 GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
108 if test ! -d $$d; then rm -f $$d; fi
109 mv Makefile~ Makefile
110
111tags:
112 etags *.[ch]
113
114depend:
115 makedepend -- $(CFLAGS) -- *.[ch]
116
117# DO NOT DELETE THIS LINE -- make depend depends on it.
118
119adler32.o: zlib.h zconf.h
120compress.o: zlib.h zconf.h
121crc32.o: zlib.h zconf.h
122deflate.o: deflate.h zutil.h zlib.h zconf.h
123example.o: zlib.h zconf.h
124gzio.o: zutil.h zlib.h zconf.h
125infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
126infcodes.o: zutil.h zlib.h zconf.h
127infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
128inffast.o: zutil.h zlib.h zconf.h inftrees.h
129inffast.o: infblock.h infcodes.h infutil.h inffast.h
130inflate.o: zutil.h zlib.h zconf.h infblock.h
131inftrees.o: zutil.h zlib.h zconf.h inftrees.h
132infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
133minigzip.o: zlib.h zconf.h
134trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
135uncompr.o: zlib.h zconf.h
136zutil.o: zutil.h zlib.h zconf.h
diff --git a/old/os2/zlib.def b/old/os2/zlib.def
deleted file mode 100644
index 4c753f1a..00000000
--- a/old/os2/zlib.def
+++ /dev/null
@@ -1,51 +0,0 @@
1;
2; Slightly modified version of ../nt/zlib.dnt :-)
3;
4
5LIBRARY Z
6DESCRIPTION "Zlib compression library for OS/2"
7CODE PRELOAD MOVEABLE DISCARDABLE
8DATA PRELOAD MOVEABLE MULTIPLE
9
10EXPORTS
11 adler32
12 compress
13 crc32
14 deflate
15 deflateCopy
16 deflateEnd
17 deflateInit2_
18 deflateInit_
19 deflateParams
20 deflateReset
21 deflateSetDictionary
22 gzclose
23 gzdopen
24 gzerror
25 gzflush
26 gzopen
27 gzread
28 gzwrite
29 inflate
30 inflateEnd
31 inflateInit2_
32 inflateInit_
33 inflateReset
34 inflateSetDictionary
35 inflateSync
36 uncompress
37 zlibVersion
38 gzprintf
39 gzputc
40 gzgetc
41 gzseek
42 gzrewind
43 gztell
44 gzeof
45 gzsetparams
46 zError
47 inflateSyncPoint
48 get_crc_table
49 compress2
50 gzputs
51 gzgets
diff --git a/old/visual-basic.txt b/old/visual-basic.txt
deleted file mode 100644
index 3c8d2a42..00000000
--- a/old/visual-basic.txt
+++ /dev/null
@@ -1,160 +0,0 @@
1See below some functions declarations for Visual Basic.
2
3Frequently Asked Question:
4
5Q: Each time I use the compress function I get the -5 error (not enough
6 room in the output buffer).
7
8A: Make sure that the length of the compressed buffer is passed by
9 reference ("as any"), not by value ("as long"). Also check that
10 before the call of compress this length is equal to the total size of
11 the compressed buffer and not zero.
12
13
14From: "Jon Caruana" <jon-net@usa.net>
15Subject: Re: How to port zlib declares to vb?
16Date: Mon, 28 Oct 1996 18:33:03 -0600
17
18Got the answer! (I haven't had time to check this but it's what I got, and
19looks correct):
20
21He has the following routines working:
22 compress
23 uncompress
24 gzopen
25 gzwrite
26 gzread
27 gzclose
28
29Declares follow: (Quoted from Carlos Rios <c_rios@sonda.cl>, in Vb4 form)
30
31#If Win16 Then 'Use Win16 calls.
32Declare Function compress Lib "ZLIB.DLL" (ByVal compr As
33 String, comprLen As Any, ByVal buf As String, ByVal buflen
34 As Long) As Integer
35Declare Function uncompress Lib "ZLIB.DLL" (ByVal uncompr
36 As String, uncomprLen As Any, ByVal compr As String, ByVal
37 lcompr As Long) As Integer
38Declare Function gzopen Lib "ZLIB.DLL" (ByVal filePath As
39 String, ByVal mode As String) As Long
40Declare Function gzread Lib "ZLIB.DLL" (ByVal file As
41 Long, ByVal uncompr As String, ByVal uncomprLen As Integer)
42 As Integer
43Declare Function gzwrite Lib "ZLIB.DLL" (ByVal file As
44 Long, ByVal uncompr As String, ByVal uncomprLen As Integer)
45 As Integer
46Declare Function gzclose Lib "ZLIB.DLL" (ByVal file As
47 Long) As Integer
48#Else
49Declare Function compress Lib "ZLIB32.DLL"
50 (ByVal compr As String, comprLen As Any, ByVal buf As
51 String, ByVal buflen As Long) As Integer
52Declare Function uncompress Lib "ZLIB32.DLL"
53 (ByVal uncompr As String, uncomprLen As Any, ByVal compr As
54 String, ByVal lcompr As Long) As Long
55Declare Function gzopen Lib "ZLIB32.DLL"
56 (ByVal file As String, ByVal mode As String) As Long
57Declare Function gzread Lib "ZLIB32.DLL"
58 (ByVal file As Long, ByVal uncompr As String, ByVal
59 uncomprLen As Long) As Long
60Declare Function gzwrite Lib "ZLIB32.DLL"
61 (ByVal file As Long, ByVal uncompr As String, ByVal
62 uncomprLen As Long) As Long
63Declare Function gzclose Lib "ZLIB32.DLL"
64 (ByVal file As Long) As Long
65#End If
66
67-Jon Caruana
68jon-net@usa.net
69Microsoft Sitebuilder Network Level 1 Member - HTML Writer's Guild Member
70
71
72Here is another example from Michael <michael_borgsys@hotmail.com> that he
73says conforms to the VB guidelines, and that solves the problem of not
74knowing the uncompressed size by storing it at the end of the file:
75
76'Calling the functions:
77'bracket meaning: <parameter> [optional] {Range of possible values}
78'Call subCompressFile(<path with filename to compress> [, <path with
79filename to write to>, [level of compression {1..9}]])
80'Call subUncompressFile(<path with filename to compress>)
81
82Option Explicit
83Private lngpvtPcnSml As Long 'Stores value for 'lngPercentSmaller'
84Private Const SUCCESS As Long = 0
85Private Const strFilExt As String = ".cpr"
86Private Declare Function lngfncCpr Lib "zlib.dll" Alias "compress2" (ByRef
87dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long,
88ByVal level As Integer) As Long
89Private Declare Function lngfncUcp Lib "zlib.dll" Alias "uncompress" (ByRef
90dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long)
91As Long
92
93Public Sub subCompressFile(ByVal strargOriFilPth As String, Optional ByVal
94strargCprFilPth As String, Optional ByVal intLvl As Integer = 9)
95 Dim strCprPth As String
96 Dim lngOriSiz As Long
97 Dim lngCprSiz As Long
98 Dim bytaryOri() As Byte
99 Dim bytaryCpr() As Byte
100 lngOriSiz = FileLen(strargOriFilPth)
101 ReDim bytaryOri(lngOriSiz - 1)
102 Open strargOriFilPth For Binary Access Read As #1
103 Get #1, , bytaryOri()
104 Close #1
105 strCprPth = IIf(strargCprFilPth = "", strargOriFilPth, strargCprFilPth)
106'Select file path and name
107 strCprPth = strCprPth & IIf(Right(strCprPth, Len(strFilExt)) =
108strFilExt, "", strFilExt) 'Add file extension if not exists
109 lngCprSiz = (lngOriSiz * 1.01) + 12 'Compression needs temporary a bit
110more space then original file size
111 ReDim bytaryCpr(lngCprSiz - 1)
112 If lngfncCpr(bytaryCpr(0), lngCprSiz, bytaryOri(0), lngOriSiz, intLvl) =
113SUCCESS Then
114 lngpvtPcnSml = (1# - (lngCprSiz / lngOriSiz)) * 100
115 ReDim Preserve bytaryCpr(lngCprSiz - 1)
116 Open strCprPth For Binary Access Write As #1
117 Put #1, , bytaryCpr()
118 Put #1, , lngOriSiz 'Add the original size value to the end
119(last 4 bytes)
120 Close #1
121 Else
122 MsgBox "Compression error"
123 End If
124 Erase bytaryCpr
125 Erase bytaryOri
126End Sub
127
128Public Sub subUncompressFile(ByVal strargFilPth As String)
129 Dim bytaryCpr() As Byte
130 Dim bytaryOri() As Byte
131 Dim lngOriSiz As Long
132 Dim lngCprSiz As Long
133 Dim strOriPth As String
134 lngCprSiz = FileLen(strargFilPth)
135 ReDim bytaryCpr(lngCprSiz - 1)
136 Open strargFilPth For Binary Access Read As #1
137 Get #1, , bytaryCpr()
138 Close #1
139 'Read the original file size value:
140 lngOriSiz = bytaryCpr(lngCprSiz - 1) * (2 ^ 24) _
141 + bytaryCpr(lngCprSiz - 2) * (2 ^ 16) _
142 + bytaryCpr(lngCprSiz - 3) * (2 ^ 8) _
143 + bytaryCpr(lngCprSiz - 4)
144 ReDim Preserve bytaryCpr(lngCprSiz - 5) 'Cut of the original size value
145 ReDim bytaryOri(lngOriSiz - 1)
146 If lngfncUcp(bytaryOri(0), lngOriSiz, bytaryCpr(0), lngCprSiz) = SUCCESS
147Then
148 strOriPth = Left(strargFilPth, Len(strargFilPth) - Len(strFilExt))
149 Open strOriPth For Binary Access Write As #1
150 Put #1, , bytaryOri()
151 Close #1
152 Else
153 MsgBox "Uncompression error"
154 End If
155 Erase bytaryCpr
156 Erase bytaryOri
157End Sub
158Public Property Get lngPercentSmaller() As Long
159 lngPercentSmaller = lngpvtPcnSml
160End Property