aMule Forum
English => Compilation problems => Topic started by: wires on December 09, 2008, 02:49:51 AM
-
Hi,
I'm trying to compile aMule-SVN-r9248-RELEASE-2_2_X on Fedora 9 64 bits (AMD64) and I'm getting this error:
Format.cpp: In member function 'CFormat& CFormat::operator%(void*)':
Format.cpp:434: error: cast from 'void*' to 'uint32_t' loses precision
I think the `if' surrounding this statement should be replaced by a preprocessor condition #ifdef __LP64__ (and the win peer) to avoid compiling an invalid statement (else branch for 64bits arch). Or may be using size_t instead of a fixed type (uintXX_t)?
-
I came here to report about this too (Ubuntu Intrepid AMD64).
Meanwhile as a workaround you can comment out the broken if clause (for 64 bit systems only of course):
--- Format.cpp.old 2008-12-09 05:45:25.000000000 +0000
+++ Format.cpp 2008-12-09 05:40:23.000000000 +0000
@@ -428,11 +428,11 @@ CFormat& CFormat::operator%(void * value
// - Windows: uppercase, no leading 0x
// - Linux: leading zeros missing
// -> format it as hex
- if (sizeof (void *) == 8) { // 64 bit
+// if (sizeof (void *) == 8) { // 64 bit
SetCurrentField(wxString::Format(wxT("0x%016x"), (uint64_t) value));
- } else { // 32 bit
- SetCurrentField(wxString::Format(wxT("0x%08x"), (uint32_t) value));
- }
+// } else { // 32 bit
+// SetCurrentField(wxString::Format(wxT("0x%08x"), (uint32_t) value));
+// }
}
return *this;
-
Here's a patch to fix this:
--- Format.cpp.old 2008-12-08 15:11:46.000000000 +0000
+++ Format.cpp 2008-12-09 21:30:24.000000000 +0000
@@ -429,9 +429,9 @@ CFormat& CFormat::operator%(void * value
// - Linux: leading zeros missing
// -> format it as hex
if (sizeof (void *) == 8) { // 64 bit
- SetCurrentField(wxString::Format(wxT("0x%016x"), (uint64_t) value));
+ SetCurrentField(wxString::Format(wxT("0x%016x"), (uintptr_t) value));
} else { // 32 bit
- SetCurrentField(wxString::Format(wxT("0x%08x"), (uint32_t) value));
+ SetCurrentField(wxString::Format(wxT("0x%08x"), (uintptr_t) value));
}
}
-
Commited, thank you very much. :)
Duh, I'm falling from hole into the next with this thingy. Now I'm waiting for someone saying "uintptr_t is undefined on my machine"...
-
Glad to help. :)
Yeah I considered that, I believe "uintptr_t" is defined in C99 (not sure about C++ compatibility there) so some non-compliant compilers may throw errors, but this is a very simple to implement and widespread part of the standard. I don't expect it to cause more breakage (hopefully).
Cheers.
EDIT: Duh myself, those are the same requirements as uintXX_t, so nevermind the overly elaborate and completely unnecessary comment above. ;)
-
changed to "uintptr_t" works for Intrepid(AMD64).
Commited, thank you very much. :)
Duh, I'm falling from hole into the next with this thingy. Now I'm waiting for someone saying "uintptr_t is undefined on my machine"...