gnash-commit
[Top][All Lists]
Advanced

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

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


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/dlist.cpp libamf/amf.cpp
Date: Wed, 23 Aug 2006 20:56:23 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/08/23 20:56:23

Modified files:
        .              : ChangeLog 
        server         : dlist.cpp 
        libamf         : amf.cpp 

Log message:
                * libamf/amf.cpp, server/dlist.cpp: fixed compiler warnings, or
                  added some notes about problems arised from them.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.690&r2=1.691
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/amf.cpp?cvsroot=gnash&r1=1.10&r2=1.11

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.690
retrieving revision 1.691
diff -u -b -r1.690 -r1.691
--- ChangeLog   23 Aug 2006 20:28:20 -0000      1.690
+++ ChangeLog   23 Aug 2006 20:56:22 -0000      1.691
@@ -1,3 +1,8 @@
+2006-08-23 Sandro Santilli  <address@hidden>
+
+       * libamf/amf.cpp, server/dlist.cpp: fixed compiler warnings, or
+         added some notes about problems arised from them.
+
 2006-08-23 Bastiaan Jacques <address@hidden>
 
        * configure.ac, plugin/Makefile.am: For OpenBSD, omit some linker
@@ -7,7 +12,8 @@
 
 2006-08-23 Vitaly Alexeev <address@hidden>
        
-       * server\sprite_instance.cpp: action_list.size() may be changed due to 
actions
+       * server\sprite_instance.cpp: action_list.size() may be changed
+         due to actions
 
 2006-08-23 Vitaly Alexeev <address@hidden>
        

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/dlist.cpp    23 Aug 2006 14:08:34 -0000      1.21
+++ server/dlist.cpp    23 Aug 2006 20:56:22 -0000      1.22
@@ -417,7 +417,7 @@
 {
        //GNASH_REPORT_FUNCTION;
 
-       container_type::size_type size = _characters.size();
+//     container_type::size_type size = _characters.size();
 
        //Vitaly:  That there was no crash gnash we iterate through the copy
        std::list<DisplayItem> tmp_list = _characters;  //vv

Index: libamf/amf.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/amf.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libamf/amf.cpp      16 Aug 2006 14:31:09 -0000      1.10
+++ libamf/amf.cpp      23 Aug 2006 20:56:23 -0000      1.11
@@ -805,7 +805,7 @@
     unsigned char* hexint;
 
     char buffer[AMF_VIDEO_PACKET_SIZE];
-    char *name;
+    //char *name;
     short length;
     int data_bytes = bytes;
     amf_element_t el;
@@ -919,7 +919,7 @@
     GNASH_REPORT_FUNCTION;
     
     char buffer[AMF_VIDEO_PACKET_SIZE];
-    char *tmpptr = (char *)in;
+    const char *tmpptr = in;
     short length = 0;
 
     el.length = 0;
@@ -929,7 +929,9 @@
     }
     
     memset(buffer, 0, AMF_VIDEO_PACKET_SIZE);
-    length = ntohs(*(short *)tmpptr);
+    // @@ casting generic pointers to bigger types may be dangerous
+    //    due to memory alignment constraints
+    length = ntohs(*(const short *)tmpptr);
     el.length = length;
     if (length == 0) {
         if (*(tmpptr+2) == ObjectEnd) {
@@ -958,12 +960,14 @@
             el.name.erase();
             el.length = 0;
             el.data = 0;
-            return tmpptr;
+           // @@ we're dropping constness of input here..
+           //    it might be a problem, but strchr does it as well...
+            return const_cast<char*>(tmpptr);
         }
     }
     
 //    dbglogfile << "AMF element name is: " << buffer << endl;
-    char type = *(astype_e *)tmpptr++;
+    char type = *(const astype_e *)tmpptr++;
 
     if (type <= TypedObject) {
         dbglogfile << "AMF type is: " << astype_str[(int)type] << endl;
@@ -978,9 +982,9 @@
           break;
       case Boolean:
       case String:
-          length = ntohs(*(short *)tmpptr);
+          length = ntohs(*(const short *)tmpptr); // @@ this cast is dangerous
           tmpptr += sizeof(short);
-          el.data = (unsigned char*)tmpptr;
+          el.data = (unsigned char*)tmpptr; // @@ this cast is dangerous
           dbglogfile << "Variable \"" << el.name.c_str() << "\" is: " << 
el.data << endl;
           tmpptr += length;
           el.length = length;
@@ -1004,7 +1008,7 @@
           break;
     }
     
-    return tmpptr;
+    return const_cast<char*>(tmpptr); // we're dropping const specification
 }
 
 } // end of amf namespace




reply via email to

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