CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 08/01/25 18:48:30
Modified files: . : ChangeLog libamf : lcshm.cpp lcshm.h server/asobj : LocalConnection.cpp testsuite/libamf.all: test_lc.cpp testsuite/misc-ming.all: NetStream-SquareTest.c utilities : dumpshm.cpp Log message: * libamf/lcshm.{cpp,h}, server/asobj/LocalConnection.cpp, testsuite/libamf.all/test_lc.cpp, utilities/dumpshm.cpp: Use std::auto_ptr for returning newly allocated stuff while transferring ownerhips to caller. * testsuite/misc-ming.all/NetStream-SquareTest.c: add some newlines to workaround some bug in Ming head. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5495&r2=1.5496 http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/lcshm.cpp?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/lcshm.h?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LocalConnection.cpp?cvsroot=gnash&r1=1.19&r2=1.20 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libamf.all/test_lc.cpp?cvsroot=gnash&r1=1.3&r2=1.4 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/NetStream-SquareTest.c?cvsroot=gnash&r1=1.23&r2=1.24 http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/dumpshm.cpp?cvsroot=gnash&r1=1.21&r2=1.22 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5495 retrieving revision 1.5496 diff -u -b -r1.5495 -r1.5496 --- ChangeLog 25 Jan 2008 18:07:58 -0000 1.5495 +++ ChangeLog 25 Jan 2008 18:48:29 -0000 1.5496 @@ -1,3 +1,12 @@ +2008-01-25 Sandro Santilli <[EMAIL PROTECTED]> + + * libamf/lcshm.{cpp,h}, server/asobj/LocalConnection.cpp, + testsuite/libamf.all/test_lc.cpp, utilities/dumpshm.cpp: + Use std::auto_ptr for returning newly allocated stuff + while transferring ownerhips to caller. + * testsuite/misc-ming.all/NetStream-SquareTest.c: add some newlines + to workaround some bug in Ming head. + 2008-01-25 Rob Savoye <[EMAIL PROTECTED]> * libamf/amf.cpp: Make extractElement() only process a single Index: libamf/lcshm.cpp =================================================================== RCS file: /sources/gnash/gnash/libamf/lcshm.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- libamf/lcshm.cpp 25 Jan 2008 18:08:00 -0000 1.5 +++ libamf/lcshm.cpp 25 Jan 2008 18:48:29 -0000 1.6 @@ -186,11 +186,11 @@ return false; } -vector<string> * +auto_ptr< vector<string> > Listener::listListeners() { // GNASH_REPORT_FUNCTION; - vector<string> *listeners = new vector<string>; + auto_ptr< vector<string> > listeners ( new vector<string> ); if (_baseaddr != 0) { boost::uint8_t *addr = _baseaddr + LC_LISTENERS_START; @@ -409,7 +409,7 @@ } vector<string>::const_iterator lit; - vector<string> *listeners = listListeners(); + auto_ptr< vector<string> > listeners ( listListeners() ); for (lit=listeners->begin(); lit!=listeners->end(); lit++) { string str = *lit; if (str[0] != ':') { @@ -417,7 +417,6 @@ // total++; } } - delete listeners; } } // end of gnash namespace Index: libamf/lcshm.h =================================================================== RCS file: /sources/gnash/gnash/libamf/lcshm.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- libamf/lcshm.h 25 Jan 2008 18:08:00 -0000 1.5 +++ libamf/lcshm.h 25 Jan 2008 18:48:29 -0000 1.6 @@ -43,7 +43,7 @@ bool addListener(std::string &name); bool findListener(std::string &name); bool removeListener(std::string &name); - std::vector<std::string> *listListeners(); + std::auto_ptr< std::vector<std::string> > listListeners(); void setBaseAddress(boost::uint8_t *addr) { _baseaddr = addr; }; boost::uint8_t *getBaseAddress() { return _baseaddr; }; protected: Index: server/asobj/LocalConnection.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/LocalConnection.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -b -r1.19 -r1.20 --- server/asobj/LocalConnection.cpp 21 Jan 2008 20:55:56 -0000 1.19 +++ server/asobj/LocalConnection.cpp 25 Jan 2008 18:48:29 -0000 1.20 @@ -154,14 +154,14 @@ return false; } -std::vector<std::string> * +auto_ptr< vector<string> > Listener::listListeners() { GNASH_REPORT_FUNCTION; boost::uint8_t *addr = _baseaddr + LC_LISTENERS_START; - vector<string> *listeners = new vector<string>; + auto_ptr< vector<string> > listeners ( new vector<string> ); const char *item = reinterpret_cast<char *>(addr); while (*item != 0) { listeners->push_back(item); @@ -217,7 +217,7 @@ addListener(str1); vector<string>::const_iterator it; - vector<string> *listeners = listListeners(); + auto_ptr< vector<string> > listeners ( listListeners() ); if (listeners->size() == 0) { log_msg("Nobody is listening"); } else { @@ -228,8 +228,6 @@ } } - delete listeners; - str1 = "HelloWorld"; removeListener(str1); listeners = listListeners(); @@ -239,7 +237,6 @@ log_debug("Listeners: %s", str.c_str()); } - delete listeners; #endif // } return true; Index: testsuite/libamf.all/test_lc.cpp =================================================================== RCS file: /sources/gnash/gnash/testsuite/libamf.all/test_lc.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- testsuite/libamf.all/test_lc.cpp 25 Jan 2008 18:07:58 -0000 1.3 +++ testsuite/libamf.all/test_lc.cpp 25 Jan 2008 18:48:29 -0000 1.4 @@ -134,7 +134,7 @@ Listener list(reinterpret_cast<uint8_t *>(shmaddr)); vector<string>::const_iterator it; - vector<string> *listeners = list.listListeners(); + auto_ptr< vector<string> > listeners ( list.listListeners() ); if (listeners->size() == 0) { cout << "Nobody is listening" << endl; } else { @@ -156,8 +156,8 @@ // list.addListener(filespec); - listeners = list.listListeners(); - if (listeners->size() == 0) { + listeners.reset( list.listListeners() ); + if (listeners->empty()) { cout << "Nobody is listening" << endl; } else { for (it=listeners->begin(); it!=listeners->end(); it++) { @@ -399,8 +399,8 @@ addListener(str1); vector<string>::const_iterator it; - vector<string> *listeners = listListeners(); - if (listeners->size() == 0) { + auto_ptr< vector<string> > listeners ( listListeners() ); + if (listeners->empty()) { log_msg("Nobody is listening"); } else { log_msg("There are %d", listeners->size()); @@ -410,17 +410,14 @@ } } - delete listeners; - str1 = "HelloWorld"; removeListener(str1); - listeners = listListeners(); + listeners.reset( listListeners() ); log_msg("There are %d", listeners->size()); for (it=listeners->begin(); it != listeners->end(); it++) { string str = *it; log_debug("Listeners: %s", str.c_str()); } - delete listeners; #endif // } Index: testsuite/misc-ming.all/NetStream-SquareTest.c =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/NetStream-SquareTest.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- testsuite/misc-ming.all/NetStream-SquareTest.c 22 Jan 2008 14:37:10 -0000 1.23 +++ testsuite/misc-ming.all/NetStream-SquareTest.c 25 Jan 2008 18:48:30 -0000 1.24 @@ -266,6 +266,8 @@ "};" + "\n" + "stream.onCuePoint = function(info) {" " _root.note('onCuePoint('+info+') called'); " "};" @@ -288,6 +290,9 @@ " }" " xcheck_equals(enu.length, 11);" // gnash contains 2 more + "\n" + + // Test composision " check(info.hasOwnProperty('filesize'), 'metadata has filesize');" @@ -306,6 +311,8 @@ " delete info.audiocodecid;" " check(!info.hasOwnProperty('audiocodecid'), 'metadata audiocodecid can be deleted');" + "\n" + " check(info.hasOwnProperty('stereo'), 'metadata has stereo');" " check_equals(typeof(info.stereo), 'boolean', 'stereo is boolean');" " check_equals(info.stereo, false, 'actual stereo');" @@ -322,6 +329,8 @@ " delete info.audiosamplesize;" " check(!info.hasOwnProperty('audiosamplesize'), 'metadata audiosamplesize can be deleted');" + "\n" + " check(info.hasOwnProperty('audiosamplerate'), 'metadata has audiosamplerate');" " check_equals(typeof(info.audiosamplerate), 'number', 'audiosamplerate is a number');" " check_equals(info.audiosamplerate, 44100, 'actual audiosamplerate');" @@ -338,6 +347,8 @@ " delete info.videocodecid;" " check(!info.hasOwnProperty('videocodecid'), 'metadata videocodecid can be deleted');" + "\n" + " check(info.hasOwnProperty('height'), 'metadata has height');" " check_equals(typeof(info.height), 'number', 'height is a number');" " check_equals(info.height, 96, 'actual height');" @@ -354,6 +365,8 @@ " delete info.width;" " check(!info.hasOwnProperty('width'), 'metadata width can be deleted');" + "\n" + " check(info.hasOwnProperty('duration'), 'metadata has duration');" " check_equals(typeof(info.duration), 'number', 'duration is a number');" " check_equals(info.duration, 2.299, 'actual duration');" // seconds, rounded to milliseconds Index: utilities/dumpshm.cpp =================================================================== RCS file: /sources/gnash/gnash/utilities/dumpshm.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -b -r1.21 -r1.22 --- utilities/dumpshm.cpp 25 Jan 2008 18:07:58 -0000 1.21 +++ utilities/dumpshm.cpp 25 Jan 2008 18:48:30 -0000 1.22 @@ -344,7 +344,7 @@ LcShm lc; lc.connect(key); - vector<string> *listeners = lc.listListeners(); + auto_ptr< vector<string> > listeners ( lc.listListeners() ); cout << "There are " << listeners->size() << " Listeners listening" << endl; lc.dump(); @@ -360,7 +360,6 @@ close(fd); } - delete listeners; exit (0); } _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit