gnash-commit
[Top][All Lists]
Advanced

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

Re: [Gnash-commit] gnash/libbase URL.cpp


From: strk
Subject: Re: [Gnash-commit] gnash/libbase URL.cpp
Date: Mon, 18 Sep 2006 09:40:11 +0200

A quick grep shows there's no .cpp file calling either get_workdir
or set_workdir, so URL is currently the only class making use of it.
I don't think the URL class should NOT ever *set* the working dir, it's
only use is to *parse* URLs and resolve relative ones based on another
URL that is *passed* at construction time.

The CWD fetch is just a fall back, we might as well raise an error
in that case (relative url given, no parent url to resolve it against).

--strk;

On Mon, Sep 11, 2006 at 02:24:11PM +0000, Vitaly Alexeev wrote:
> CVSROOT:      /sources/gnash
> Module name:  gnash
> Changes by:   Vitaly Alexeev <alexeev>        06/09/11 14:24:11
> 
> Modified files:
>       libbase        : URL.cpp 
> 
> Log message:
>       loadMovie() should be compatible with Flash
> 
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/URL.cpp?cvsroot=gnash&r1=1.21&r2=1.22
> 
> Patches:
> Index: URL.cpp
> ===================================================================
> RCS file: /sources/gnash/gnash/libbase/URL.cpp,v
> retrieving revision 1.21
> retrieving revision 1.22
> diff -u -b -r1.21 -r1.22
> --- URL.cpp   2 Sep 2006 14:28:35 -0000       1.21
> +++ URL.cpp   11 Sep 2006 14:24:11 -0000      1.22
> @@ -42,6 +42,7 @@
>  
>  #include <iostream>
>  #include "URL.h"
> +#include "impl.h"
>  //#include "rc.h"
>  
>  #include <string>
> @@ -134,22 +135,34 @@
>       {
>               //cerr << "It's absolute" << endl;
>               init_absolute(absolute_url);
> +
> +             // The current system directory is not current working 
> directory of Flash.
> +             // Current working directory of Flash is a directory of the 
> first swf file.
> +             if (strlen(get_workdir()) == 0)
> +             {
> +                     size_t n = absolute_url.find_last_of("/\\");
> +                     if (n != string::npos)
> +                     {
> +                             set_workdir(absolute_url.substr(0, n + 
> 1).c_str());
> +                     }
> +             }
>       }
>       else
>       {
>               //cerr << "It's relative" << endl;
> -             char buf[PATH_MAX+1];
> -             if ( ! getcwd(buf, PATH_MAX) )
> -             {
> -                     stringstream err;
> -                     err << "getcwd failed: " << strerror(errno);
> -                     throw gnash::GnashException(err.str());
> -             }
> -             char* ptr = buf+strlen(buf);
> -             *ptr = '/';
> -             ++ptr;
> -             *ptr = '\0';
> -             URL cwd(buf);
> +//           char buf[PATH_MAX+1];
> +//           if ( ! getcwd(buf, PATH_MAX) )
> +//           {
> +//                   stringstream err;
> +//                   err << "getcwd failed: " << strerror(errno);
> +//                   throw gnash::GnashException(err.str());
> +//           }
> +//           char* ptr = buf+strlen(buf);
> +//           *ptr = '/';
> +//           ++ptr;
> +//           *ptr = '\0';
> +
> +             URL cwd(get_workdir());
>               init_relative(absolute_url, cwd);
>       }
>  }
> 
> 
> _______________________________________________
> Gnash-commit mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnash-commit

-- 

 /"\    ASCII Ribbon Campaign
 \ /    Respect for low technology.
  X     Keep e-mail messages readable by any computer system.
 / \    Keep it ASCII. 





reply via email to

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