Package: nsis
Version: 2.19-1
Severity: serious
Tags: patch

When building 'nsis' on amd64/unstable,
I get the following error:


Source/DialogTemplate.cpp:561: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:561: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:575: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:575: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:615: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:615: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:617: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:617: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:632: error: cast from 'BYTE*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:632: error: cast from 'BYTE*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp: In member function 'DWORD 
CDialogTemplate::GetSize()':
Source/DialogTemplate.cpp:643: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:645: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:647: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:652: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:662: error: cast from 'char*' to 'DWORD' loses 
precision
Source/DialogTemplate.cpp:664: error: cast from 'char*' to 'DWORD' loses 
precision
scons: *** [build/release/makensis/DialogTemplate.o] Error 1
scons: building terminated because of errors.
make: *** [build-stamp] Error 2


With the attached patch 'nsis' can be compiled on amd64.


Regards
Andreas Jochens


diff -urN ../tmp-orig/nsis-2.19/Source/DialogTemplate.cpp 
./Source/DialogTemplate.cpp
--- ../tmp-orig/nsis-2.19/Source/DialogTemplate.cpp     2006-03-24 
18:36:24.000000000 +0000
+++ ./Source/DialogTemplate.cpp 2006-08-16 15:33:20.000000000 +0000
@@ -93,7 +93,7 @@
     if (IS_INTRESOURCE(x)) { \
       *(WORD*)seeker = 0xFFFF; \
       seeker += sizeof(WORD); \
-      *(WORD*)seeker = ConvertEndianness(WORD(DWORD(x))); \
+      *(WORD*)seeker = ConvertEndianness(WORD(long(x))); \
       seeker += sizeof(WORD); \
     } \
     else { \
@@ -629,7 +629,7 @@
     }
   }
 
-  assert((DWORD) seeker - (DWORD) pbDlg == dwSize);
+  assert((long) seeker - (long) pbDlg == dwSize);
 
   // DONE!
   return pbDlg;
diff -urN ../tmp-orig/nsis-2.19/Source/Platform.h ./Source/Platform.h
--- ../tmp-orig/nsis-2.19/Source/Platform.h     2006-07-30 11:48:47.000000000 
+0000
+++ ./Source/Platform.h 2006-08-16 15:34:14.000000000 +0000
@@ -135,7 +135,7 @@
 #    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( (long) h + \
                                      FIELD_OFFSET(IMAGE_NT_HEADERS, 
OptionalHeader) + \
                                      
FIX_ENDIAN_INT16(PIMAGE_NT_HEADERS(h)->FileHeader.SizeOfOptionalHeader) ) )
 #  endif
@@ -147,7 +147,7 @@
 #  endif
 #endif
 #ifndef IS_INTRESOURCE
-#  define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0)
+#  define IS_INTRESOURCE(_r) (((unsigned long)(_r) >> 16) == 0)
 #endif
 
 // functions
diff -urN ../tmp-orig/nsis-2.19/Source/ResourceEditor.cpp 
./Source/ResourceEditor.cpp
--- ../tmp-orig/nsis-2.19/Source/ResourceEditor.cpp     2006-04-05 
18:40:09.000000000 +0000
+++ ./Source/ResourceEditor.cpp 2006-08-16 15:35:24.000000000 +0000
@@ -545,7 +545,7 @@
     rdDir.NumberOfIdEntries = ConvertEndianness(rdDir.NumberOfIdEntries);
 
     CopyMemory(seeker, &rdDir, sizeof(IMAGE_RESOURCE_DIRECTORY));
-    crd->m_dwWrittenAt = DWORD(seeker);
+    crd->m_dwWrittenAt = long(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 = long(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 = long(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(long(seeker) - long(pbRsrcSec));
 
     char* szName = cRDirE->GetName();
     WORD iLen = strlen(szName) + 1;
@@ -636,7 +636,7 @@
   /*
    * Set all of the directory entries offsets.
    */
-  SetOffsets(m_cResDir, DWORD(pbRsrcSec));
+  SetOffsets(m_cResDir, long(pbRsrcSec));
 }
 
 // Sets the offsets in directory entries
@@ -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) (long) 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) (long) 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) (long) szName;
   }
   else {
     m_bHasName = true;
diff -urN ../tmp-orig/nsis-2.19/Source/util.cpp ./Source/util.cpp
--- ../tmp-orig/nsis-2.19/Source/util.cpp       2006-07-30 10:29:23.000000000 
+0000
+++ ./Source/util.cpp   2006-08-16 15:36:48.000000000 +0000
@@ -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 + long(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 + long(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 + long(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) + long(rdRoot) - 
dwResourceSectionVA - long(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 < (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