PureZIP library : ZIP / UNZIP files

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

If I add with PureZip a archives file (ZIP or JCalG1) to my ZIP-archives, it's every time corrupted (not valid archives) after extracting.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Thorsten1867 wrote:If I add with PureZip a archives file (ZIP or JCalG1) to my ZIP-archives, it's every time corrupted (not valid archives) after extracting.
No problems here.
Do you use the latest purebasic beta libraries ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

gnozal wrote:Do you use the latest purebasic beta libraries ?
PureBasic v4.00 (Windows - x86) - Build Date: 05/09/2006 - 23:26:02
PureBasic_4_00_(xz7xhz).exe
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Thorsten1867 wrote:
gnozal wrote:Do you use the latest purebasic beta libraries ?
PureBasic v4.00 (Windows - x86) - Build Date: 05/09/2006 - 23:26:02
PureBasic_4_00_(xz7xhz).exe
I mean the libraries from http://www.purebasic.com/beta
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

No, I will download it.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

Now it seems to work. THANKS!!!!! :D

If tried to solve the problem many hours and were full of despair.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Thorsten1867 wrote:Now it seems to work. THANKS!!!!! :D

If tried to solve the problem many hours and were full of despair.
No problem.

http://www.purebasic.fr/english/viewtop ... &start=115
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Post by wilbert »

Is it possibly to use the ImagePluginPNG library to compress data in memory ?

I only need the PureZIP_PackMemory functionality from the PureZIP library but since this library doesn't work together with the ImagePluginPNG library and PNG encoding also requires zlib compression I was wondering this.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

wilbert wrote:Is it possibly to use the ImagePluginPNG library to compress data in memory ?
I don't know.
wilbert wrote:I only need the PureZIP_PackMemory functionality from the PureZIP library but since this library doesn't work together with the ImagePluginPNG library and PNG encoding also requires zlib compression I was wondering this.
You cannot use PureZIP and ImagePluginPNG together in the same project.
They both use a static ZLIB library ; I don't know what to do to avoid the POLINK error. Maybe Fred knows ...
What you can do :
- use another image plugin
- use the ZLIB DLL (look at Num3's web site).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Remainder

In order to use PureZIP for PB4 without errors, you need the latest beta libairies from http://www.purebasic.com/beta because of a purebasic bug in the file library (ReadData()/Eof() bug : http://www.purebasic.fr/english/viewtopic.php?t=22186)

References :
- http://www.purebasic.fr/english/viewtop ... c&start=44
- http://www.purebasic.fr/english/viewtop ... highlight=

Thanks.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

User request :

Update V1.60 (both libs)

Changes :
- added : new function PureZIP_SetCompressionAlgorithm()
PureZIP_SetCompressionAlgorithm()

Syntax

PureZIP_SetCompressionAlgorithm(Algorithm.l)

Description

Set current compression algorithm.

Algorithms
#Z_NO_COMPRESSION : no compression (store)
#Z_DEFLATED : deflate algorithm
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Great work gnozal, as usual :)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Joining memory blocks into one ZIP file

Post by RichardL »

I need to create an entry in a ZIP archive that is the concatenation of two areas of memory plus a block of zeros.

When writing to a normal binary file the following code does the job:

Code: Select all

If CreateFile(1,SFile$)             ; Open the new file
  WriteData(*FileImage,*StartOfLOG) ; Always write the SPAD,TIF and TSDB areas
  WriteData(*A,*B-*A)               ; Write the specified range of data from the LOG
  For n.w=0 To 130                  ; Write a tailpiece to ensure correct decoding
    WriteLong(0)
  Next
  CloseFile(1)
  MessageRequester("D_Log","Saved <"+SFile$+">")
Else
  MessageRequester("D_Log","Could not save Log File")
EndIf
I have successfully used 'PureZIP_AddMemory()' to save a block of memory but am unsure how to acheive the same as the binary file example, as above.

It would be difficult to build a single image by copying/creating the three parts because one of them could be many hundreds of MBytes in size.

Any suggestions are most welcome.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: Joining memory blocks into one ZIP file

Post by gnozal »

RichardL wrote:I need to create an entry in a ZIP archive that is the concatenation of two areas of memory plus a block of zeros.
My suggestion :

First you need to create a new memory block, that is the concatenation of the two areas of memory plus a block of zeros.
Second, use PureZIP_AddMemory() or PureZIP_Archive_CompressMem() to add the new block to your ZIP file.

If you can't create a new block in memory (not enough memory?), create a new temporary file that is the the concatenation of the two areas of memory plus a block of zeros, then add this temp file to the ZIP file with PureZIP_AddFile() or PureZIP_Archive_Compress(), and finaly delete the temp file.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

Hi Gnozal,

I have already taken the second route you suggested, using the binary file as the intermediate file. On consideration it was the only way to go.

The project involves reading telemetry data from memory cards... last year the cards were 64MByte and I could read them all into memory without problems. This year 512M cards, up to half full. Next year up to 100% full and the year after we move to 1GB or 2GB cards.
Post Reply