File gnash-0.8.4-cast-fixes.diff of Package gnash

--- libamf/buffer.cpp
+++ libamf/buffer.cpp
@@ -169,7 +169,7 @@ Buffer::copy(Network::byte_t val)
 {
     GNASH_REPORT_FUNCTION;
     *_ptr = val;
-    _seekptr = _ptr + sizeof(bool);
+    _seekptr = _ptr + sizeof(Network::byte_t);
 }
 
 #if 0
--- libnet/rtmp.cpp
+++ libnet/rtmp.cpp
@@ -260,7 +260,7 @@ RTMP::decodeHeader(Network::byte_t *in)
     
     if (_header.head_size >= 4) {
         _mystery_word = *tmpptr++;
-        _mystery_word = (_mystery_word << 12) + *tmpptr++;
+        _mystery_word = (_mystery_word << 8) + *tmpptr++;
         _mystery_word = (_mystery_word << 8) + *tmpptr++;
 
         log_debug(_("The mystery word is: %d"), _mystery_word);
@@ -268,7 +268,7 @@ RTMP::decodeHeader(Network::byte_t *in)
 
     if (_header.head_size >= 8) {
         _header.bodysize = *tmpptr++;
-        _header.bodysize = (_header.bodysize << 12) + *tmpptr++;
+        _header.bodysize = (_header.bodysize << 8) + *tmpptr++;
         _header.bodysize = (_header.bodysize << 8) + *tmpptr++;
         _header.bodysize = _header.bodysize & 0xffffff;
         log_debug(_("The body size is: %d"), _header.bodysize);
@@ -381,17 +381,9 @@ RTMP::encodeHeader(int amf_index, rtmp_h
     // and add the type of the object if the header size is 8 or more.
     // length is a 3 byte field
     if ((head_size == HEADER_8) || (head_size == HEADER_12)) {
-#ifdef BOOST_BIG_ENDIAN
-	boost::uint32_t length = total_size << 8;
-#else
-	boost::uint32_t length = (htonl(*reinterpret_cast<boost::uint32_t *>(&total_size))) >> 8;
-#endif
- 	memcpy(ptr, &length, 3);
-// #else
-// #error "No Endianess specified!"
-// #endif
-//#endif
-        ptr += 3;
+	*ptr++ = (total_size >> 16) & 0xff;
+	*ptr++ = (total_size >> 8) & 0xff;
+	*ptr++ = total_size & 0xff;
 	// The type is a one byte field
 	*ptr = type;
 	ptr++;
@@ -399,7 +391,8 @@ RTMP::encodeHeader(int amf_index, rtmp_h
     
     // Add the routing of the message if the header size is 12, the maximum.
     if (head_size == HEADER_12) {
-        memcpy(ptr, &routing, 4);
+        boost::uint32_t swapped = htonl(routing);
+        memcpy(ptr, &swapped, 4);
         ptr += 4;
     }
     
--- libnet/rtmp_server.cpp
+++ libnet/rtmp_server.cpp
@@ -628,11 +628,7 @@ RTMPServer::encodePing(rtmp_ping_e type,
     Network::byte_t *ptr = buf->reference();
     buf->clear();	// default everything to zeros, real data gets optionally added.
 
-    boost::uint32_t field = htonl(*reinterpret_cast<boost::uint32_t *>(&type));
-#ifdef BOOST_LITTLE_ENDIAN
-    field = field >> 16;
-#endif
-    boost::uint16_t typefield = static_cast<boost::uint16_t>(field);
+    boost::uint16_t typefield = htons(type);
     ptr += sizeof(boost::uint16_t); // go past the first short
 
     boost::uint32_t swapped = 0;