fixed bug #1504758 - CRC32 implementation use potentially non-32bit types

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4697 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2006-06-16 14:12:04 +00:00
parent 618331287c
commit 3e561714e4
7 changed files with 38 additions and 30 deletions

View file

@ -6,6 +6,7 @@
#include "lang.h"
#include "ui.h"
#include "exec.h"
#include "../crc32.h"
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
#ifdef NSIS_COMPRESS_USE_ZLIB
@ -95,8 +96,6 @@ BOOL CALLBACK verProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static z_stream g_inflate_stream;
#endif
extern unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
const char * NSISCALL loadHeaders(int cl_flags)
{
#ifdef NSIS_CONFIG_CRC_SUPPORT
@ -104,7 +103,7 @@ const char * NSISCALL loadHeaders(int cl_flags)
HWND hwnd = 0;
unsigned int verify_time = GetTickCount() + 1000;
#endif
int crc = 0;
crc32_t crc = 0;
int do_crc = 0;
#endif//NSIS_CONFIG_CRC_SUPPORT
int left;
@ -230,9 +229,9 @@ const char * NSISCALL loadHeaders(int cl_flags)
#ifdef NSIS_CONFIG_CRC_SUPPORT
if (do_crc)
{
int fcrc;
crc32_t fcrc;
SetSelfFilePointer(m_pos);
if (!ReadSelfFile(&fcrc, sizeof(int)) || crc != fcrc)
if (!ReadSelfFile(&fcrc, sizeof(crc32_t)) || crc != fcrc)
return _LANG_INVALIDCRC;
}
#endif//NSIS_CONFIG_CRC_SUPPORT
@ -251,7 +250,7 @@ const char * NSISCALL loadHeaders(int cl_flags)
}
dbd_srcpos = SetSelfFilePointer(g_filehdrsize + sizeof(firstheader));
#ifdef NSIS_CONFIG_CRC_SUPPORT
dbd_fulllen = dbd_srcpos - sizeof(h) + h.length_of_all_following_data - ((h.flags & FH_FLAGS_NO_CRC) ? 0 : sizeof(int));
dbd_fulllen = dbd_srcpos - sizeof(h) + h.length_of_all_following_data - ((h.flags & FH_FLAGS_NO_CRC) ? 0 : sizeof(crc32_t));
#else
dbd_fulllen = dbd_srcpos - sizeof(h) + h.length_of_all_following_data;
#endif//NSIS_CONFIG_CRC_SUPPORT