|
thanks for the compliments iramon,
it's possible though that you do not have the latest code since once the articles get edited it's a pain to update the code.
however, if you grab this code you should have the latest
.dan.g.
AbstractSpoon (subscribe)
|
|
|
|
|
Sir,
I am trying to collect ZLib.lib and all the source files of the Gilles Vollant's code to form "Regular DLL using shared MFC DLL".
For that I have included #include "StdAfx.h" directive in all ".c" files.
But on compilation I get the following error, one for each ".c" file-
"fatal error C1853: 'Debug/filename.pch' is not a precompiled header file created with this compiler"
Kindly help me out of this problem. I'll be really grateful to you.
Regards
Gaurav
Gaurav Gumber
|
|
|
|
|
sorry for the delay, gaurav
usually this means you need to perform a 'rebuild all'.
however since typically .c files do not use precompiled headers, the best thing to do is to remove the 'stdafx.h' from the .c files and in 'project -> settings -> c/c++ -> precompiled headers' mark all the .c files as not using precompiled headers.
let me know how it goes.
regards
dang!
AbstractSpoon (subscribe)
|
|
|
|
|
Hello Sir,
Thanks for being so generous and replying back to my query. I tried all the options told by you.
I started a new Dll project and selected "Regular DLL using shared MFC DLL". I then included all the .c and .h files of Gilles Vollant's code and marked all .c files as not using precompiled headers. And I also gave the path of ZLib library in project->settings->link->Library for all configurations.
The project got compiled successfully.
I then included the dll file that I got in the zip application that I am building. On selecting rebuild all I got the following error:
Fatal error - LNK1136:invalid or corrupt file
However the application runs successfully if in place I give the path of ZLIbStat.lib library built by you.
Kindly help me out.
Regards
Gaurav
Gaurav Gumber
|
|
|
|
|
Hello,
do you guys know how MiniZip does it's job internally?
When compressing, does it buffer uncompressed data in memory until certain size is reached, then compress and write? How often does it do it?
when uncompressing, does it read the whole File inside the zip at once, then let the client ask for X number of bytes at a time?
Thanks,
Julio
|
|
|
|
|
sorry, i was only interested in wrapping it.
however, try contacting giles directly (his email address is in the article) as he was helpful when i contacted him.
regards
DanG
|
|
|
|
|
I'm trying to convert the wrapper to straight C. Or at least get whats needed so that I can use this in my project. What files do I need to get rid of all the MFC stuff? I managled it up to where I could give it file paths to unzip. But I'm working with Win32 and straight C.
|
|
|
|
|
the wrapper class (CUnzipper) is pure win32 c++ (ie no MFC).
the inclusion of stdafx.h (which is a MFC thing) is purely to allow for the use of LPCTSTR, BOOL and such like.
if you remove stdafx.h then you will need to either replace it with a reference to windows.h (i think) or simply replace LPCTSTR with const char* and BOOL with bool , etc.
regards
DanG
|
|
|
|
|
So to use your wrapper I need unzipper.cpp, unzipper.h, the assorted *zip.h, and your two libraries?
|
|
|
|
|
yes.
but if you have any problems just mail me.
regards
DanG
|
|
|
|
|
After I figured out I needed to change my main module from a .c file to a .cpp file I got it to compile and unzip a file. This is very nice, thank you for taking the time to do this. There is just no step by step tutorials on how zLib works. But I've been able to figure out what I need with your wrapper. Thanks again.
|
|
|
|
|
great.
i'm glad it all worked out.
regards
DanG
|
|
|
|
|
I am just wondering where did you get 20480 from?
|
|
|
|
|
i've absolutely no idea.
it must have seemed like a good number at the time
i think the code is written in such a way that you can modify it to any value you want.
regards
DanG
|
|
|
|
|
I love this class, great work!! You saved me a ton of time. I was wondering if anyone had written a Zipper class to do the zipping side of things?
Thanks,
Tyler
|
|
|
|
|
unfortunately i didn't have a need for the zipper half else i would have done it too.
regards and thanks
DanG
|
|
|
|
|
#### DEBUG
project->settings->link->input->ignore libraries
libcd.lib
#### RELEASE
project->settings->link->input->ignore libraries
libc.lib
That should get rid of the warning
as seen here -> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/LNK4098.asp
also the release and debug .lib file sizes are out of sync with the newer ones on the http://www.winimage.com/zLibDl page
you can download the project to re-batch build the libs used in the Zlib folder of this project here->
http://www.winimage.com/zLibDll/buildzlib114dll.zip
hey
|
|
|
|
|
In looking at your source code, the very first thing I noticed in Unzipper.cpp was this:
char* p = strrchr(szPath, '.'); It's nice to see that you are using strrchr instead of strchr. Frequently people make the mistake of not doing that.
It's also nice to see you've provided an interface which returns boolean values for methods. Classes which don't do that are one of my pet peeves, and it looks like you did a pretty good job of making sure the correct value is returned.
Haven't ran your code yet, but all-in-all looks like a pretty good job.
|
|
|
|
|
to be honest, i felt a touch uncomfortable not being able to use MFC which is my prime experience, so your comments are highly appreciated.
regarding the function returns, in the time i've been designing and coding, i've found that my code reads far more clearly if i can equate function calls to TRUE or FALSE so that's the way i code.
however, it may be helpful to call SetLastError() inetrnally so that users can call GetLastError() to get more information about the exact reason a function failed.
regards
|
|
|
|
|
|
Uwe Keim wrote:
Exceptions, use Exceptions for errors, no return values!
Ahh, the plague of Win32 . Sometimes one is better off without exceptions everywhere.
I don't think this is a serious possesion, and the evil most likely comes from your hand. Colin J Davies, The Lounge
|
|
|
|
|
even better would be to use it as
LPTSTR p = _tcsrchr(szPath, _T('.'));
or even use
LPTSTR p = ::PathFindExtension(szPath);
Personally, I think its odd to use the strXxx functions for filename/path handling.
I don't think this is a serious possesion, and the evil most likely comes from your hand. Colin J Davies, The Lounge
|
|
|
|
|
Hi,
PathFindExtension is one of the many new functions provides by Internet Explorer and is not supported on Win95 or WinNT without IE 4.
So - I prefer to use _splitpath or _wsplitpath because it handles everything and it's in the crt from VC and therfore available on every windows version (including Win95 without IE)
Ciao Matthias
|
|
|
|
|
Matthias Mann wrote:
...and is not supported on Win95 or WinNT without IE 4.
True, but how many systems are there without at least IE4 ?? Its even from a commercial point ignorable (they are not even supported anymore).
The downside of splitpath is the poor support for any non-strict DOS path/filename e.g.: \\server\share\file.whateverextension or \\.\myfile
The PathXxx functions handle these nicely.
I don't think this is a serious possesion, and the evil most likely comes from your hand. Colin J Davies, The Lounge
|
|
|
|
|
Good Job, it worked at first time.
however a small problem:
Under MSVC6, each time i want to run, it ask for building all the files,
both in Debug and Release Mode
|
|
|
|