gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libamf/amf.cpp libamf/sol.cpp


From: Rob Savoye
Subject: [Gnash-commit] gnash ChangeLog libamf/amf.cpp libamf/sol.cpp
Date: Mon, 31 Dec 2007 05:53:34 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    07/12/31 05:53:34

Modified files:
        .              : ChangeLog 
        libamf         : amf.cpp sol.cpp 

Log message:
                * libamf/sol.cpp: Various tweaks for 64bit big-endian systems,
                namely the ppc in a G5 or PS3.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5280&r2=1.5281
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/amf.cpp?cvsroot=gnash&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/sol.cpp?cvsroot=gnash&r1=1.10&r2=1.11

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5280
retrieving revision 1.5281
diff -u -b -r1.5280 -r1.5281
--- ChangeLog   31 Dec 2007 03:53:35 -0000      1.5280
+++ ChangeLog   31 Dec 2007 05:53:33 -0000      1.5281
@@ -1,5 +1,8 @@
 2007-12-30  Rob Savoye  <address@hidden>
 
+       * libamf/sol.cpp: Various tweaks for 64bit big-endian systems,
+       namely the ppc in a G5 or PS3.
+
        * utilities/dumpshm.cpp: Don't use ipc_perm if the __key field
        doesn't exist.
 

Index: libamf/amf.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/amf.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- libamf/amf.cpp      31 Dec 2007 02:45:28 -0000      1.53
+++ libamf/amf.cpp      31 Dec 2007 05:53:34 -0000      1.54
@@ -1370,7 +1370,7 @@
 }
 
 uint8_t *
-AMF::extractElement(Element &el, boost::uint8_t *in)
+AMF::extractElement(Element *el, boost::uint8_t *in)
 {
 //    GNASH_REPORT_FUNCTION;
 

Index: libamf/sol.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/sol.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libamf/sol.cpp      31 Dec 2007 02:17:02 -0000      1.10
+++ libamf/sol.cpp      31 Dec 2007 05:53:34 -0000      1.11
@@ -55,7 +55,7 @@
 // Object Name  - variable (the name of the object as an AMF encoded string)
 // Padding      - 4 bytes
 // After this is a series of AMF objects
-const short SOL_MAGIC = 0xbf00;
+const short SOL_MAGIC = 0x00bf;        // this is in big-endian format already
 //char *SOL_FILETYPE = "TCSO";
 const short SOL_BLOCK_MARK = 0x0004;
 
@@ -96,7 +96,7 @@
 {
 //    GNASH_REPORT_FUNCTION;
     _amfobjs.push_back(el);
-    _filesize += el->getName().size() + el->getLength() + 5;
+//    _filesize += el->getName().size() + el->getLength() + 5;
 }
 
 bool
@@ -121,7 +121,7 @@
     // First we add the magic number. All SOL data is in big-endian format,
     // so we swap it first.
     uint16_t swapped = SOL_MAGIC;
-//    swapped = htons(swapped);
+//    swapped = ntohs(swapped);
     uint8_t *ptr = reinterpret_cast<uint8_t *>(&swapped);
     for (i=0; i<sizeof(uint16_t); i++) {
         _header.push_back(ptr[i]);
@@ -294,18 +294,20 @@
     struct stat st;
     boost::uint16_t magic, size;
     boost::uint8_t *buf, *ptr;
+    int bodysize;
 
     // Make sure it's an SOL file
     if (stat(filespec.c_str(), &st) == 0) {
         ifstream ifs(filespec.c_str(), ios::binary);
         _filesize = st.st_size;
+       bodysize = st.st_size - 6;
         _filespec = filespec;
         ptr = buf = new boost::uint8_t[_filesize+1];
         ifs.read(reinterpret_cast<char *>(buf), _filesize);
 
         // extract the magic number
-        magic = *(reinterpret_cast<boost::uint16_t *>(ptr));
-        magic = ntohs(magic);
+        memcpy(&magic, buf, 2);
+//        magic = ntohl(magic);
         ptr += 2;
 
         // extract the file size
@@ -316,13 +318,12 @@
         // extract the file marker field
 //        char *marker = ptr;
         ptr += 10;
-        
-        if (memcmp(buf, &SOL_MAGIC, 2) == 0) {
-            if (_filesize - 6 == length) {
+        if ((buf[0] == 0) && (buf[1] == 0xbf)) {
+            if (bodysize == length) {
                 log_debug("%s is an SOL file", filespec.c_str());
             } else {
-                log_error("%s looks like an SOL file, but the length is wrong",
-                          filespec.c_str());
+                log_error("%s looks like an SOL file, but the length is wrong. 
Should be %d, got %d",
+                          filespec.c_str(), (_filesize - 6), length);
             }
             
         } else {
@@ -340,7 +341,7 @@
         ptr += 4;
 
         AMF amf_obj;
-        while ((buf - ptr) <= _filesize) {
+        while ((ptr - buf) < bodysize) {
            amf::Element *el = new amf::Element;
            ptr = amf_obj.extractVariable(el, ptr);
             if (ptr != 0) {




reply via email to

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