Index: SCons/Config/gnu
--- ../release/nsis-2.17-src/SCons/Config/gnu	2006-04-28 08:54:41.000000000 -0700
+++ SCons/Config/gnu	2006-08-07 18:49:47.000000000 -0700
@@ -65,7 +65,7 @@
 cross_env(stub_env)
 
 if not defenv['DEBUG']:
-	stub_env.Append(CCFLAGS = '-Os')                # optimize for size
+	stub_env.Append(CCFLAGS = '-Os -fno-strict-aliasing')                # optimize for size
 stub_env.Append(CCFLAGS = '-Wall')                # all warnings
 stub_env.Append(CCFLAGS = '-x c')                 # force compile as c
 
@@ -82,8 +82,8 @@
 makensis_env = defenv.Copy()
 
 if not defenv['DEBUG']:
-	makensis_env.Append(CCFLAGS = '-O2')            # optimize
+	makensis_env.Append(CCFLAGS = '-O2 -fno-strict-aliasing')            # optimize
 makensis_env.Append(CCFLAGS = '-Wall')            # all warnings
 
 conf = FlagsConfigure(makensis_env)
 conf.CheckLinkFlag('$MAP_FLAG')                   # generate map file
@@ -97,7 +97,7 @@
 cross_env(plugin_env)
 
 if not defenv['DEBUG']:
-	plugin_env.Append(CCFLAGS = '-Os')              # optimize for size
+	plugin_env.Append(CCFLAGS = '-Os -fno-strict-aliasing')              # optimize for size
 plugin_env.Append(CCFLAGS = '-Wall')              # level 3 warnings
 
 if not defenv['DEBUG']:
@@ -111,7 +111,7 @@
 cp_util_env = defenv.Copy()
 
 if not defenv['DEBUG']:
-	cp_util_env.Append(CCFLAGS = '-O2')             # optimize
+	cp_util_env.Append(CCFLAGS = '-O2 -fno-strict-aliasing')             # optimize
 cp_util_env.Append(CCFLAGS = '-Wall')             # all warnings
 
 conf = FlagsConfigure(cp_util_env)
Index: Source/build.cpp
--- ../release/nsis-2.17-src/Source/build.cpp	2006-04-14 03:05:01.000000000 -0700
+++ ./Source/build.cpp	2006-07-31 13:26:38.000000000 -0700
@@ -2384,7 +2384,7 @@
         return PS_ERROR;
       }
 #ifdef NSIS_CONFIG_CRC_SUPPORT
-      crc_writer_sink crc_sink((unsigned long *) &crc);
+      crc_writer_sink crc_sink((unsigned int *) &crc);
       firstheader_writer w(&crc_sink);
       w.write(&fh);
 
Index: Source/build.h
--- ../release/nsis-2.17-src/Source/build.h	2005-04-02 04:04:06.000000000 -0800
+++ ./Source/build.h	2006-07-31 13:28:44.000000000 -0700
@@ -38,7 +38,7 @@
 #ifdef NSIS_CONFIG_CRC_SUPPORT
 extern "C"
 {
-  unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
+  unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len);
 };
 #endif
 
Index: Source/crc32.c
--- ../release/nsis-2.17-src/Source/crc32.c	2004-03-12 12:43:54.000000000 -0800
+++ ./Source/crc32.c	2006-07-31 13:27:12.000000000 -0700
@@ -3,18 +3,18 @@
 #ifdef NSIS_CONFIG_CRC_SUPPORT
 
 // this is based on the (slow,small) CRC32 implementation from zlib.
-unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len)
+unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len)
 {
-    static unsigned long crc_table[256];
+    static unsigned int crc_table[256];
 
     if (!crc_table[1])
     {
-      unsigned long c;
+      unsigned int c;
       int n, k;
 
       for (n = 0; n < 256; n++)
       {
-        c = (unsigned long)n;
+        c = (unsigned int)n;
         for (k = 0; k < 8; k++) c = (c >> 1) ^ (c & 1 ? 0xedb88320L : 0);
         crc_table[n] = c;
       }
Index: Source/DialogTemplate.cpp
--- ../release/nsis-2.17-src/Source/DialogTemplate.cpp	2006-03-24 10:36:24.000000000 -0800
+++ ./Source/DialogTemplate.cpp	2006-07-31 05:48:44.000000000 -0700
@@ -93,7 +93,7 @@
     if (IS_INTRESOURCE(x)) { \
       *(WORD*)seeker = 0xFFFF; \
       seeker += sizeof(WORD); \
-      *(WORD*)seeker = ConvertEndianness(WORD(DWORD(x))); \
+      *(WORD*)seeker = ConvertEndianness(WORD(ULONG_PTR(x))); \
       seeker += sizeof(WORD); \
     } \
     else { \
@@ -629,7 +629,7 @@
     }
   }
 
-  assert((DWORD) seeker - (DWORD) pbDlg == dwSize);
+  assert((ULONG_PTR) seeker - (ULONG_PTR) pbDlg == dwSize);
 
   // DONE!
   return pbDlg;
Index: Source/exehead/fileform.c
--- ../release/nsis-2.17-src/Source/exehead/fileform.c	2005-09-09 09:08:44.000000000 -0700
+++ ./Source/exehead/fileform.c	2006-07-31 13:26:08.000000000 -0700
@@ -95,7 +95,7 @@
 static z_stream g_inflate_stream;
 #endif
 
-extern unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
+extern unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len);
 
 const char * NSISCALL loadHeaders(int cl_flags)
 {
Index: Source/Platform.h
--- ../release/nsis-2.17-src/Source/Platform.h	2006-05-03 08:43:54.000000000 -0700
+++ ./Source/Platform.h	2006-07-31 05:48:44.000000000 -0700
@@ -16,15 +16,15 @@
 // basic types
 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
 typedef unsigned short WORD, *LPWORD;
-typedef unsigned long DWORD, *LPDWORD;
+typedef unsigned int DWORD, *LPDWORD;
 typedef short SHORT;
 typedef unsigned short USHORT;
 typedef unsigned int UINT;
 typedef unsigned int UINT32;
 typedef int INT;
 typedef int INT32;
-typedef long LONG;
-typedef unsigned long ULONG;
+typedef int LONG;
+typedef unsigned int ULONG;
 typedef long long INT64, LARGE_INTEGER;
 typedef unsigned long long UINT64, ULARGE_INTEGER;
 typedef int BOOL, *LPBOOL;
@@ -35,13 +35,14 @@
 typedef const char *LPCCH, *PCSTR, *LPCSTR;
 typedef unsigned short WCHAR, *PWCHAR, *LPWCH, *PWCH, *NWPSTR, *LPWSTR, *PWSTR;
 typedef const unsigned short *LPCWCH, *PCWCH, *LPCWSTR, *PCWSTR;
-typedef unsigned int UINT_PTR;
+typedef unsigned long UINT_PTR;
+typedef unsigned long ULONG_PTR;
 // basic stuff
 typedef void * HANDLE;
-typedef unsigned long HKEY;
+typedef unsigned int HKEY;
 // some gdi
-typedef unsigned long COLORREF;
-typedef unsigned long HBRUSH;
+typedef unsigned int COLORREF;
+typedef unsigned int HBRUSH;
 // bool
 #  define FALSE 0
 #  define TRUE 1
@@ -129,13 +130,13 @@
 
 #ifndef _WIN32
 #  ifndef FIELD_OFFSET
-#    define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f))
+#    define FIELD_OFFSET(t,f) ((ULONG_PTR)&(((t*)0)->f))
 #  endif
 #  ifndef MAKEINTRESOURCE
 #    define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))
 #  endif
 #  ifndef IMAGE_FIRST_SECTION
-#    define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (DWORD) h + \
+#    define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (ULONG_PTR) h + \
                                      FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader) + \
                                      FIX_ENDIAN_INT16(PIMAGE_NT_HEADERS(h)->FileHeader.SizeOfOptionalHeader) ) )
 #  endif
@@ -166,9 +167,9 @@
 #  define FOF_NOERRORUI 0x0400
 #endif
 
-#ifndef ULONG_PTR
-#  define ULONG_PTR DWORD
-#endif
+//#ifndef ULONG_PTR
+//#  define ULONG_PTR ULONG
+//#endif
 
 #ifndef IDC_HAND
 #  define IDC_HAND MAKEINTRESOURCE(32649)
Index: Source/Plugins.cpp
--- ../release/nsis-2.17-src/Source/Plugins.cpp	2006-04-05 11:42:12.000000000 -0700
+++ ./Source/Plugins.cpp	2006-07-31 06:50:08.000000000 -0700
@@ -120,8 +120,8 @@
         DWORD prd = FIX_ENDIAN_INT32(sections[i].PointerToRawData);
         PIMAGE_EXPORT_DIRECTORY exports = PIMAGE_EXPORT_DIRECTORY(&dlldata[0] + prd + ExportDirVA - va);
         DWORD na = FIX_ENDIAN_INT32(exports->AddressOfNames);
