PureZIP library : ZIP / UNZIP files
Moderator: gnozal
Hi, gnozal.
This is not working on my computer:
It creates a ZIP file but the file inside has the file size of 0. PureZip_Archive_Compress() returns -1. Am I doing something wrong?
[EDIT] Sorry I copy & pasted the wrong code.
This is not working on my computer:
Code: Select all
Procedure MSSQL_MakeBackup(dbName.s, destFolder.s)
Protected string.s, bckFile.s, zipFile.s
bckFile = GetTemporaryDirectory() + dbName + ".bck"
string = "BACKUP DATABASE " + dbName + " TO DISK = '" + bckFile + "' WITH INIT"
If Not DatabaseQuery(0, string)
MessageRequester("Error", "Error while creating backup!")
End
EndIf
zipFile = destFolder + "\" + dbName + ".zip"
If PureZIP_Archive_Create(zipFile, #APPEND_STATUS_CREATE)
PureZIP_Archive_Compress(bckFile, #False)
PureZIP_Archive_Close()
Else
MessageRequester("Error", "Error creating ZIP file!")
EndIf
If FileSize(bckFile) > -1
If DeleteFile(bckFile)
ProcedureReturn #True
EndIf
EndIf
EndProcedure
[EDIT] Sorry I copy & pasted the wrong code.

[EDIT] Hmm... I spent all Sunday trying to figure it out. It seems that PureZIP won't find the file I'm trying to compress even if it's there and it will add a zero bytes file. I've tried several ways of detecting what's wrong, tried to isolate the code, made all variables show in the debug output.
Still I can't make this file get into my ZIP file. Only if I add a break point and follow its execution step by step.
Please, help. Thanks a lot for the great tool.
[EDIT #2]
I found out what it is. DatabaseUpdate() returns 1 too soon while SQLServer engine is still creating the backup file. So when I'm adding the file into the ZIP file, the file is still incomplete leading to the error described. Sorry for assuming that it was a PureZIP problem. I was too quick on it because my time is a little scarse so I imagined lots of things.
Thank you for such a wonderful tool.
Still I can't make this file get into my ZIP file. Only if I add a break point and follow its execution step by step.
Please, help. Thanks a lot for the great tool.
[EDIT #2]
I found out what it is. DatabaseUpdate() returns 1 too soon while SQLServer engine is still creating the backup file. So when I'm adding the file into the ZIP file, the file is still incomplete leading to the error described. Sorry for assuming that it was a PureZIP problem. I was too quick on it because my time is a little scarse so I imagined lots of things.
Thank you for such a wonderful tool.
Hi gnozal
I have found a link error with PureZIP.
If you use the "UsePNGdecoder()" from PB and your PureZIP you cant compile the code and it shows this message:
"POLINK: error: Symbol '_inflate_copyright' is multiply defined ('PureZIP_LIB_1_UNICODE:inflatress.obj' and 'ImagePluginPNG:inflatress.obj')"
I think you must channge this in your lib or you ask FRED very friendly that he channge it in PB
regards,
Nico
[EDIT]
testing with pb 4.1b3 with vista home premium 32 bit
I have found a link error with PureZIP.
If you use the "UsePNGdecoder()" from PB and your PureZIP you cant compile the code and it shows this message:
"POLINK: error: Symbol '_inflate_copyright' is multiply defined ('PureZIP_LIB_1_UNICODE:inflatress.obj' and 'ImagePluginPNG:inflatress.obj')"
I think you must channge this in your lib or you ask FRED very friendly that he channge it in PB

regards,
Nico
[EDIT]
testing with pb 4.1b3 with vista home premium 32 bit
my live space
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
I don't know. Both PureZIP and the PNG codec use ZLIB, hence the warning I guess.nicolaus wrote:Aha, and wat i can do to fix this problem?DoubleDutch wrote:This is an old problem.
What you could do :
- use another image format / codec
- try some linker options, like FORCE:MULTIPLE
- ask Fred / Freak what to do

For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Hi!, first of all, congratulations on this very nice libray of yours! Great job!
I want to ask yuo something, is it possible to just use the UnpackMemory function? I mean, i just need to decompress some memory area on a program i am about to finish, but i think that, whenever i use that function, i am also including all the functions that exist in the library?.
I am basing my sentence because, so far, my program weights ~110kb, but after implementing the "PureZIP_UnpackMemory" it grows to ~134kb.
I know, the extra size nowadays have little importance, but, out of just curiosity, i would like to know some more about this case.
Without anything more to say, Regards and keep you up with the good work so far!
xgp
I want to ask yuo something, is it possible to just use the UnpackMemory function? I mean, i just need to decompress some memory area on a program i am about to finish, but i think that, whenever i use that function, i am also including all the functions that exist in the library?.
I am basing my sentence because, so far, my program weights ~110kb, but after implementing the "PureZIP_UnpackMemory" it grows to ~134kb.
I know, the extra size nowadays have little importance, but, out of just curiosity, i would like to know some more about this case.
Without anything more to say, Regards and keep you up with the good work so far!
xgp
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
If you don't need the ZIP functions, try using the zlib static library directly (available on zlib site for example).xgp wrote:I want to ask yuo something, is it possible to just use the UnpackMemory function? I mean, i just need to decompress some memory area on a program i am about to finish, but i think that, whenever i use that function, i am also including all the functions that exist in the library?.
Code: Select all
Import "zlib.lib"
ZLIBCompress(*DestBuffer, *DestBufferLen, *SourceBuffer, SourceBufferLen.l) As "_compress@16"
ZLIBUnCompress(*DestBuffer, *DestBufferLen, *SourceBuffer, SourceBufferLen.l) As "_uncompress@16"
EndImport
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Well, then it seems like PB links all the static library, and not only the necessary functions.xgp wrote:Wow, quick response!
I've tested, but i am afraid the size grows the same!
Maybe if you extract the .obj files (POLIB /EXPLODE ZLIB.LIB) from the .lib and then try to import the .obj files (compress.obj + uncompr.obj + ...?), it would work ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Possibly i am doing something wrong, but at the end, i got the pretty much the size as if i were importing the whole .lib. I guess then, there's nothing to do against it.gnozal wrote:Well, then it seems like PB links all the static library, and not only the necessary functions.
Maybe if you extract the .obj files (POLIB /EXPLODE ZLIB.LIB) from the .lib and then try to import the .obj files (compress.obj + uncompr.obj + ...?), it would work ?
Here's how i've done:
Code: Select all
POLIB /EXPLODE zlibstat.lib
Code: Select all
Import "inflate.obj"
EndImport
Import "inftrees.obj"
EndImport
Import "adler32.obj"
EndImport
Import "crc32.obj"
EndImport
Import "zutil.obj"
EndImport
Import "inffas32.obj"
EndImport
Import "uncompr.obj"
ZLIBUnCompress(*DestBuffer, *DestBufferLen, *SourceBuffer, SourceBufferLen.l) As "_uncompress@16"
EndImport
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Probably not.xgp wrote:Possibly i am doing something wrong, but at the end, i got the pretty much the size as if i were importing the whole .lib. I guess then, there's nothing to do against it.
There is one thing though : if you know C, I guess you could try to create a new library by compiling only the compress / uncompress sources.
No, seems good to me.xgp wrote:I am doing something wrong? I am uncertain about this because this was the first time i played with import and .lib or .obj files.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
hi gnozal
take a look here please!http://www.purebasic.fr/french/viewtopic.php?t=7167
take a look here please!http://www.purebasic.fr/french/viewtopic.php?t=7167