Bug 101554 - amd64/gcc4 compile errors and patch
Summary: amd64/gcc4 compile errors and patch
Status: RESOLVED FIXED
Alias: None
Product: kword
Classification: Miscellaneous
Component: filters (show other bugs)
Version: 1.5 or before
Platform: Compiled Sources Linux
: NOR normal with 20 votes (vote)
Target Milestone: ---
Assignee: KOffice Bug Wranglers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-15 16:10 UTC by Ana Guerrero (Debian KDE maintainers)
Modified: 2005-06-05 20:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
koffice patch to build on amd64 w/ gcc4 (3.13 KB, patch)
2005-03-15 16:11 UTC, Ana Guerrero (Debian KDE maintainers)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ana Guerrero (Debian KDE maintainers) 2005-03-15 16:10:21 UTC
Version:           1.3.5 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc4 prerelease 
OS:                Linux

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=287164 informs us that koffice doesn't build on amd64 with gcc 4.0:

../../../../filters/kword/mswrite/structures_generated.cpp: In member function 'virtual bool MSWrite::HeaderGenerated::verifyVariables()':
../../../../filters/kword/mswrite/structures_generated.cpp:96: error: cast from 'MSWrite::Word*' to 'MSWrite::DWord' loses precision
../../../../filters/kword/mswrite/structures_generated.cpp:107: error: cast from 'MSWrite::Word*' to 'MSWrite::DWord' loses precision
../../../../filters/kword/mswrite/structures_generated.cpp: In member function 'virtual bool MSWrite::FormatParaPropertyGenerated::verifyVariables()':
../../../../filters/kword/mswrite/structures_generated.cpp:1246: error: cast from 'MSWrite::Word*' to 'MSWrite::DWord' loses precision
../../../../filters/kword/mswrite/structures_generated.cpp:1255: error: cast from 'MSWrite::Byte*' to 'MSWrite::DWord' loses precision
../../../../filters/kword/mswrite/structures_generated.cpp: In member function 'virtual bool MSWrite::BMP_BitmapFileHeaderGenerated::verifyVariables()':
../../../../filters/kword/mswrite/structures_generated.cpp:1496: error: cast from 'MSWrite::Word*' to 'MSWrite::DWord' loses precision
make[5]: *** [structures_generated.lo] Error 1
make[5]: Leaving directory `/koffice-1.3.4/obj-x86_64-linux/filters/kword/mswrite'

I'll attach the patch that was provided to us to fix the problem, modified to apply to the current code.

Thanks!
Comment 1 Ana Guerrero (Debian KDE maintainers) 2005-03-15 16:11:15 UTC
Created attachment 10127 [details]
koffice patch to build on amd64 w/ gcc4
Comment 2 Ana Guerrero (Debian KDE maintainers) 2005-06-01 16:40:53 UTC
Any chance of this patch being applied soon? amd64 and gcc4 are both becoming more common.

Thanks!
Comment 3 Nicolas Goutte 2005-06-04 22:28:43 UTC
Sorry, I CCed the wrong person but KDE Bugs is dead right now for me, so I 
will have to change it later.
Comment 4 Nicolas Goutte 2005-06-04 22:56:15 UTC
I am not the author of this filter but I find replacing DWORD by long curious.
(DWORD is 32 bits and as far as I know long is 64 bits on an AMD 64).

Have a nice day! 
Comment 5 Lukáš Tinkl 2005-06-05 12:06:54 UTC
Pls apply the patch, we had to apply something similar in SUSE too. The patch is correct.
Comment 6 Nicolas Goutte 2005-06-05 14:32:35 UTC
On Sunday 05 June 2005 12:06, Lukas Tinkl wrote:
(...)
> ------- Additional Comments From lukas kde org  2005-06-05 12:06 -------
> Pls apply the patch, we had to apply something similar in SUSE too. The
> patch is correct.


Good then I don't mind, but I have not any KOffice SVN source currently, o 
somebody else must do it. Sorry!

Have a nice day!
Comment 7 David Faure 2005-06-05 20:48:38 UTC
SVN commit 422528 by dfaure:

build on amd64 w/ gcc4, patch by "debian kde maintainers" - thanks!
BUG:101554


 M  +5 -5      kword/mswrite/structures_generated.cpp  
 M  +1 -1      olefilters/winword97/msword.cc  
 M  +2 -2      olefilters/winword97/properties.cc  


--- branches/koffice/1.4/koffice/filters/kword/mswrite/structures_generated.cpp #422527:422528
@@ -93,7 +93,7 @@
 		if (!Verify (Error::InvalidFormat, m_magic2 == 0xAB00, DWord (m_magic2))) return false;
 		for (int i = 0; i < 4; i++)
 		{
-			if (!Verify (Error::InvalidFormat, m_zero2 [i] == 0, DWord (m_zero2))) return false;
+                       if (!Verify (Error::InvalidFormat, m_zero2 [i] == 0, long (m_zero2))) return false;
 		}
 		if (!Verify (Error::InvalidFormat, m_numCharBytesPlus128 >= 128, DWord (m_numCharBytesPlus128))) return false;
 		// m_pageParaInfo will not be checked
@@ -104,7 +104,7 @@
 		// m_pageFontTable will not be checked
 		for (int i = 0; i < 33; i++)
 		{
-			if (!Verify (Error::Warn, m_zero3 [i] == 0, DWord (m_zero3))) return false;
+                       if (!Verify (Error::Warn, m_zero3 [i] == 0, long (m_zero3))) return false;
 		}
 		if (!Verify (Error::InvalidFormat, m_numPages > 0, DWord (m_numPages))) return false;
 		return true;
@@ -1243,7 +1243,7 @@
 		// m_lineSpacing will not be checked
 		for (int i = 0; i < 2; i++)
 		{
-			if (!Verify (Error::Warn, m_zero [i] == 0, DWord (m_zero))) return false;
+                       if (!Verify (Error::Warn, m_zero [i] == 0, long (m_zero))) return false;
 		}
 		// m_headerOrFooter will not be checked
 		// m_isNotNormalParagraph will not be checked
@@ -1252,7 +1252,7 @@
 		if (!Verify (Error::Warn, m_zero2 == 0, DWord (m_zero2))) return false;
 		for (int i = 0; i < 5; i++)
 		{
-			if (!Verify (Error::Warn, m_zero3 [i] == 0, DWord (m_zero3))) return false;
+                       if (!Verify (Error::Warn, m_zero3 [i] == 0, long (m_zero3))) return false;
 		}
 		for (int i = 0; i < 14; i++)
 		{
@@ -1493,7 +1493,7 @@
 		// m_totalBytes will not be checked
 		for (int i = 0; i < 2; i++)
 		{
-			if (!Verify (Error::Warn, m_zero [i] == 0, DWord (m_zero))) return false;
+                       if (!Verify (Error::Warn, m_zero [i] == 0, long (m_zero))) return false;
 		}
 		// m_actualImageOffset will not be checked
 		return true;
--- branches/koffice/1.4/koffice/filters/olefilters/winword97/msword.cc #422527:422528
@@ -1613,7 +1613,7 @@
     // The grupx reader code has to know about the alignment of the STD. We
     // choose to store this in a convenient field.
 
-    out->fScratch = ((int)in & 1);
+    out->fScratch = ((long)in & 1);
 
     // If the baseInFile is less than 10, then the style name is not stored in unicode!
 
--- branches/koffice/1.4/koffice/filters/olefilters/winword97/properties.cc #422527:422528
@@ -1089,7 +1089,7 @@
         // Align to an even-byte offset *within* the STD. The alignment
         // of the STD was stored in fScratch.
 
-        if (((int)grpprl & 1) ^ style.fScratch)
+        if (((long)grpprl & 1) ^ style.fScratch)
             grpprl++;
         grpprl += MsWordGenerated::read(grpprl, &cbUpx);
         if (cbUpx)
@@ -1112,7 +1112,7 @@
         // Align to an even-byte offset *within* the STD. The alignment
         // of the STD was stored in fScratch.
 
-        if (((int)grpprl & 1) ^ style.fScratch)
+        if (((long)grpprl & 1) ^ style.fScratch)
             grpprl++;
         grpprl += MsWordGenerated::read(grpprl, &cbUpx);
         if (cbUpx)