CVSROOT: /sources/gnash Module name: gnash Changes by: Rob Savoye <rsavoye> 07/09/15 17:53:09
Modified files: . : ChangeLog libbase : Makefile.am extension.cpp gstgnashsrc.h lirc.cpp lirc.h network.cpp sharedlib.cpp smart_ptr.h extensions : Makefile.am extensions/gtk2: gtkext.cpp extensions/lirc: test.as Log message: * libbase/test.as: Only execute tests if the Lirc extension is installed. Check return codes for a clean exit. * libbase/lirc.cpp: Reduce debugging verbosity. Return a pointer with real memory behind it instead of by acident. * libbase/lirc.h: Add a field to contain the button name. * libbase/network.cpp: Don't just see if fd is set, make sure it's greater than zero to avoid problems! CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4324&r2=1.4325 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/Makefile.am?cvsroot=gnash&r1=1.82&r2=1.83 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/extension.cpp?cvsroot=gnash&r1=1.12&r2=1.13 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/gstgnashsrc.h?cvsroot=gnash&r1=1.8&r2=1.9 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/lirc.cpp?cvsroot=gnash&r1=1.1&r2=1.2 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/lirc.h?cvsroot=gnash&r1=1.1&r2=1.2 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/network.cpp?cvsroot=gnash&r1=1.31&r2=1.32 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/sharedlib.cpp?cvsroot=gnash&r1=1.17&r2=1.18 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/smart_ptr.h?cvsroot=gnash&r1=1.22&r2=1.23 http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/Makefile.am?cvsroot=gnash&r1=1.11&r2=1.12 http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/gtk2/gtkext.cpp?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/lirc/test.as?cvsroot=gnash&r1=1.1&r2=1.2 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4324 retrieving revision 1.4325 diff -u -b -r1.4324 -r1.4325 --- ChangeLog 15 Sep 2007 16:42:55 -0000 1.4324 +++ ChangeLog 15 Sep 2007 17:53:08 -0000 1.4325 @@ -1,5 +1,13 @@ 2007-09-15 Rob Savoye <[EMAIL PROTECTED]> + * libbase/test.as: Only execute tests if the Lirc extension is + installed. Check return codes for a clean exit. + * libbase/lirc.cpp: Reduce debugging verbosity. Return a pointer + with real memory behind it instead of by acident. + * libbase/lirc.h: Add a field to contain the button name. + * libbase/network.cpp: Don't just see if fd is set, make sure it's + greater than zero to avoid problems! + * extensions/lirc/test.as: Test case for Lirc extension. 2007-09-14 Rob Savoye <[EMAIL PROTECTED]> Index: libbase/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/libbase/Makefile.am,v retrieving revision 1.82 retrieving revision 1.83 diff -u -b -r1.82 -r1.83 --- libbase/Makefile.am 13 Sep 2007 09:47:31 -0000 1.82 +++ libbase/Makefile.am 15 Sep 2007 17:53:08 -0000 1.83 @@ -83,6 +83,7 @@ extension.cpp \ image.cpp \ jpeg.cpp \ + lirc.cpp \ log.cpp \ membuf.cpp \ network.cpp \ @@ -122,6 +123,7 @@ membuf.h \ network.h \ hash_wrapper.h \ + lirc.h \ log.h \ ogl.h \ postscript.h \ Index: libbase/extension.cpp =================================================================== RCS file: /sources/gnash/gnash/libbase/extension.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -b -r1.12 -r1.13 --- libbase/extension.cpp 1 Jul 2007 10:54:08 -0000 1.12 +++ libbase/extension.cpp 15 Sep 2007 17:53:09 -0000 1.13 @@ -16,7 +16,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -/* $Id: extension.cpp,v 1.12 2007/07/01 10:54:08 bjacques Exp $ */ +/* $Id: extension.cpp,v 1.13 2007/09/15 17:53:09 rsavoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -113,7 +113,6 @@ Extension::scanAndLoad(as_object &obj) { // GNASH_REPORT_FUNCTION; -// const char *mod; string mod; if (_modules.size() == 0) { @@ -179,7 +178,8 @@ struct dirent *entry; //string::size_type pos; char *dirlistcopy; - char *dir; + char *dir, libsdir; + char *suffix = 0; // scoped_lock lock(lib_mutex); @@ -199,28 +199,33 @@ return false; } - // By convention, the first two entries in each directory are for . and - // .. (``dot'' and ``dot dot''), so we ignore those. - entry = readdir(library_dir); - entry = readdir(library_dir); - for (i=0; entry>0; i++) { // We only want shared libraries than end with the suffix, otherwise // we get all the duplicates. entry = readdir(library_dir); - if (entry <= NULL) { - break; + + if (entry <= NULL) { // All done + continue; } - if (strstr(entry->d_name, ".la") == 0) { + if (strncmp(entry->d_name, ".", 1) == 0) { continue; } - *(strrchr(entry->d_name, '.')) = 0; + suffix = strrchr(entry->d_name, '.'); + if (suffix == 0) { + continue; + } + + if (strcmp(suffix, ".so") == 0) { + *suffix = 0; log_msg(_("Gnash Plugin name: %s"), entry->d_name); _modules.push_back(entry->d_name); - + } else { + continue; + } } + if (closedir(library_dir) != 0) { return false; } Index: libbase/gstgnashsrc.h =================================================================== RCS file: /sources/gnash/gnash/libbase/gstgnashsrc.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -b -r1.8 -r1.9 --- libbase/gstgnashsrc.h 1 Jul 2007 10:54:08 -0000 1.8 +++ libbase/gstgnashsrc.h 15 Sep 2007 17:53:09 -0000 1.9 @@ -18,7 +18,7 @@ // Based on the filesrc and fdsrc element in Gstreamer-core // -/* $Id: gstgnashsrc.h,v 1.8 2007/07/01 10:54:08 bjacques Exp $ */ +/* $Id: gstgnashsrc.h,v 1.9 2007/09/15 17:53:09 rsavoye Exp $ */ #ifndef __GST_GNASH_SRC_H__ #define __GST_GNASH_SRC_H__ Index: libbase/lirc.cpp =================================================================== RCS file: /sources/gnash/gnash/libbase/lirc.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- libbase/lirc.cpp 15 Sep 2007 03:06:37 -0000 1.1 +++ libbase/lirc.cpp 15 Sep 2007 17:53:09 -0000 1.2 @@ -36,31 +36,37 @@ // them, it should work for us. const int LIRC_PACKET_SIZE = 128; const int TIMEOUT = 10; +const int BUTTONSIZE = 10; Lirc::Lirc() - : sockname("/tmp/lircd") + : _sockname("/tmp/lircd"), _button(0) { - GNASH_REPORT_FUNCTION; +// GNASH_REPORT_FUNCTION; + _button = new char[BUTTONSIZE]; } Lirc::~Lirc() { - GNASH_REPORT_FUNCTION; +// GNASH_REPORT_FUNCTION; + if (_button != 0) { + delete _button; + } closeNet(); } bool Lirc::init() { - GNASH_REPORT_FUNCTION; - return connectSocket(sockname); +// GNASH_REPORT_FUNCTION; + return connectSocket(_sockname); } bool Lirc::init(const char *sockpath) { - GNASH_REPORT_FUNCTION; - return connectSocket(sockpath); +// GNASH_REPORT_FUNCTION; + _connected = connectSocket(sockpath); + return _connected; } // Whenever lircd receives a IR signal it will broadcast the @@ -73,13 +79,13 @@ gnash::key::code Lirc::getKey() { - GNASH_REPORT_FUNCTION; - +// GNASH_REPORT_FUNCTION; key::code key; char buf[LIRC_PACKET_SIZE]; memset(buf, 0, LIRC_PACKET_SIZE); + // read the data if there is any readNet(buf, LIRC_PACKET_SIZE, TIMEOUT); string packet = buf; @@ -87,7 +93,6 @@ string::size_type space2 = packet.find(" ", space1) + 1; string::size_type space3 = packet.find(" ", space2) +1; - // read the data if there is any string code_str = packet.substr(0, space1); string count_str = packet.substr(space1, space2-space1); string button_str = packet.substr(space2,space3-space2); @@ -109,52 +114,20 @@ char buf[LIRC_PACKET_SIZE]; memset(buf, 0, LIRC_PACKET_SIZE); + // read the data if there is any readNet(buf, LIRC_PACKET_SIZE, TIMEOUT); string packet = buf; string::size_type space1 = packet.find(" ") + 1; string::size_type space2 = packet.find(" ", space1) + 1; - string::size_type space3 = packet.find(" ", space2) +1; - + string::size_type space3 = packet.find(" ", space2) + 1; - // read the data if there is any - string button_str = packet.substr(space2, space3-space2); - - return button_str.c_str(); -} - -#if 0 -char * -Lirc::parseCode(char *packet) -{ - GNASH_REPORT_FUNCTION; - - char *ptr; - ptr = strchr(packet, " "); - - return ptr; -} - -int -Lirc::parseCount(char *packet) -{ - GNASH_REPORT_FUNCTION; - -} - -char * -Lirc::parseButtonName(char *packet) -{ - GNASH_REPORT_FUNCTION; - -} -char * -Lirc::parseControlName(char *packet) -{ - GNASH_REPORT_FUNCTION; + string button_str = packet.substr(space2, space3-space2-1); + memset(_button, 0, BUTTONSIZE); + strncpy(_button, button_str.c_str(), BUTTONSIZE); + return _button; } -#endif } // end of gnash namespace Index: libbase/lirc.h =================================================================== RCS file: /sources/gnash/gnash/libbase/lirc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- libbase/lirc.h 15 Sep 2007 03:06:37 -0000 1.1 +++ libbase/lirc.h 15 Sep 2007 17:53:09 -0000 1.2 @@ -39,14 +39,9 @@ // <code> <repeat count> <button name> <remote control name> gnash::key::code getKey(); const char *getButton(); -#if 0 - char *parseCode(char *packet); - int parseCount(char *packet); - char *parseButtonName(char *packet); - char *parseControlName(char *packet); -#endif private: - const char *sockname; + const char *_sockname; + char *_button; }; } // end of gnash namespace Index: libbase/network.cpp =================================================================== RCS file: /sources/gnash/gnash/libbase/network.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -b -r1.31 -r1.32 --- libbase/network.cpp 15 Sep 2007 04:03:13 -0000 1.31 +++ libbase/network.cpp 15 Sep 2007 17:53:09 -0000 1.32 @@ -669,7 +669,7 @@ + static_cast<double>(tp.tv_usec*1e-6); } #endif - if (fd) { + if (fd > 0) { FD_ZERO(&fdset); FD_SET(fd, &fdset); Index: libbase/sharedlib.cpp =================================================================== RCS file: /sources/gnash/gnash/libbase/sharedlib.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -b -r1.17 -r1.18 --- libbase/sharedlib.cpp 1 Jul 2007 10:54:10 -0000 1.17 +++ libbase/sharedlib.cpp 15 Sep 2007 17:53:09 -0000 1.18 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: sharedlib.cpp,v 1.17 2007/07/01 10:54:10 bjacques Exp $ */ +/* $Id: sharedlib.cpp,v 1.18 2007/09/15 17:53:09 rsavoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -197,6 +197,7 @@ SharedLib::entrypoint * SharedLib::getDllSymbol (std::string &symbol) { + GNASH_REPORT_FUNCTION; return getDllSymbol(symbol.c_str()); } @@ -223,7 +224,7 @@ SharedLib::entrypoint * SharedLib::getDllSymbol(const char *symbol) { -// GNASH_REPORT_FUNCTION; + GNASH_REPORT_FUNCTION; lt_ptr run = NULL; Index: libbase/smart_ptr.h =================================================================== RCS file: /sources/gnash/gnash/libbase/smart_ptr.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -b -r1.22 -r1.23 --- libbase/smart_ptr.h 1 Jul 2007 10:54:10 -0000 1.22 +++ libbase/smart_ptr.h 15 Sep 2007 17:53:09 -0000 1.23 @@ -15,16 +15,13 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// - // Smart (ref-counting) pointer classes. Uses "intrusive" approach: // the types pointed to must have add_ref() and drop_ref() methods. // Typically this is done by inheriting from a ref_counted class, // although the nice thing about templates is that no particular // ref-counted class is mandated. -/* $Id: smart_ptr.h,v 1.22 2007/07/01 10:54:10 bjacques Exp $ */ +/* $Id: smart_ptr.h,v 1.23 2007/09/15 17:53:09 rsavoye Exp $ */ #ifndef SMART_PTR_H #define SMART_PTR_H Index: extensions/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/extensions/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -u -b -r1.11 -r1.12 --- extensions/Makefile.am 15 Sep 2007 16:13:43 -0000 1.11 +++ extensions/Makefile.am 15 Sep 2007 17:53:09 -0000 1.12 @@ -44,5 +44,5 @@ OTHER_DIRS += gtk2 endif endif -DIST_SUBDIRS = dejagnu fileio mysql gtk2 +DIST_SUBDIRS = dejagnu fileio mysql gtk2 lirc SUBDIRS = $(OTHER_DIRS) Index: extensions/gtk2/gtkext.cpp =================================================================== RCS file: /sources/gnash/gnash/extensions/gtk2/gtkext.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- extensions/gtk2/gtkext.cpp 1 Jul 2007 10:53:59 -0000 1.5 +++ extensions/gtk2/gtkext.cpp 15 Sep 2007 17:53:09 -0000 1.6 @@ -45,7 +45,8 @@ namespace gnash { -static LogFile& dbglogfile = LogFile::getDefaultInstance(); +#define dbglogfile cerr // FIXME: use log_*() + #ifdef USE_DEBUGGER static Debugger& debugger = Debugger::getDefaultInstance(); #endif @@ -328,7 +329,7 @@ return as_value(); } -// gtk_main taks no arguments. +// gtk_main takes no arguments. as_value gtkext_main(const fn_call& fn) { // GNASH_REPORT_FUNCTION; Index: extensions/lirc/test.as =================================================================== RCS file: /sources/gnash/gnash/extensions/lirc/test.as,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- extensions/lirc/test.as 15 Sep 2007 16:42:55 -0000 1.1 +++ extensions/lirc/test.as 15 Sep 2007 17:53:09 -0000 1.2 @@ -20,7 +20,7 @@ // compile this test case with Ming makeswf, and then // execute it like this gnash -1 -r 0 -v out.swf -rcsid="$Id: test.as,v 1.1 2007/09/15 16:42:55 rsavoye Exp $"; +rcsid="$Id: test.as,v 1.2 2007/09/15 17:53:09 rsavoye Exp $"; var remote = new Lirc(); @@ -37,22 +37,30 @@ // var keyObj = new Key; -var sock = "/tmp/lircd"; -if (remote.lirc_init(sock)) { +// If the extension doesn't load, don't do anything. +if (remote) { + var sock = "/tmp/lircd"; + if (remote.lirc_init(sock)) { var str = "Connected to " + sock; trace(str); -} else { + } else { var str = "ERROR: couldn't connect to " + sock; trace(str); -} + } -var button = remote.lirc_getButton(); -trace(button); - -button = "QUIT"; + var button = remote.lirc_getButton(); + trace(button); -while (button != "QUIT") { + while (button != "QUIT" && button != "") { button = remote.lirc_getButton(); trace(button); + } + if (button == "QUIT") { + trace("Qutting due to user action"); + } + if (button == "") { + trace("Qutting due to socket being closed"); + } } + _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit