gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/rtmp r9586: Convert 3 byte ints to 4 bytes


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9586: Convert 3 byte ints to 4 bytes ones better.
Date: Wed, 13 Aug 2008 20:00:36 -0600
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9586
committer: address@hidden
branch nick: rtmp
timestamp: Wed 2008-08-13 20:00:36 -0600
message:
  Convert 3 byte ints to 4 bytes ones better.
modified:
  libamf/flv.cpp
=== modified file 'libamf/flv.cpp'
--- a/libamf/flv.cpp    2008-08-13 22:29:05 +0000
+++ b/libamf/flv.cpp    2008-08-14 02:00:36 +0000
@@ -114,14 +114,13 @@
     // structure. This is to get around possible padding done to the data 
structure
     // done by some compilers.
     boost::uint32_t size = *(reinterpret_cast<boost::uint32_t 
*>(_header.head_size));
-
     // The header size is big endian
-    size = ntohl(size);
+    swapBytes(_header.head_size, sizeof(boost::uint32_t));
     
     // The header size is always 9, guess it could change some day in the far 
future, so
     // we should use it.
-    if (size != 0x9) {
-       log_error("Bad header size in FLV header! %d", _header.head_size);
+    if (ntohl(size) != 0x9) {
+       log_error("Bad header size in FLV header! %d", size);
                  return 0;
     }
     
@@ -284,8 +283,11 @@
 {
 //    GNASH_REPORT_FUNCTION;
     boost::uint32_t bodysize = 0;
-    memcpy((char *)(&bodysize), num, 4);
+    bodysize = *(reinterpret_cast<boost::uint32_t *>(num)) << 8;
+    
     bodysize = ntohl(bodysize);
+
+    return bodysize;
 }
 
 // Decode the tag header


reply via email to

[Prev in Thread] Current Thread [Next in Thread]