gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libamf/sol.cpp server/asobj/Sha...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libamf/sol.cpp server/asobj/Sha...
Date: Wed, 13 Feb 2008 13:29:23 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/02/13 13:29:23

Modified files:
        .              : ChangeLog 
        libamf         : sol.cpp 
        server/asobj   : SharedObject.cpp 

Log message:
                * server/asobj/SharedObject.cpp (flush): check return code from
                  sol::writeFile.
                * libamf/sol.cpp (writeFile): check ostream operations.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5633&r2=1.5634
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/sol.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SharedObject.cpp?cvsroot=gnash&r1=1.33&r2=1.34

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5633
retrieving revision 1.5634
diff -u -b -r1.5633 -r1.5634
--- ChangeLog   13 Feb 2008 10:47:35 -0000      1.5633
+++ ChangeLog   13 Feb 2008 13:29:21 -0000      1.5634
@@ -1,5 +1,8 @@
 2008-02-13 Sandro Santilli <address@hidden>
 
+       * server/asobj/SharedObject.cpp (flush): check return code from
+         sol::writeFile.
+       * libamf/sol.cpp (writeFile): check ostream operations.
        * testsuite/actionscript.all/SharedObject.as: add a few more tests
          and expect the current failures.
 

Index: libamf/sol.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/sol.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- libamf/sol.cpp      10 Feb 2008 13:31:00 -0000      1.20
+++ libamf/sol.cpp      13 Feb 2008 13:29:22 -0000      1.21
@@ -203,7 +203,14 @@
 SOL::writeFile(const string &filespec, const string &name)
 {
 //    GNASH_REPORT_FUNCTION;
+       log_debug("Opening file %s in binary mode (for writing?reading?what?)", 
filespec.c_str());
     ofstream ofs(filespec.c_str(), ios::binary);
+    if ( ! ofs )
+    {
+        log_error("Failed opening file '%s' in binary mode", filespec.c_str());
+        return false;
+    }
+
     vector<boost::uint8_t>::iterator it;
     vector<amf::Element *>::iterator ita; 
     AMF amf_obj;
@@ -287,9 +294,18 @@
         *ptr++ = (*(it));
     }
     
-    ofs.write(head.get(), _header.size());
+    if ( ofs.write(head.get(), _header.size()).fail() )
+    {
+        log_error("Error writing %d bytes of header to output file %s", 
_header.size(), filespec.c_str());
+        return false;
+    }
+
 //    ofs.write(body, (ptr - body));
-    ofs.write(body.get(), _filesize);
+    if ( ofs.write(body.get(), _filesize).fail() )
+    {
+        log_error("Error writing %d bytes of body to output file %s", 
_filesize, filespec.c_str());
+        return false;
+    }
     ofs.close();
 
     return true;

Index: server/asobj/SharedObject.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SharedObject.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/asobj/SharedObject.cpp       22 Jan 2008 10:45:02 -0000      1.33
+++ server/asobj/SharedObject.cpp       13 Feb 2008 13:29:22 -0000      1.34
@@ -227,7 +227,12 @@
     // We only want to access files in this directory
     string newspec; 
     newspec += obj->getFilespec();
-    sol.writeFile(newspec, obj->getObjectName().c_str());
+    bool ret = sol.writeFile(newspec, obj->getObjectName().c_str());
+    if ( ! ret )
+    {
+        log_error("writing SharedObject file to %s", newspec.c_str());
+        return as_value(false);
+    }
     return as_value(true); // TODO: check expected return type from 
SharedObject.flush
 #else
     return as_value(false);
@@ -342,11 +347,12 @@
         typedef tokenizer<char_separator<char> > Tok;
         char_separator<char> sep("/");
         Tok t(obj->getFilespec(), sep);
-        tokenizer<char_separator <char> >::iterator tit;
+        Tok::iterator tit;
         string newdir = newspec;
         for(tit=t.begin(); tit!=t.end();++tit){
             cout << *tit << "\n";
             newdir += *tit;
+            cout << "Dir: " << newdir << " to be created" << endl;
             if (newdir.find("..", 0) != string::npos) {
                 return as_value(false);
             }
@@ -361,7 +367,7 @@
             }
             newdir += "/";
         }
-    }
+    } else log_debug("no slash in filespec %s", obj->getFilespec().c_str());
     
 //     int ret = mkdir(newspec.c_str(), S_IRUSR|S_IWUSR|S_IXUSR);
 //     if ((errno != EEXIST) && (ret != 0)) {
@@ -376,7 +382,7 @@
 
     SOL sol;
     if (sol.readFile(newspec) == false) {
-        log_security("empty SOL file, \"%s\", created", newspec.c_str());
+        log_security("empty or non-existing SOL file \"%s\", will be created 
on flush/exit", newspec.c_str());
         return as_value(obj.get());
     }
     




reply via email to

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