[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-dev] [PATCH] libamf/lcshm.cpp: fix "cast loses precision" error
From: |
Melchior FRANZ |
Subject: |
[Gnash-dev] [PATCH] libamf/lcshm.cpp: fix "cast loses precision" error |
Date: |
Thu, 23 Jul 2009 09:18:05 +0200 |
User-agent: |
KMail/1.12.90 (Linux/2.6.30.2; KDE/4.3.61; x86_64; svn-1001171; 2009-07-21) |
Hi,
gnash from today doesn't compile for me. g++ complains about an invalid
cast of a pointer to "unsigned int", which doesn't quite fit on 64 bit
systems.
lcshm.cpp: In member function ‘uint8_t* amf::LcShm::formatHeader(const
std::string&, \
const std::string&, bool)’:
lcshm.cpp:416: error: cast from ‘uint8_t*’ to ‘unsigned int’ loses precision
lcshm.cpp:416: error: cast from ‘uint8_t*’ to ‘unsigned int’ loses precision
lcshm.cpp: In member function ‘bool amf::LcShm::connect(const std::string&)’:
lcshm.cpp:487: error: cast from ‘char*’ to ‘unsigned int’ loses precision
lcshm.cpp:487: error: cast from ‘uint8_t*’ to ‘unsigned int’ loses precision
lcshm.cpp: In member function ‘void amf::LcShm::send(const std::string&, \
const std::string&, std::vector<amf::Element*,
std::allocator<amf::Element*> >&)’:
lcshm.cpp:568: error: cast from ‘uint8_t*’ to ‘unsigned int’ loses precision
lcshm.cpp:568: error: cast from ‘uint8_t*’ to ‘unsigned int’ loses precision
I suggest to use printf's %p format instead:
=== modified file 'libamf/lcshm.cpp'
--- libamf/lcshm.cpp 2009-07-22 18:25:26 +0000
+++ libamf/lcshm.cpp 2009-07-23 07:16:33 +0000
@@ -412,8 +412,7 @@
boost::uint8_t *header = Listener::getBaseAddress();
boost::uint8_t *ptr_FH = Listener::getBaseAddress();
- log_debug("Base address in 'formatHeader' is: 0x%x, 0x%x",
- (unsigned int) header, (unsigned int) ptr_FH);
+ log_debug("Base address in 'formatHeader' is: %p, %p", header, ptr_FH);
// This is the initial 16 bytes of the header
memset(ptr_FH, 0, 16 + size + 1);
@@ -483,8 +482,7 @@
Listener::setBaseAddress(baseAddress);
_baseaddr = baseAddress;
parseHeader(baseAddress, tooFar);
- log_debug("Base address in 'connect' is: 0x%x, 0x%x",
- (unsigned int) Shm::getAddr(), (unsigned int) _baseaddr);
+ log_debug("Base address in 'connect' is: %p, %p", Shm::getAddr(),
_baseaddr);
// vector<boost::shared_ptr<Element> > ellist = parseBody(ptr);
// log_debug("Base address is: 0x%x, 0x%x",
// (unsigned int)Listener::getBaseAddress(), (unsigned
int)_baseaddr);
@@ -564,8 +562,8 @@
log_debug(_(" ***** The send function is called *****") );
// cout<<" The send function is called ! "<<endl;
- log_debug("Base address in 'send' is: 0x%x, 0x%x",
- (unsigned int)Listener::getBaseAddress(), (unsigned
int)_baseaddr);
+ log_debug("Base address in 'send' is: %p, %p", Listener::getBaseAddress(),
+ _baseaddr);
//The base address
boost::uint8_t *baseptr = Listener::getBaseAddress();
m.
- [Gnash-dev] [PATCH] libamf/lcshm.cpp: fix "cast loses precision" error,
Melchior FRANZ <=