-        unsigned long *names = (unsigned long*)((unsigned long) exports + (char *) na - ExportDirVA);
-        for (unsigned long j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
+        unsigned int *names = (unsigned int*)((unsigned long) exports + (char *) na - ExportDirVA);
+        for (unsigned int j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
         {
           const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA);
           const string signature = dllName + "::" + name;
Index: Source/ResourceEditor.cpp
--- ../release/nsis-2.17-src/Source/ResourceEditor.cpp	2006-04-05 11:40:09.000000000 -0700
+++ ./Source/ResourceEditor.cpp	2006-07-31 05:48:44.000000000 -0700
@@ -545,7 +545,7 @@
     rdDir.NumberOfIdEntries = ConvertEndianness(rdDir.NumberOfIdEntries);
 
     CopyMemory(seeker, &rdDir, sizeof(IMAGE_RESOURCE_DIRECTORY));
-    crd->m_dwWrittenAt = DWORD(seeker);
+    crd->m_dwWrittenAt = ULONG_PTR(seeker);
     seeker += sizeof(IMAGE_RESOURCE_DIRECTORY);
 
     for (int i = 0; i < crd->CountEntries(); i++) {
@@ -566,7 +566,7 @@
       rDirE.NameString.NameIsString = (crd->GetEntry(i)->HasName()) ? 1 : 0;
 
       CopyMemory(seeker, &rDirE, sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY));
-      crd->GetEntry(i)->m_dwWrittenAt = DWORD(seeker);
+      crd->GetEntry(i)->m_dwWrittenAt = ULONG_PTR(seeker);
       seeker += sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY);
     }
     qDirs.pop();
@@ -582,7 +582,7 @@
     rDataE.Size = ConvertEndianness(cRDataE->GetSize());
 
     CopyMemory(seeker, &rDataE, sizeof(IMAGE_RESOURCE_DATA_ENTRY));
-    cRDataE->m_dwWrittenAt = DWORD(seeker);
+    cRDataE->m_dwWrittenAt = ULONG_PTR(seeker);
     seeker += sizeof(IMAGE_RESOURCE_DATA_ENTRY);
 
     qDataEntries.pop();
@@ -594,7 +594,7 @@
   while (!qStrings.empty()) {
     CResourceDirectoryEntry* cRDirE = qStrings.front();
 
-    PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(seeker) - DWORD(pbRsrcSec));
+    PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(ULONG_PTR(seeker) - ULONG_PTR(pbRsrcSec)));
 
     char* szName = cRDirE->GetName();
     WORD iLen = strlen(szName) + 1;
@@ -626,7 +626,7 @@
   while (!qDataEntries2.empty()) {
     CResourceDataEntry* cRDataE = qDataEntries2.front();
     CopyMemory(seeker, cRDataE->GetData(), cRDataE->GetSize());
-    PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(seeker - pbRsrcSec + m_dwResourceSectionVA);
+    PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(DWORD(seeker - pbRsrcSec + m_dwResourceSectionVA));
 
     seeker += RALIGN(cRDataE->GetSize(), 8);
 
@@ -636,7 +636,7 @@
   /*
    * Set all of the directory entries offsets.
    */
-  SetOffsets(m_cResDir, DWORD(pbRsrcSec));
+  SetOffsets(m_cResDir, ULONG_PTR(pbRsrcSec));
 }
 
 // Sets the offsets in directory entries
@@ -650,7 +650,7 @@
       SetOffsets(resDir->GetEntry(i)->GetSubDirectory(), newResDirAt);
     }
     else {
-      rde->OffsetToData = ConvertEndianness(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt);
+      rde->OffsetToData = ConvertEndianness(DWORD(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt));
     }
   }
 }
