|
This worked great, but now I have to use VB for a project that needs zip functionality... I'm spoiled by the simplicity of this. Anyone have any suggestions for something similar for VB?
Thanks in advance.
|
|
|
|
|
Hello,
I try to run my own Unzip example. But I get the following error when I compile my source.
Error:
Compiling...
xZipOwnTest.cpp
....\XUnzip.h(91) : error C2065: 'HZIP' : undeclared identifier
The source
<br />
#include windows.h<br />
#include "stdafx.h"<br />
#include "XUnzip.h"<br />
<br />
using namespace System;<br />
<br />
int main(array<System::String ^> ^args)<br />
{<br />
Console::WriteLine(L"bla");<br />
return 0;<br />
}
I included windows.h. What could be the problem? Thanks for your help.
maus
|
|
|
|
|
I found a problem using your code zipping and unzipping an archive results in a time shift of 1 hour for the modified date/time, this is UTC + 1 the time zone I'am in.
When I unzip a compressed file which is created with MS. option 'Send to compressed file..' I even have a two hour shift, this is day-light saving time.
I realy like to use your code but this will be a problem ??
|
|
|
|
|
I had the exact same issue. What I did was modify the source code at about line 3956.
***** Begin Original Code *****
FILETIME ft;
DosDateTimeToFileTime(dosdate,dostime,&ft);
***** End Original Code *****
***** Begin New Code *****
FILETIME lt, ft;
DosDateTimeToFileTime(dosdate,dostime,<);
LocalFileTimeToFileTime(<,&ft);
***** End New Code *****
Hope that helps. There's a major oversight in Windows with displaying local file times while handling Daylight Saving Time shifts.
|
|
|
|
|
Great work man!
It would be great if XUnzip was also able to unpack Zip files split in multi-volume files like ZipFile.Zip, ZipFile.z01....
|
|
|
|
|
First of all i´d like to thank you for your excellent work.
It would be great to have the ability to append files to an existing zip file, or update the content of the zip file.
THX
Jobe
|
|
|
|
|
|
MadMalcolmX wrote: Beware of any free utility, like this one, that contains strings cast to void pointers.
When trying to understand why it doesn't create recursed subdirectories in a zip file (it fails to create the target subdirectory, and gets a CreateFile error instead), I noted beauties like TCHAR comparisons using the equals key (XUnzip.cpp, line 4087).
// if it's a relative filename, ensure directories. We do this as a service
// to the caller so they can just unzip straight unto ze.name.
if (name != (const TCHAR *)dst)
Why bother w/a hard-to-understand function like _tcscmp? Imagine what else lurks inside these 4,000+ lines of code.
Back to the drawing board.
- Disappointed
To be honest, at first I thought your post was a joke, because I sometimes do not get the humor that people post here at CP. But then I got some emails asking me why I do not respond, and I say, Why should I? The poster was joking, right? But then I understood that your post was not a joke, so I apologize for taking so long to answer.
First, you are correct - there is a bug in v1.1 that prevents recursed directories from being created. I hope I have fixed this, and I will upload a new version soon.
Second, your question about the code
if (name != (const TCHAR *)dst)
is understandable. Here is the context that this line comes from:
const TCHAR *name = (const TCHAR *)dst;
const TCHAR *c = name;
while (*c)
{
if (*c == _T('/') || *c == _T('\\'))
name = c + 1;
c++;
}
<font color=red>if (name != (const TCHAR *)dst)</font>
{
TCHAR dir[MAX_PATH];
_tcscpy(dir,(const TCHAR*)dst);
dir[name-(const TCHAR*)dst-1] = _T('\0');
...
There is nothing fancy about this code. It is representative of a style of programming that was prevalent among C programmers - lots of character pointers, character arithmetic, etc. - all very foreign to many C++ programmers.
Here is what the programmer is trying to do: he wants to check if there are any directory paths in the file name. He does this by checking for backslashes and forward slashes. If any are found, the character pointer is incremented, and so when the program gets to the line you ask about, the programmer really is trying to compare two character pointers, and not trying to do a string compare as you suggest.
Again, I'm sorry it took me so long to realize your intent. May I suggest that in the future, you could ask questions in a more reasonable way? You will almost certainly avoid misunderstandings and receive faster answers that way.
|
|
|
|
|
Hans Dietrich wrote: if (*c == _T('/') || *c == _T('\\'))
Which is really bad for internationalization (will do the wrong thing for Japanese, where backslash can be the second half of a double-byte character).
In general, the TCHAR manipulation in this sources is quite bad, and I strongly doubt that it can be compiled as Unicode (which is the only role of TCHAR, _tcscpy, and such).
This does not make it "Execrable," but there is a real need for a cleanup.
|
|
|
|
|
I'm pretty sure these issues were inherited from the original code, which is pretty ghastly from a C++ perspective (as a quick lint and cyclomatic complexity analysis will confirm).
Given that, it's a case of "buyer beware" followed by "refactor with care" as with any third party code.
Personally I now cringe when I see any C++ code which isn't const correct or which uses C style casts, but judging from what I've seen in other developers' work I've encountered that's just me.
|
|
|
|
|
Mr Dietrich's efforts are quite worthy.
Your comments are somewhat less.
Presenting code that works under the conditions specified (dev env, operating system, hardware, etc.) is the only true necessary requirement of all programmers.
One can spend endless hours conforming or, for that matter, taking code from others and making that code conform, and still end up with the same executable. Programming is not about the code, it is about the functionality. We are not special because we write to some spec despite what your professors taught you. Your disappointment, we suspect, is really about unoffered functionality (sub-directories).
Are we talking about limitations within code or limitations within coders to understand?
Dave Harris
|
|
|
|
|
Is it possible to create a zip file with CreateZip and then at a later time use OpenZip and AddZip to append files to it? Every time I try I get a ZR_ZMODE return code and a message about trying to mix creating and opening.
Greg Smith
|
|
|
|
|
The macro PUTSHORT doesnt check for a failure in flush_outbuf where state.bs.out_offset will not be reset to zero. I got a crash in "state.bs.out_buf[state.bs.out_offset++]" then. I changed the code that way:
#define PUTSHORT(state,w) \<br />
{ if (state.bs.out_offset >= state.bs.out_size-1) \<br />
state.flush_outbuf(state.param,state.bs.out_buf, &state.bs.out_offset); \<br />
if (state.bs.out_offset < state.bs.out_size-1) \<br />
{ state.bs.out_buf[state.bs.out_offset++] = (char) ((w) & 0xff); \<br />
state.bs.out_buf[state.bs.out_offset++] = (char) ((ush)(w) >> 8); }\<br />
}
You might change that in PUTBYTE as well.
If the memory size assigned to CreateZip is to small for the file, there is no check/reallocation of memory. I changed the function TZip::write to get over this.
<br />
unsigned int TZip::write(const char *buf,unsigned int size)<br />
{ if (obuf!=0)<br />
{ if (opos+size>=mapsize)<br />
{<br />
int newmapsize=2*mapsize>opos+size?2*mapsize:opos+size;<br />
HANDLE hmapout2 = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,newmapsize,NULL);<br />
if (hmapout2==NULL) <br />
return ZR_NOALLOC;<br />
char *obuf2;
<br />
obuf2 = (char*)MapViewOfFile(hmapout2,FILE_MAP_ALL_ACCESS,0,0,newmapsize);<br />
if (obuf2==0) <br />
{<br />
CloseHandle(hmapout2); <br />
hmapout2=0; <br />
return ZR_NOALLOC;<br />
}<br />
<br />
memcpy(obuf2,obuf,mapsize);<br />
<br />
UnmapViewOfFile(obuf);<br />
CloseHandle(hmapout); <br />
<br />
mapsize=newmapsize;<br />
obuf = obuf2;<br />
hmapout = hmapout2;<br />
}<br />
memcpy(obuf+opos, buf, size);<br />
opos+=size;<br />
return size;<br />
}<br />
else if (hfout!=0)<br />
{ DWORD writ; WriteFile(hfout,buf,size,&writ,NULL);<br />
return writ;<br />
}<br />
oerr=ZR_NOTINITED; return 0;<br />
}
Thanks for your good work.
Thomas
|
|
|
|
|
i like it don't depend MFC.
it help me, thank you very much.
|
|
|
|
|
If I extract a file from a zip file and then try to delete the extracted file later within the same instance of the application that performed the unzip operation, DeleteFile fails with the message "The process cannot access the file because it is being used by another process."
I messed around with trying unzClose at the end of TUnzip::Unzip, but that didn't work. I'm probably going down the wrong path with that approach though. The message about extracted files being read-only might shed some light on this problem but I havn't looked too far yet.
Any thoughts on this?
|
|
|
|
|
Cheers! )
And thank you again.
Mike
|
|
|
|
|
Hello.
For some reason, when I try to use a for loop to list the files in my zip, it keeps showing the first one during each iteration. After some debugging, I discovered that the value of my ze.index is apparently not changing when I call the GetZipItem function inside the loop. The problematic portion of my code is as follows:
<br />
HZIP hz = OpenZip(fileNameCChar,0,ZIP_FILENAME);<br />
ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;<br />
<br />
printf("Items in file: %i\n", numitems);
<br />
for (int i = 0; i < numitems; i++)<br />
{<br />
GetZipItem(hz,i,&ze);
<br />
printf("%d: %s\n", i, ze.name);
<br />
printf("ze.index: %i\n", ze.index);
}<br />
When I run this code, the name of the first file contained in the zip keeps repeating itself, and the value of ze.index is always zero (0).
Correct me if I'm wrong, but shouldn't the value of ze.index equal i when you call the GetZipItem using i as the second parameter? Is my logic is flawed in some way? This has been troubling me for about a day now. I appreciate any help.
-- modified at 10:53 Wednesday 21st March, 2007
|
|
|
|
|
Well, after a little more persistence, I fixed it myself. In my case, it works a lot better to increment the ze.index, rather than i.within the for loop. I’m not entirely sure why this is, but it works. And that’s good enough for me. If I find anything else out about it, I’ll be sure to make mention of it here.
<br />
HZIP hz = OpenZip(fileNameCChar,0,ZIP_FILENAME);<br />
ZIPENTRY ze;<br />
GetZipItem(hz,-1,&ze);<br />
int numitems=ze.index;<br />
<br />
for (ze.index = 0; ze.index < numitems; ze.index++)<br />
{<br />
GetZipItem(hz,ze.index,&ze<br />
char *ibuf = new char[ze.unc_size];<br />
UnzipItem(hz,ze.index, ibuf, ze.unc_size,ZIP_MEMORY);<br />
}<br />
Thanks!
|
|
|
|
|
Hello,
I get the following warnings/errors compiling with Visual Studio 2005.
------ Build started: Project: XZipTest, Configuration: Unicode Debug Win32 ------
Compiling...
StdAfx.cpp
WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
Compiling...
About.cpp
Clipboard.cpp
d:\devtemp\xzip_demo\clipboard.cpp(241) : warning C4996: 'wcscpy': This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\string.h(252) : see declaration of 'wcscpy'
HyperLink.cpp
d:\devtemp\xzip_demo\hyperlink.cpp(392) : warning C4996: 'wcscat': This function or variable may be unsafe. Consider using wcscat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\string.h(245) : see declaration of 'wcscat'
d:\devtemp\xzip_demo\hyperlink.cpp(393) : warning C4996: 'wcscat': This function or variable may be unsafe. Consider using wcscat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\string.h(245) : see declaration of 'wcscat'
XListBox.cpp
d:\devtemp\xzip_demo\xlistbox.cpp(483) : warning C4996: '_swprintf': This function or variable may be unsafe. Consider using _swprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\wchar.h(773) : see declaration of '_swprintf'
d:\devtemp\xzip_demo\xlistbox.cpp(486) : warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\string.h(272) : see declaration of 'wcsncpy'
d:\devtemp\xzip_demo\xlistbox.cpp(491) : warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\string.h(272) : see declaration of 'wcsncpy'
d:\devtemp\xzip_demo\xlistbox.cpp(497) : warning C4996: '_vsnwprintf': This function or variable may be unsafe. Consider using _vsnwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\wchar.h(719) : see declaration of '_vsnwprintf'
XZipTest.cpp
d:\devtemp\xzip_demo\xziptest.cpp(41) : warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed. You should remove this call.
c:\programme\microsoft visual studio 8\vc\atlmfc\include\afxwin.h(4477) : see declaration of 'CWinApp::Enable3dControls'
XZipTestDlg.cpp
d:\devtemp\xzip_demo\xziptestdlg.cpp(353) : error C2440: 'initializing' : cannot convert from 'const wchar_t *' to 'TCHAR *'
Conversion loses qualifiers
Generating Code...
XZipTest - 1 error(s), 8 warning(s)
------ Build started: Project: XZipTest, Configuration: Debug Win32 ------
Compiling...
StdAfx.cpp
WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
Compiling...
About.cpp
Clipboard.cpp
d:\devtemp\xzip_demo\clipboard.cpp(241) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\string.h(74) : see declaration of 'strcpy'
HyperLink.cpp
d:\devtemp\xzip_demo\hyperlink.cpp(392) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\string.h(79) : see declaration of 'strcat'
d:\devtemp\xzip_demo\hyperlink.cpp(393) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\string.h(79) : see declaration of 'strcat'
XListBox.cpp
d:\devtemp\xzip_demo\xlistbox.cpp(483) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\stdio.h(345) : see declaration of 'sprintf'
d:\devtemp\xzip_demo\xlistbox.cpp(486) : warning C4996: '_tcsncpy': This function or variable may be unsafe. Consider using _tcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\tchar.h(1518) : see declaration of '_tcsncpy'
d:\devtemp\xzip_demo\xlistbox.cpp(491) : warning C4996: '_tcsncpy': This function or variable may be unsafe. Consider using _tcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\tchar.h(1518) : see declaration of '_tcsncpy'
d:\devtemp\xzip_demo\xlistbox.cpp(497) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\programme\microsoft visual studio 8\vc\include\stdio.h(339) : see declaration of '_vsnprintf'
XZipTest.cpp
d:\devtemp\xzip_demo\xziptest.cpp(41) : warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed. You should remove this call.
c:\programme\microsoft visual studio 8\vc\atlmfc\include\afxwin.h(4477) : see declaration of 'CWinApp::Enable3dControls'
XZipTestDlg.cpp
d:\devtemp\xzip_demo\xziptestdlg.cpp(353) : error C2440: 'initializing' : cannot convert from 'const char *' to 'TCHAR *'
Conversion loses qualifiers
Generating Code...
XZipTest - 1 error(s), 8 warning(s)
------ Build started: Project: XZipTest, Configuration: Release Win32 ------
Compiling...
StdAfx.cpp
WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
Compiling...
XZipTestDlg.cpp
.\XZipTestDlg.cpp(353) : error C2440: 'initializing' : cannot convert from 'const char *' to 'TCHAR *'
Conversion loses qualifiers
.\XZipTestDlg.cpp(426) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(74) : see declaration of 'strcpy'
.\XZipTestDlg.cpp(427) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(79) : see declaration of 'strcat'
XZipTest.cpp
.\XZipTest.cpp(41) : warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed. You should remove this call.
C:\Programme\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin.h(4477) : see declaration of 'CWinApp::Enable3dControls'
XListBox.cpp
.\XListBox.cpp(483) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\stdio.h(345) : see declaration of 'sprintf'
.\XListBox.cpp(486) : warning C4996: '_tcsncpy': This function or variable may be unsafe. Consider using _tcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\tchar.h(1518) : see declaration of '_tcsncpy'
.\XListBox.cpp(491) : warning C4996: '_tcsncpy': This function or variable may be unsafe. Consider using _tcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\tchar.h(1518) : see declaration of '_tcsncpy'
.\XListBox.cpp(497) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\stdio.h(339) : see declaration of '_vsnprintf'
HyperLink.cpp
.\HyperLink.cpp(392) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(79) : see declaration of 'strcat'
.\HyperLink.cpp(393) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(79) : see declaration of 'strcat'
Clipboard.cpp
.\Clipboard.cpp(241) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(74) : see declaration of 'strcpy'
About.cpp
Generating Code...
XZipTest - 1 error(s), 10 warning(s)
------ Build started: Project: XZipTest, Configuration: Unicode Release Win32 ------
Compiling...
StdAfx.cpp
WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
Compiling...
XZipTestDlg.cpp
.\XZipTestDlg.cpp(353) : error C2440: 'initializing' : cannot convert from 'const char *' to 'TCHAR *'
Conversion loses qualifiers
.\XZipTestDlg.cpp(426) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(74) : see declaration of 'strcpy'
.\XZipTestDlg.cpp(427) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(79) : see declaration of 'strcat'
XZipTest.cpp
.\XZipTest.cpp(41) : warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed. You should remove this call.
C:\Programme\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin.h(4477) : see declaration of 'CWinApp::Enable3dControls'
XListBox.cpp
.\XListBox.cpp(483) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\stdio.h(345) : see declaration of 'sprintf'
.\XListBox.cpp(486) : warning C4996: '_tcsncpy': This function or variable may be unsafe. Consider using _tcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\tchar.h(1518) : see declaration of '_tcsncpy'
.\XListBox.cpp(491) : warning C4996: '_tcsncpy': This function or variable may be unsafe. Consider using _tcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\tchar.h(1518) : see declaration of '_tcsncpy'
.\XListBox.cpp(497) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\stdio.h(339) : see declaration of '_vsnprintf'
HyperLink.cpp
.\HyperLink.cpp(392) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(79) : see declaration of 'strcat'
.\HyperLink.cpp(393) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(79) : see declaration of 'strcat'
Clipboard.cpp
.\Clipboard.cpp(241) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(74) : see declaration of 'strcpy'
About.cpp
Generating Code...
XZipTest - 1 error(s), 10 warning(s)
========== Build: 0 succeeded, 4 failed, 0 up-to-date, 0 skipped ==========
Andreas.
|
|
|
|
|
These warnings are occurring because VS2005 deprecated all the C runtime library functions that potentially overflowed their buffers. You can find detailed explanation of this in the VS2005 docs, along with a preprocessor symbol to set which disables the warnings.
|
|
|
|
|
No, only the warnings are about deprecation.
This does not explain the errors, which are caused by the missuse of TCHAR & Co.
Note the fact that the build is Unicode:
------ Build started: Project: XZipTest, Configuration: Unicode Release Win32 ------
And now the error:
.\XZipTestDlg.cpp(353) : error C2440: 'initializing' : cannot convert from 'const char *' to 'TCHAR *'
And nobody can tell how many such errors are masked by crappy casts.
Good coding discipline (like avoiding casts) is not just pedantry.
|
|
|
|
|
Hello,
I have posted this to show the autor that there is a problem with VS2005. I know that I could set _CRT_SECURE_NO_WARNINGS in the project.
Andreas.
|
|
|
|
|
I use C++Builder 3.0 and include the XUnzip.h as header file then got the following error when compiling, please help
[LinkerError] Unresolved external 'OpenZipU(void*,unsigned int,unsigned long)' referenced from G:\Test\testing.OBJ.
Thank you
|
|
|
|
|
I face the same problem and found the following is the cause
DECLARE_HANDLE(HZIP); // An HZIP identifies a zip file that is being created
where HZIP is not defined as void *.
Comment out the
#define STRICT in XUnzip.h will help.
|
|
|
|
|
If I intentionally patch the zip file to corrupt one or two of the compressed files in the archive, XUnzip creates corrupted files - not good!
zr = GetZipItem(hz, i, &ze); // always returns ZR_OK
zr = UnzipItem(hz, i, (void*)(LPCTSTR)ze.name, 0, ZIP_FILENAME); // always returns ZR_OK
If I use WinZip or WinRar they both do not extract the file(s) but complain about a CRC error and corrupted file.
Does anyone know of a fix, or am I overlooking something?
|
|
|
|
|