[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10070: Don't cast a char* to a doub
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10070: Don't cast a char* to a double*, can't be done on all systems (memory alignment issues). Hopefully fixes bug #24641 |
Date: |
Fri, 24 Oct 2008 11:59:57 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10070
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Fri 2008-10-24 11:59:57 +0200
message:
Don't cast a char* to a double*, can't be done on all systems (memory
alignment issues). Hopefully fixes bug #24641
modified:
libcore/as_value.cpp
=== modified file 'libcore/as_value.cpp'
--- a/libcore/as_value.cpp 2008-09-26 08:27:33 +0000
+++ b/libcore/as_value.cpp 2008-10-24 09:59:57 +0000
@@ -2175,7 +2175,10 @@
log_error(_("AMF0 read: premature end of input
reading Number type"));
return false;
}
- double dub = *(reinterpret_cast<double*>(b)); b += 8;
+ double dub;
+ // TODO: may we avoid a copy and swapBytes call
+ // by bitshifting b[0] trough b[7] ?
+ std::copy(b, b+8, (char*)&dub); b+=8;
amf::swapBytes(&dub, 8);
#ifdef GNASH_DEBUG_AMF_DESERIALIZE
log_debug("amf0 read double: %e", dub);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10070: Don't cast a char* to a double*, can't be done on all systems (memory alignment issues). Hopefully fixes bug #24641,
Sandro Santilli <=