gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9629: Partial fix and major cleanup


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9629: Partial fix and major cleanup for XMLSocket. It is unfinished, but appears to
Date: Wed, 20 Aug 2008 18:15:55 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9629
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2008-08-20 18:15:55 +0200
message:
  Partial fix and major cleanup for XMLSocket. It is unfinished, but appears to
  fix a crash occurring whenever XMLSocket.onXML() is called (that is, when
  XMLSocket.onData is undefined), gets onData generally correct, and
  produces some sensible output for onXML.
  
  Remove non-existent names from namedStrings.
modified:
  libamf/amftest.cpp
  libcore/asobj/xmlsocket.cpp
  libcore/asobj/xmlsocket.h
  libcore/event_id.h
  libcore/namedStrings.cpp
  libcore/namedStrings.h
  libcore/sprite_instance.h
  libcore/vm/action.cpp
  testsuite/XmlSocketServer.pl
  testsuite/libbase/TCXXRc.cpp
  testsuite/misc-ming.all/XMLSocketTest.c
    ------------------------------------------------------------
    revno: 9624.1.7
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Tue 2008-08-19 17:56:50 +0200
    message:
      Clean up headers.
    modified:
      libcore/asobj/xmlsocket.cpp
      libcore/asobj/xmlsocket.h
    ------------------------------------------------------------
    revno: 9624.1.8
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Tue 2008-08-19 18:06:23 +0200
    message:
      More clean up.
    modified:
      libcore/asobj/xmlsocket.cpp
    ------------------------------------------------------------
    revno: 9624.1.9
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Tue 2008-08-19 19:04:47 +0200
    message:
      Drop useless global variables. Rename xmlsocket_as_object to XMLSocket_as.
      Construct like a C++ class. Drop general unused cruft.
    modified:
      libamf/amftest.cpp
      libcore/asobj/xmlsocket.cpp
      libcore/asobj/xmlsocket.h
      testsuite/libbase/TCXXRc.cpp
    ------------------------------------------------------------
    revno: 9624.1.10
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Tue 2008-08-19 22:37:40 +0200
    message:
      Remove apparently made-up names from namedString table: onSockClose,
      onSockConnect, onSockData, onSockXML, onXMLData. Replace as
      appropriate with the correct names.
    modified:
      libcore/event_id.h
      libcore/namedStrings.cpp
      libcore/namedStrings.h
      libcore/sprite_instance.h
      libcore/vm/action.cpp
    ------------------------------------------------------------
    revno: 9624.1.11
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-08-20 13:29:24 +0200
    message:
      A test for XMLSocket behaviour.
    added:
      testsuite/XmlSocketServer.pl
      testsuite/misc-ming.all/XMLSocketTest.c
    modified:
      testsuite/misc-ming.all/Makefile.am
    ------------------------------------------------------------
    revno: 9624.1.12
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-08-20 14:44:12 +0200
    message:
      "Throttle" the server to send only every half-second. Slow the SWF
      down to 4 frames / second. This ensures that messages are received in
      groups.
      
      Wait a bit for replies in the SWF (client).
    modified:
      testsuite/XmlSocketServer.pl
      testsuite/misc-ming.all/XMLSocketTest.c
    ------------------------------------------------------------
    revno: 9624.1.13
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-08-20 14:46:39 +0200
    message:
      Comment.
    modified:
      testsuite/XmlSocketServer.pl
    ------------------------------------------------------------
    revno: 9624.1.14
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-08-20 15:20:22 +0200
    message:
      Tweak the speed of both client and server to mix up the messages properly.
      Test all the replies.
    modified:
      testsuite/misc-ming.all/XMLSocketTest.c
    ------------------------------------------------------------
    revno: 9624.1.15
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-08-20 15:53:44 +0200
    message:
      Replace all occurences of *NULL* and *NEWLINE* now that we might
      expect more than one in a string.
    modified:
      testsuite/XmlSocketServer.pl
    ------------------------------------------------------------
    revno: 9624.1.16
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-08-20 16:00:11 +0200
    message:
      XMLSocket is not really anything to do with XML; it will accept any data
      and merely parses it automatically as XML unless you set onData.
      
      Drop all the XML parsing on receipt of data and just push 0-terminated
      messages on to the message vector.
      
      Write the NULL terminator to the socket, or the server won't understand.
      
      Make the code a bit less like C (but not much).
    modified:
      libcore/asobj/xmlsocket.cpp
    ------------------------------------------------------------
    revno: 9624.1.17
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-08-20 17:03:45 +0200
    message:
      Add a very long string to XML test. Gnash fails this because it splits
      received data into max 10000 chars, but since a scoped_array was being
      used to store the leftover before (hence deleting it as soon as it went
      out of scope), failing here is nothing new.
    modified:
      testsuite/XmlSocketServer.pl
      testsuite/misc-ming.all/XMLSocketTest.c
