Package: nsis
Version: 2.06-1
Severity: normal
Tags: patch

When building 'nsis' on amd64/unstable with gcc-4.0,
I get the following error:

g++ -Wall -O3 -DCOMPRESS_MF_BT -c DialogTemplate.cpp -o 
../build/DialogTemplate.o
DialogTemplate.cpp: In member function 'void CDialogTemplate::ConvertToRTL()':
DialogTemplate.cpp:440: error: cast from 'char*' to 'int' loses precision
DialogTemplate.cpp:454: error: cast from 'char*' to 'int' loses precision
DialogTemplate.cpp:460: error: cast from 'char*' to 'int' loses precision
make[1]: *** [../build/DialogTemplate.o] Error 1
make[1]: Leaving directory `/nsis-2.06/Source'
make: *** [build] Error 2

With the attached patch 'nsis' can be compiled
on amd64 using gcc-4.0.

Regards
Andreas Jochens

diff -urN ../tmp-orig/nsis-2.06/Source/DialogTemplate.cpp 
./Source/DialogTemplate.cpp
--- ../tmp-orig/nsis-2.06/Source/DialogTemplate.cpp     2005-03-10 
19:53:34.000000000 +0100
+++ ./Source/DialogTemplate.cpp 2005-04-08 10:54:38.706395168 +0200
@@ -437,7 +437,7 @@
     bool addExStyle = false;
 
     // Button
-    if (int(m_vItems[i]->szClass) == 0x80) {
+    if (long(m_vItems[i]->szClass) == 0x80) {
       m_vItems[i]->dwStyle ^= BS_LEFTTEXT;
       m_vItems[i]->dwStyle ^= BS_RIGHT;
       m_vItems[i]->dwStyle ^= BS_LEFT;
@@ -451,13 +451,13 @@
       }
     }
     // Edit
-    else if (int(m_vItems[i]->szClass) == 0x81) {
+    else if (long(m_vItems[i]->szClass) == 0x81) {
       if ((m_vItems[i]->dwStyle & ES_CENTER) == 0) {
         m_vItems[i]->dwStyle ^= ES_RIGHT;
       }
     }
     // Static
-    else if (int(m_vItems[i]->szClass) == 0x82) {
+    else if (long(m_vItems[i]->szClass) == 0x82) {
       if ((m_vItems[i]->dwStyle & SS_TYPEMASK) == SS_LEFT || 
(m_vItems[i]->dwStyle & SS_TYPEMASK) == SS_LEFTNOWORDWRAP)
       {
         m_vItems[i]->dwStyle &= ~SS_TYPEMASK;
diff -urN ../tmp-orig/nsis-2.06/Source/util.cpp ./Source/util.cpp
--- ../tmp-orig/nsis-2.06/Source/util.cpp       2005-01-29 16:31:56.000000000 
+0100
+++ ./Source/util.cpp   2005-04-08 10:56:01.800597910 +0200
@@ -308,15 +308,15 @@
   else
     iNextSection = (int)sectionHeadersArray[i+1].PointerToRawData;
 
-  MY_ASSERT((int)rdRoot - (int)exeHeader > iNextSection, "corrupted EXE - 
invalid pointer");
+  MY_ASSERT((long)rdRoot - (long)exeHeader > iNextSection, "corrupted EXE - 
invalid pointer");
 
-  int idx = find_in_dir(rdRoot, (WORD) (int) RT_ICON);
+  int idx = find_in_dir(rdRoot, (WORD) (long) RT_ICON);
   MY_ASSERT(idx == -1, "no icons?!");
   MY_ASSERT(!rdRoot->Entries[idx].DirectoryOffset.DataIsDirectory, "bad 
resource directory");
 
   PRESOURCE_DIRECTORY rdIcons = 
PRESOURCE_DIRECTORY(rdRoot->Entries[idx].DirectoryOffset.OffsetToDirectory + 
DWORD(rdRoot));
 
-  MY_ASSERT((int)rdIcons - (int)exeHeader > iNextSection, "corrupted EXE - 
invalid pointer");
+  MY_ASSERT((long)rdIcons - (long)exeHeader > iNextSection, "corrupted EXE - 
invalid pointer");
 
   MY_ASSERT(rdIcons->Header.NumberOfIdEntries == 0, "no icons found");
 
@@ -324,12 +324,12 @@
     MY_ASSERT(!rdIcons->Entries[i].DirectoryOffset.DataIsDirectory, "bad 
resource directory");
     PRESOURCE_DIRECTORY rd = 
PRESOURCE_DIRECTORY(rdIcons->Entries[i].DirectoryOffset.OffsetToDirectory + 
DWORD(rdRoot));
     
-    MY_ASSERT((int)rd - (int)exeHeader > iNextSection, "corrupted EXE - 
invalid pointer");
+    MY_ASSERT((long)rd - (long)exeHeader > iNextSection, "corrupted EXE - 
invalid pointer");
     MY_ASSERT(rd->Entries[0].DirectoryOffset.DataIsDirectory, "bad resource 
directory");
     
     PIMAGE_RESOURCE_DATA_ENTRY rde = 
PIMAGE_RESOURCE_DATA_ENTRY(rd->Entries[0].OffsetToData + DWORD(rdRoot));
 
-    MY_ASSERT((int)rde - (int)exeHeader > iNextSection, "corrupted EXE - 
invalid pointer");
+    MY_ASSERT((long)rde - (long)exeHeader > iNextSection, "corrupted EXE - 
invalid pointer");
 
     // find icon to replace
     LPBYTE seeker = uninstIconData;
@@ -350,7 +350,7 @@
     // Set offset
     *(LPDWORD) seeker = rde->OffsetToData + DWORD(rdRoot) - 
dwResourceSectionVA - DWORD(exeHeader);
 
-    MY_ASSERT(*(int*)seeker > iNextSection || *(int*)seeker < (int)rdRoot - 
(int)exeHeader, "invalid data offset - icon resource probably compressed");
+    MY_ASSERT(*(int*)seeker > iNextSection || *(int*)seeker < (long)rdRoot - 
(long)exeHeader, "invalid data offset - icon resource probably compressed");
   }
 
   LPBYTE seeker = uninstIconData;


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to