gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/rtmp r9613: fix encodePing to work on a bi


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9613: fix encodePing to work on a big endian 64 bit machine.
Date: Wed, 27 Aug 2008 22:58:54 -0600
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9613
committer: address@hidden
branch nick: rtmp
timestamp: Wed 2008-08-27 22:58:54 -0600
message:
  fix encodePing to work on a big endian 64 bit machine.
modified:
  libnet/rtmp_server.cpp
=== modified file 'libnet/rtmp_server.cpp'
--- a/libnet/rtmp_server.cpp    2008-08-28 01:27:20 +0000
+++ b/libnet/rtmp_server.cpp    2008-08-28 04:58:54 +0000
@@ -25,6 +25,7 @@
 #include <string>
 #include <map>
 #include <boost/cstdint.hpp>
+#include <boost/detail/endian.hpp>
 
 #if ! (defined(_WIN32) || defined(WIN32))
 #      include <netinet/in.h>
@@ -189,7 +190,6 @@
     Network::byte_t *ptr = buf->reference();
     AMF amf;
     
-//    
address@hidden@\000\000\000\000\000\000\003\000\003app\002\000#software/gnash/tests/1153948634.flv\000\bflashVer\002\000\fLNX
 
6,0,82,0\000\006swfUrl\002\000\035file:///file|address@hidden://localhost/software/gnash/tests/1153948634
     if (buf->reference() == 0) {
        return false;
     }
@@ -624,14 +624,19 @@
 RTMPServer::encodePing(rtmp_ping_e type, boost::uint32_t milliseconds)
 {
     GNASH_REPORT_FUNCTION;
-    Buffer *buf = new Buffer(sizeof(boost::uint16_t) * 4);
+    Buffer *buf = new Buffer(sizeof(boost::uint16_t) * 3);
     Network::byte_t *ptr = buf->reference();
-    buf->clear();              // default everything to zeros, real data gets 
optionally added.
-    boost::uint16_t typefield = *reinterpret_cast<boost::uint16_t *>(&type);
+    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);
     ptr += sizeof(boost::uint16_t); // go past the first short
 
     boost::uint32_t swapped = 0;
-    swapBytes(&typefield, sizeof(boost::uint16_t));
+//    swapBytes(&typefield, sizeof(boost::uint16_t));
     buf->copy(typefield);
     switch (type) {
         // These two don't appear to have any paramaters


reply via email to

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