=== modified file 'libamf/amftest.cpp'
--- a/libamf/amftest.cpp        2008-01-21 22:55:26 +0000
+++ b/libamf/amftest.cpp        2008-08-19 17:04:47 +0000
@@ -46,12 +46,6 @@
                                // can optimize it's own performance
                                // when needed,
 
-extern int xml_fd;             // FIXME: this is the file descriptor
-                               // from XMLSocket::connect(). This
-                               // needs to be propogated up through
-                               // the layers properly, but first I
-                               // want to make sure it all works.
-
 #include "amf.h"
 
 using namespace amf;

=== modified file 'libcore/asobj/xmlsocket.cpp'
--- a/libcore/asobj/xmlsocket.cpp       2008-08-18 23:53:04 +0000
+++ b/libcore/asobj/xmlsocket.cpp       2008-08-20 14:00:11 +0000
@@ -40,39 +40,20 @@
 
 #include "log.h"
 
-#include <sys/types.h>
-#include <fcntl.h>
+// For select() and read()
 #ifdef HAVE_WINSOCK2_H
 # include <winsock2.h>
-# include <windows.h>
+#else
+# include <sys/types.h>
 # include <sys/stat.h>
-# include <io.h>
-#else
-# include <sys/time.h>
 # include <unistd.h>
-# include <sys/select.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
-# include <sys/socket.h>
-# include <netdb.h>
-# include <cerrno>
-# include <sys/param.h>
-# include <sys/select.h>
 #endif
 
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/scoped_array.hpp>
 
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 256
-#endif
-
 #define GNASH_XMLSOCKET_DEBUG
 