@@ -758,7 +758,7 @@
 // Returns -1 if can not be found
 int CResourceDirectory::Find(char* szName) {
   if (IS_INTRESOURCE(szName))
-    return Find((WORD) (DWORD) szName);
+    return Find((WORD) (ULONG_PTR) szName);
   else
     if (szName[0] == '#')
       return Find(WORD(atoi(szName + 1)));
@@ -836,7 +836,7 @@
   if (IS_INTRESOURCE(szName)) {
     m_bHasName = false;
     m_szName = 0;
-    m_wId = (WORD) (DWORD) szName;
+    m_wId = (WORD) (ULONG_PTR) szName;
   }
   else {
     m_bHasName = true;
@@ -851,7 +851,7 @@
   if (IS_INTRESOURCE(szName)) {
     m_bHasName = false;
     m_szName = 0;
-    m_wId = (WORD) (DWORD) szName;
+    m_wId = (WORD) (ULONG_PTR) szName;
   }
   else {
     m_bHasName = true;
Index: Source/ResourceEditor.h
--- ../release/nsis-2.17-src/Source/ResourceEditor.h	2006-04-28 08:54:42.000000000 -0700
+++ ./Source/ResourceEditor.h	2006-07-31 05:48:44.000000000 -0700
@@ -173,7 +173,7 @@
 
   void Destroy();
 
-  DWORD m_dwWrittenAt;
+  ULONG_PTR m_dwWrittenAt;
 
 private:
   IMAGE_RESOURCE_DIRECTORY m_rdDir;
@@ -197,7 +197,7 @@
 
   CResourceDataEntry* GetDataEntry();
 
-  DWORD m_dwWrittenAt;
+  ULONG_PTR m_dwWrittenAt;
 
 private:
   bool m_bHasName;
@@ -226,7 +226,7 @@
   DWORD GetSize();
   DWORD GetCodePage();
 
-  DWORD m_dwWrittenAt;
+  ULONG_PTR m_dwWrittenAt;
 
 private:
   BYTE* m_pbData;
Index: Source/script.cpp
--- ../release/nsis-2.17-src/Source/script.cpp	2006-03-28 10:22:34.000000000 -0800
+++ ./Source/script.cpp	2006-07-31 20:56:03.000000000 -0700
@@ -4748,8 +4748,8 @@
           {
             struct
             {
-              long l;
-              long h;
+              int l;
+              int h;
             } words;
             long long ll;
           };
@@ -6075,8 +6075,8 @@
         {
           struct
           {
-            long l;
-            long h;
+            int l;
+            int h;
           } words;
           long long ll;
         };
Index: Source/util.cpp
--- ../release/nsis-2.17-src/Source/util.cpp	2006-04-28 08:54:42.000000000 -0700
+++ ./Source/util.cpp	2006-07-31 05:48:44.000000000 -0700
@@ -312,7 +312,7 @@
   FIX_ENDIAN_INT32_INPLACE(rdEntry.OffsetToData);
   MY_ASSERT(!rdEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
 
-  PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot));
+  PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + ULONG_PTR(rdRoot));
 
   MY_ASSERT((size_t)rdIcons - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
 
@@ -325,7 +325,7 @@
     FIX_ENDIAN_INT32_INPLACE(icoEntry.OffsetToData);
 
     MY_ASSERT(!icoEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
-    PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot));
+    PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + ULONG_PTR(rdRoot));
     
     MY_ASSERT((size_t)rd - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
 
@@ -334,7 +334,7 @@
 
     MY_ASSERT(datEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
     
-    PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + DWORD(rdRoot));
+    PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + ULONG_PTR(rdRoot));
 
     MY_ASSERT((size_t)rde - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
 
@@ -355,10 +355,10 @@
     }
 
     // Set offset
-    DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + DWORD(rdRoot) - dwResourceSectionVA - DWORD(exeHeader);
+    DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + ULONG_PTR(rdRoot) - dwResourceSectionVA - ULONG_PTR(exeHeader);
     *(LPDWORD) seeker = FIX_ENDIAN_INT32(dwOffset);
 
-    MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (DWORD)rdRoot - (DWORD)exeHeader, "invalid data offset - icon resource probably compressed");
+    MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (ULONG_PTR)rdRoot - (ULONG_PTR)exeHeader, "invalid data offset - icon resource probably compressed");
   }
 
   LPBYTE seeker = uninstIconData;
Index: Source/writer.cpp
--- ../release/nsis-2.17-src/Source/writer.cpp	2006-03-11 03:13:07.000000000 -0800
+++ ./Source/writer.cpp	2006-07-31 13:27:37.000000000 -0700
@@ -64,7 +64,7 @@
 }
 
 #ifdef NSIS_CONFIG_CRC_SUPPORT
-extern "C" unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
+extern "C" unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len);
 
 void crc_writer_sink::write_data(const void *data, const size_t size)
 {
Index: Source/writer.h
--- ../release/nsis-2.17-src/Source/writer.h	2006-03-11 03:13:07.000000000 -0800
+++ ./Source/writer.h	2006-07-31 13:27:58.000000000 -0700
@@ -57,12 +57,12 @@
 #ifdef NSIS_CONFIG_CRC_SUPPORT
 class crc_writer_sink : public writer_sink {
 public:
-  crc_writer_sink(unsigned long *crc) : m_crc(crc) {}
+  crc_writer_sink(unsigned int *crc) : m_crc(crc) {}
 
   virtual void write_data(const void *data, const size_t size);
 
 private:
-  unsigned long *m_crc;
+  unsigned int *m_crc;
 
 };
 #endif
