gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog extensions/fileio/fileio.h exte...


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog extensions/fileio/fileio.h exte...
Date: Wed, 07 Mar 2007 13:01:01 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   07/03/07 13:01:01

Modified files:
        .              : ChangeLog 
        extensions/fileio: fileio.h fileio.cpp 

Log message:
        experimental unlink() extension (may move to a separate extension)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2564&r2=1.2565
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/fileio/fileio.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/fileio/fileio.cpp?cvsroot=gnash&r1=1.5&r2=1.6

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.2564
retrieving revision 1.2565
diff -u -b -r1.2564 -r1.2565
--- ChangeLog   7 Mar 2007 12:44:53 -0000       1.2564
+++ ChangeLog   7 Mar 2007 13:01:00 -0000       1.2565
@@ -3,7 +3,8 @@
        * backend/render_handler_agg.cpp: fixed segfault #19223; set correct
          visiblerect; fixed Range2d.width() usage; fixed getMaxY() usage
        * extensions/fileio/fileio.{h,cpp}: implemented an experimental 
-         scandir() function (may move to a separate extension)         
+         scandir() function (may move to a separate extension); same story
+               for unlink()            
 
 2007-03-06 Sandro Santilli <address@hidden>
 

Index: extensions/fileio/fileio.h
===================================================================
RCS file: /cvsroot/gnash/gnash/extensions/fileio/fileio.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- extensions/fileio/fileio.h  7 Mar 2007 12:44:53 -0000       1.2
+++ extensions/fileio/fileio.h  7 Mar 2007 13:01:01 -0000       1.3
@@ -48,6 +48,7 @@
     int fseek(long offset);
     int fseek(long offset, int whence);
     long ftell();
+    bool unlink(std::string &filespec);
     void scandir(const string dir, as_value* result);
 private:
     FILE        *_stream;

Index: extensions/fileio/fileio.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/extensions/fileio/fileio.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- extensions/fileio/fileio.cpp        7 Mar 2007 12:44:53 -0000       1.5
+++ extensions/fileio/fileio.cpp        7 Mar 2007 13:01:01 -0000       1.6
@@ -25,6 +25,7 @@
 #include <boost/algorithm/string/case_conv.hpp>
 
 #include <dirent.h> // used by scandir()
+#include <unistd.h> // used by unlink()
 
 #include "VM.h"
 #include "log.h"
@@ -57,11 +58,14 @@
 void fileio_fflush(const fn_call& fn);
 void fileio_ftell(const fn_call& fn);
 void fileio_fseek(const fn_call& fn);
+void fileio_unlink(const fn_call& fn);
 
 // <Udo> I needed a scandir() function and implemented it here for simplicity.
 // Maybe this should be moved to a dedicated extension and a different class? 
 // The scandir() syntax comes from PHP, since the C syntax is not quite 
 // applicable in ActionScript.
+// Same applies for unlink(). Maybe a class FileOP or sim. would be 
+// appriopriate. 
 void fileio_scandir(const fn_call& fn);
 
 LogFile& dbglogfile = LogFile::getDefaultInstance();
@@ -89,6 +93,8 @@
     obj->set_member("ftell", &fileio_ftell);
     obj->set_member("fclose", &fileio_fclose);
     
+    obj->set_member("unlink", &fileio_unlink);
+    
     obj->set_member("scandir", &fileio_scandir);
 }
 
@@ -271,6 +277,13 @@
     return -1;
 }
 
+bool
+Fileio::unlink(std::string &filespec)
+{
+//    GNASH_REPORT_FUNCTION;
+               return ::unlink(filespec.c_str()) >= 0;         
+}
+
 void
 Fileio::scandir(const string dir, as_value* result) 
 {
@@ -395,7 +408,7 @@
 //    GNASH_REPORT_FUNCTION;
     Fileio *ptr = (Fileio*)fn.this_ptr;
     assert(ptr);    
-    int c = fn.env->bottom(fn.first_arg_bottom_index).to_number();
+    int c = (int) fn.env->bottom(fn.first_arg_bottom_index).to_number();
     fn.result->set_bool(ptr->fputc(c));
 }
 
@@ -443,7 +456,7 @@
 //    GNASH_REPORT_FUNCTION;
     Fileio *ptr = (Fileio*)fn.this_ptr;
     assert(ptr);    
-    long c = fn.env->bottom(fn.first_arg_bottom_index).to_number();
+    long c = (long) fn.env->bottom(fn.first_arg_bottom_index).to_number();
     fn.result->set_int(ptr->fseek(c));
 }
 
@@ -458,6 +471,16 @@
 }
 
 void
+fileio_unlink(const fn_call& fn)
+{
+//    GNASH_REPORT_FUNCTION;
+    Fileio *ptr = (Fileio*)fn.this_ptr;
+    assert(ptr);
+    string str = fn.env->bottom(fn.first_arg_bottom_index).to_string();
+    fn.result->set_bool(ptr->unlink(str));
+}
+
+void
 fileio_scandir(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;




reply via email to

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