-int xml_fd = 0;                 // FIXME: This file descriptor is used by
-                                // XML::checkSocket() when called from the main
-                                // processing loop. 
-
 namespace gnash {
 
 static as_value xmlsocket_connect(const fn_call& fn);
@@ -89,16 +70,12 @@
 static void attachXMLSocketInterface(as_object& o);
 static void attachXMLSocketProperties(as_object& o);
 
-const int SOCKET_DATA = 1;
-  
-const int INBUF = 10000;
-
-class DSOLOCAL xmlsocket_as_object : public gnash::as_object
+class XMLSocket_as : public as_object
 {
 
 public:
 
-        xmlsocket_as_object()
+        XMLSocket_as()
                 :
                 as_object(getXMLSocketInterface())
         {
@@ -122,15 +99,13 @@
 
   
 XMLSocket::XMLSocket()
+    :
+    _data(false),
+    _xmldata(false),
+    _closed(false),
+    _processing(false)
 {
-//    GNASH_REPORT_FUNCTION;
-    _data = false;
-    _xmldata = false;
-    _closed = false;
-    _processing = false;
-    _port = 0;
-    _sockfd = 0;
-    xml_fd = 0;
+    GNASH_REPORT_FUNCTION;
 }
 
 XMLSocket::~XMLSocket()
@@ -197,25 +172,23 @@
 bool
 XMLSocket::anydata(int fd, MessageList& msgs)
 {
-    //GNASH_REPORT_FUNCTION;
-
-    fd_set                fdset;
-    struct timeval        tval;
-    int                   ret = 0;
-    char                  buf[INBUF];
-    char                  *packet;
-    int                   retries = 10;
-    char                  *ptr, *eom;
-    int                   cr, index = 0;
-    boost::scoped_array<char> leftover;
-    int                   adjusted_size;
-    
-    
+   
     if (fd <= 0) {
        log_error(_("%s: fd <= 0, returning false (timer not unregistered while 
socket disconnected?"), __FUNCTION__);
         return false;
     }
-    
+
+
+    //GNASH_REPORT_FUNCTION;
+
+
+    fd_set                fdset;
+    struct timeval        tval;
+    size_t retries = 10;
+
+    const int bufSize = 10000;
+    boost::scoped_array<char> buf(new char[bufSize]);
+
     while (retries-- > 0) {
         FD_ZERO(&fdset);
         FD_SET(fd, &fdset);
@@ -223,7 +196,7 @@
         tval.tv_sec = 0;
         tval.tv_usec = 103;
         
-        ret = ::select(fd+1, &fdset, NULL, NULL, &tval);
+        int ret = select(fd + 1, &fdset, NULL, NULL, &tval);
         
         // If interupted by a system call, try again
         if (ret == -1 && errno == EINTR) {
@@ -245,86 +218,24 @@
             //log_debug(_("%s: There is data in the socket for fd #%d"),
             //    __FUNCTION__, fd);
         }
-        memset(buf, 0, INBUF);
-        ret = ::read(_sockfd, buf, INBUF-2);
-        cr = strlen(buf);
-        log_debug(_("%s: read %d bytes, first msg terminates at %d"), 
__FUNCTION__, ret, cr);
-        //log_debug(_("%s: read (%d,%d) %s"), __FUNCTION__, buf[0], buf[1], 
buf);
-        ptr = buf;
-        // If we get a single XML message, do less work
-        if (ret == cr + 1)
-               {
-            adjusted_size = memadjust(ret + 1);
-            packet = new char[adjusted_size];
-            log_debug(_("Packet size is %d at %p"), ret + 1, packet);
-            memset(packet, 0, adjusted_size);
-            strcpy(packet, ptr);
-            eom = strrchr(packet, '\n'); // drop the CR off the end if there 
is one
-            if (eom) {
-                *eom = 0;
-            }
-            msgs.push_back( packet );
-            log_debug(_("%d: Pushing Packet of size %d at %p"), __LINE__, 
strlen(packet), packet);
-            processing(false);
-            return true;
-        }
-        
-        // If we get multiple messages in a single transmission, break the 
buffer
-        // into separate messages.
-        while (strchr(ptr, '\n') > 0) {
-            if (leftover) {
-                processing(false);
-                //log_debug(_("%s: The remainder is: \"%s\""), __FUNCTION__, 
leftover.get());
-                //log_debug(_("%s: The rest of the message is: \"%s\""), 
__FUNCTION__, ptr);
-                adjusted_size = memadjust(cr + strlen(leftover.get()) + 1);
-                packet = new char[adjusted_size];
-                memset(packet, 0, adjusted_size);
-                strcpy(packet, leftover.get());
-                strcat(packet, ptr);
-                eom = strrchr(packet, '\n'); // drop the CR off the end there 
is one
-                if (eom) {
-                    *eom = 0;
-                }
-                //log_debug(_("%s: The whole message is: \"%s\""), 
__FUNCTION__, packet);
-                ptr = strchr(ptr, '\n') + 2; // messages are delimited by a 
"\n\0"
-                leftover.reset();
-            } else {
-                adjusted_size = memadjust(cr + 1);
-                packet = new char[adjusted_size];
-                memset(packet, 0, adjusted_size);
-                strcpy(packet, ptr);
-                ptr += cr + 1;
-            } // end of if remainder
-            if (*packet == '<') {
-                //log_debug(_("%d: Pushing Packet #%d of size %d at %p: %s"), 
__LINE__,
-                //       data.size(), strlen(packet), packet, packet);
-                eom = strrchr(packet, '\n'); // drop the CR off the end there 
is one
-                if (eom) {
-                    *eom = 0;
-                }
-                //log_debug(_("Allocating new packet at %p"), packet);
-                //data.push_back(packet);
-                msgs.push_back( std::string(packet) );
-            } else {
-                log_error(_("Throwing out partial packet %s"), packet);
-            }
-            
-            //log_debug(_("%d messages in array now"), data.size());
-            cr = strlen(ptr);
-        } // end of while (cr)
-        
-        if (strlen(ptr) > 0) {
-            leftover.reset( new char[strlen(ptr) + 1] );
-            strcpy(leftover.get(), ptr);
-            processing(true);
-            //log_debug(_("%s: Adding remainder: \"%s\""), __FUNCTION__, 
leftover.get());
+
+        processing(true);
+
+        ret = read(_sockfd, buf.get(), bufSize - 1);
+        buf[ret + 1] = 0;
+
+        char* ptr = buf.get();
+        while (ptr -buf.get() < ret )
+        {
+            msgs.push_back(ptr);
+            ptr += strlen(ptr) + 1;
         }
         
         processing(false);
         log_debug(_("%s: Returning %d messages"), __FUNCTION__, index);
         return true;
         
-    } // end of while (retires)
+    }
     
     return true;
 }
@@ -341,9 +252,10 @@
        return false;
     }
     
-    int ret = write(_sockfd, str.c_str(), str.size());
+    // We have to write the NULL terminator as well.
+    int ret = write(_sockfd, str.c_str(), str.size() + 1);
     
-    log_debug(_("%s: sent %d bytes, data was %s"), __FUNCTION__, ret, 
str.c_str());
+    log_debug(_("%s: sent %d bytes, data was %s"), __FUNCTION__, ret, str);
     if (ret == static_cast<signed int>(str.size())) {
         return true;
     } else {
@@ -436,7 +348,7 @@
     log_debug(_("XMLSocket.connect(%s) called"), ss.str().c_str());
 #endif
 
-    boost::intrusive_ptr<xmlsocket_as_object> ptr = 
ensureType<xmlsocket_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<XMLSocket_as> ptr = 
ensureType<XMLSocket_as>(fn.this_ptr);
 
     if (ptr->obj.connected())
     {
@@ -484,7 +396,7 @@
 {
     GNASH_REPORT_FUNCTION;
     
-    boost::intrusive_ptr<xmlsocket_as_object> ptr = 
ensureType<xmlsocket_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<XMLSocket_as> ptr = 
ensureType<XMLSocket_as>(fn.this_ptr);
     const std::string& object = fn.arg(0).to_string();
     //  log_debug(_("%s: host=%s, port=%g"), __FUNCTION__, host, port);
     return as_value(ptr->obj.send(object));
@@ -495,7 +407,7 @@
 {
     GNASH_REPORT_FUNCTION;
     
-    boost::intrusive_ptr<xmlsocket_as_object> ptr = 
ensureType<xmlsocket_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<XMLSocket_as> ptr = 
ensureType<XMLSocket_as>(fn.this_ptr);
     // Since the return code from close() doesn't get used by Shockwave,
     // we don't care either.
     ptr->obj.close();
@@ -508,7 +420,7 @@
     //GNASH_REPORT_FUNCTION;
     //log_debug(_("%s: nargs=%d"), __FUNCTION__, nargs);
     
-    boost::intrusive_ptr<as_object> xmlsock_obj = new xmlsocket_as_object;
+    boost::intrusive_ptr<as_object> xmlsock_obj = new XMLSocket_as;
 
 #ifdef GNASH_XMLSOCKET_DEBUG
     std::stringstream ss;
@@ -530,7 +442,7 @@
     as_value   method;
     as_value   val;
     
-    boost::intrusive_ptr<xmlsocket_as_object> ptr = 
ensureType<xmlsocket_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<XMLSocket_as> ptr = 
ensureType<XMLSocket_as>(fn.this_ptr);
     if ( ! ptr->obj.connected() )
     {
         log_error(_("%s: not connected"), __FUNCTION__);
@@ -550,7 +462,7 @@
     as_value   method;
     as_value   val;
     
-    boost::intrusive_ptr<xmlsocket_as_object> ptr = 
ensureType<xmlsocket_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<XMLSocket_as> ptr = 
ensureType<XMLSocket_as>(fn.this_ptr);
 
     if ( fn.nargs < 1 )
     {
@@ -636,7 +548,7 @@
 }
 
 boost::intrusive_ptr<as_function>
-xmlsocket_as_object::getEventHandler(const std::string& name)
+XMLSocket_as::getEventHandler(const std::string& name)
 {
        boost::intrusive_ptr<as_function> ret;
 
@@ -648,7 +560,7 @@
 }
 
 void
-xmlsocket_as_object::checkForIncomingData()
+XMLSocket_as::checkForIncomingData()
 {
     assert(obj.connected());
 

=== modified file 'libcore/asobj/xmlsocket.h'
--- a/libcore/asobj/xmlsocket.h 2008-03-26 21:34:20 +0000
+++ b/libcore/asobj/xmlsocket.h 2008-08-19 17:04:47 +0000
@@ -15,8 +15,8 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#ifndef __XMLSOCKET_H__
-#define __XMLSOCKET_H__
+#ifndef GNASH_XMLSOCKET_H
+#define GNASH_XMLSOCKET_H
 
 #include "xml.h"
 #include "impl.h"
@@ -26,10 +26,8 @@
 #include <string>
 
 namespace gnash {
-
-extern const int SOCKET_DATA;
   
-class DSOLOCAL XMLSocket : public Network {
+class XMLSocket : public Network {
 public:
     XMLSocket();
     ~XMLSocket();

=== modified file 'libcore/event_id.h'
--- a/libcore/event_id.h        2008-06-06 09:51:39 +0000
+++ b/libcore/event_id.h        2008-08-19 20:37:40 +0000
@@ -68,14 +68,9 @@
                LOAD_INIT,
                
                // These are for the XMLSocket ActionScript only
-               SOCK_CLOSE,
-               SOCK_CONNECT,
-               SOCK_DATA,
-               SOCK_XML,
-               
-               // These are for the XML ActionScript only
-               XML_LOAD,
-               XML_DATA,
+               CLOSE,
+               CONNECT,
+               XML,
                
                // This is for setInterval
                TIMER,

=== modified file 'libcore/namedStrings.cpp'
--- a/libcore/namedStrings.cpp  2008-08-18 23:53:04 +0000
+++ b/libcore/namedStrings.cpp  2008-08-19 20:37:40 +0000
@@ -96,12 +96,8 @@
        string_table::svt( "onStatus", NSV::PROP_ON_STATUS ),
        string_table::svt( "onResult", NSV::PROP_ON_RESULT ),
        string_table::svt( "onMetaData", NSV::PROP_ON_META_DATA ),
-       string_table::svt( "onSockClose", NSV::PROP_ON_SOCK_CLOSE ),
-       string_table::svt( "onSockConnect", NSV::PROP_ON_SOCK_CONNECT ),
-       string_table::svt( "onSockData", NSV::PROP_ON_SOCK_DATA ),
-       string_table::svt( "onSockXML", NSV::PROP_ON_SOCK_XML ),
-       string_table::svt( "onXMLLoad", NSV::PROP_ON_XML_LOAD ),
-       string_table::svt( "onXMLData", NSV::PROP_ON_XML_DATA ),
+       string_table::svt( "onConnect", NSV::PROP_ON_CONNECT ),
+    string_table::svt( "onXML", NSV::PROP_ON_XML ),
        string_table::svt( "parseXML", NSV::PROP_PARSE_XML ),
        string_table::svt( "onTimer", NSV::PROP_ON_TIMER ),
        string_table::svt( "_parent", NSV::PROP_uPARENT ),

=== modified file 'libcore/namedStrings.h'
--- a/libcore/namedStrings.h    2008-08-18 23:53:04 +0000
+++ b/libcore/namedStrings.h    2008-08-19 20:37:40 +0000
@@ -114,12 +114,8 @@
                PROP_ON_STATUS,
                PROP_ON_RESULT,
                PROP_ON_META_DATA,
-               PROP_ON_SOCK_CLOSE,
-               PROP_ON_SOCK_CONNECT,
-               PROP_ON_SOCK_DATA,
-               PROP_ON_SOCK_XML,
-               PROP_ON_XML_LOAD,
-               PROP_ON_XML_DATA,
+               PROP_ON_CONNECT,
+               PROP_ON_XML,
                PROP_PARSE_XML,
                PROP_ON_TIMER,
                PROP_uPARENT,

=== modified file 'libcore/sprite_instance.h'
--- a/libcore/sprite_instance.h 2008-07-09 07:33:34 +0000
+++ b/libcore/sprite_instance.h 2008-08-19 20:37:40 +0000
@@ -590,7 +590,7 @@
     virtual void    on_event_xmlsocket_onxml()
     {
         log_debug("FIXME: %s: unimplemented\n", __FUNCTION__);
-        on_event(event_id::SOCK_XML);
+        on_event(event_id::XML);
     }
         
     /// Do the events that (appear to) happen on a

=== modified file 'libcore/vm/action.cpp'
--- a/libcore/vm/action.cpp     2008-05-29 14:40:43 +0000
+++ b/libcore/vm/action.cpp     2008-08-19 20:37:40 +0000
@@ -120,7 +120,6 @@
                "onDragOut",             // DRAG_OUT
                "onKeyPress",            // KEY_PRESS
                "onInitialize",          // INITIALIZE
-
                "onLoad",                // LOAD
                "onUnload",              // UNLOAD
                "onEnterFrame",          // ENTER_FRAME
@@ -130,21 +129,14 @@
                "onKeyDown",             // KEY_DOWN
                "onKeyUp",               // KEY_UP
                "onData",                // DATA
-               // These are for the MoveClipLoader ActionScript only
                "onLoadStart",           // LOAD_START
                "onLoadError",           // LOAD_ERROR
                "onLoadProgress",        // LOAD_PROGRESS
                "onLoadInit",            // LOAD_INIT
-               // These are for the XMLSocket ActionScript only
-               "onSockClose",           // CLOSE
-               "onSockConnect",         // CONNECT
-               "onSockData",            // Data
-               "onSockXML",             // XML
-               // These are for the XML ActionScript only
-               "onXMLLoad",             // XML_LOAD
-               "onXMLData",             // XML_DATA
+               "onClose",               // CLOSE
+               "onConnect",     // CONNECT
+               "onXML",                 // XML
                "onTimer",               // setInterval Timer expired
-
                "onConstruct",
                "onSetFocus",
                "onKillFocus"
@@ -170,7 +162,6 @@
                NSV::PROP_ON_DRAG_OUT,          // DRAG_OUT
                NSV::PROP_ON_KEY_PRESS,         // KEY_PRESS
                NSV::PROP_ON_INITIALIZE,        // INITIALIZE
-
                NSV::PROP_ON_LOAD,              // LOAD
                NSV::PROP_ON_UNLOAD,            // UNLOAD
                NSV::PROP_ON_ENTER_FRAME,       // ENTER_FRAME
@@ -180,26 +171,21 @@
                NSV::PROP_ON_KEY_DOWN,          // KEY_DOWN
                NSV::PROP_ON_KEY_UP,            // KEY_UP
                NSV::PROP_ON_DATA,              // DATA
-               // These are for the MoveClipLoader ActionScript only
                NSV::PROP_ON_LOAD_START,        // LOAD_START
                NSV::PROP_ON_LOAD_ERROR,        // LOAD_ERROR
                NSV::PROP_ON_LOAD_PROGRESS,     // LOAD_PROGRESS
                NSV::PROP_ON_LOAD_INIT,         // LOAD_INIT
-               // These are for the XMLSocket ActionScript only
-               NSV::PROP_ON_SOCK_CLOSE,        // CLOSE
-               NSV::PROP_ON_SOCK_CONNECT,      // CONNECT
-               NSV::PROP_ON_SOCK_DATA,         // Data
-               NSV::PROP_ON_SOCK_XML,          // XML
-               // These are for the XML ActionScript only
-               NSV::PROP_ON_XML_LOAD,          // XML_LOAD
-               NSV::PROP_ON_XML_DATA,          // XML_DATA
+               NSV::PROP_ON_CLOSE,     // CLOSE
+               NSV::PROP_ON_CONNECT,   // CONNECT
+               NSV::PROP_ON_XML,               // XML
                NSV::PROP_ON_TIMER,             // setInterval Timer expired
-
                NSV::PROP_ON_CONSTRUCT,         // onConstruct
                NSV::PROP_ON_SET_FOCUS,         // onSetFocus
                NSV::PROP_ON_KILL_FOCUS         // onKillFocus
        };
 
+    log_debug("m_id: %d", m_id);
+
        assert(m_id > INVALID && m_id < EVENT_COUNT);
        return function_keys[m_id];
 }

=== modified file 'testsuite/XmlSocketServer.pl'
--- a/testsuite/XmlSocketServer.pl      2008-08-20 12:47:44 +0000
+++ b/testsuite/XmlSocketServer.pl      2008-08-20 16:15:55 +0000
@@ -17,13 +17,13 @@
             $O->add($C);
         }
         else {
-            my $R=sysread($_, $i, 2048);
+            my $R=sysread($_, $i, 16000);
             
             # Log message received:
             print "XmlSocketServer: received \"$i\"\n";
             
             if ($R==0) {
-                $T=syswrite($_, "\n", 2048);
+                $T=syswrite($_, "\n", 16000);
                 if ($T==undef) {
                     $O->remove($_);
                 }
@@ -35,13 +35,14 @@
                 Time::HiRes::sleep(0.5);
                 print "XmlSocketServer: sending \"$i\" \n";
               
-                $i =~ s/\*NEWLINE\*/\n/;
-                $i =~ s/\*NULL\*/\0/;
+                $i =~ s/\*NEWLINE\*/\n/g;
+                $i =~ s/\*NULL\*/\0/g;
 
                 foreach $C($O->handles) {
-                    $T=syswrite($C, $i, 2048);
+                    $T=syswrite($C, $i, 16000);
                 }
             }
         }
     }
 }
+

=== modified file 'testsuite/libbase/TCXXRc.cpp'
--- a/testsuite/libbase/TCXXRc.cpp      2008-01-21 23:26:48 +0000
+++ b/testsuite/libbase/TCXXRc.cpp      2008-08-19 17:04:47 +0000
@@ -59,14 +59,6 @@
                                // can optimize it's own performance
                                // when needed,
 
-#ifdef HAVE_LIBXML
-extern int xml_fd;             // FIXME: this is the file descriptor
-                               // from XMLSocket::connect(). This
-                               // needs to be propogated up through
-                               // the layers properly, but first I
-                               // want to make sure it all works.
-#endif // HAVE_LIBXML
-
 TestState runtest;
 
 int

=== modified file 'testsuite/misc-ming.all/XMLSocketTest.c'
--- a/testsuite/misc-ming.all/XMLSocketTest.c   2008-08-20 12:47:44 +0000
+++ b/testsuite/misc-ming.all/XMLSocketTest.c   2008-08-20 16:15:55 +0000
@@ -43,6 +43,8 @@
     SWFMovie mo;
        const char* srcdir = ".";
 
+    char longString[15000];
+
        if ( argc>1 ) srcdir=argv[1];
        else
        {
@@ -54,7 +56,7 @@
 
     mo = newSWFMovieWithVersion(OUTPUT_VERSION);
     SWFMovie_setDimension(mo, 800, 600);
-    SWFMovie_setRate (mo, 4.0);
+    SWFMovie_setRate (mo, 10.0);
 
     dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 
0, 800, 600);
     SWFMovie_add(mo, (SWFBlock)dejagnuclip);
@@ -129,9 +131,17 @@
         "xmlArray[8] = undefined;"
         "xmlArray[9] = 9;"
         "xmlArray[10] = '';"
-        "xmlArray[11] = 'Last Item';"
     );
 
+    memset(longString, 'a', 15000);
+    strncpy(longString, "xmlArray[11] = '", 16);
+    longString[14998] = '\'';
+    longString[14999] = ';';
+
+    add_actions(mo, longString);
+
+    add_actions(mo, "xmlArray[12] = 'Last Item';");
+
     /* The data we should get back */
     add_actions(mo, 
         "expectedArray = new Array();"
@@ -150,7 +160,8 @@
         "expectedArray[12] = 'undefined';"
         "expectedArray[13] = 9;"
         "expectedArray[14] = '';"
-        "expectedArray[15] = 'Last Item';"
+        "expectedArray[15] = 'aaa';"
+        "expectedArray[16] = 'Last Item';"
     );
 
 
@@ -214,7 +225,7 @@
     SWFMovie_nextFrame(mo);
 
     add_actions(mo,
-        "if (receivedArray[receivedArray.length -1] != 'Last Item' && wait++ < 
10)"
+        "if (receivedArray[receivedArray.length -1] != 'Last Item' && wait++ < 
100)"
         "{ _root.gotoAndStop(6); };"
         "play();"
     );
@@ -236,6 +247,15 @@
     check_equals(mo, "receivedArray[8]", "expectedArray[8]");
     check_equals(mo, "receivedArray[9]", "expectedArray[9]");
     check_equals(mo, "receivedArray[10]", "expectedArray[10]");    
+    check_equals(mo, "receivedArray[11]", "expectedArray[11]"); 
+    check_equals(mo, "receivedArray[12]", "expectedArray[12]"); 
+    check_equals(mo, "receivedArray[13]", "expectedArray[13]");         
+    check_equals(mo, "receivedArray[14]", "expectedArray[14]");
+    check_equals(mo, "receivedArray[15].length", "14982");         
+    
+             
+    check_equals(mo, "receivedArray[16]", "expectedArray[16]");         
+
     
 
     add_actions(mo, "totals(); stop();");
@@ -246,3 +266,4 @@
 
   return 0;
 }
+


reply via email to

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