chxavurlfix.cpp

来自「symbian 下的helix player源代码」· C++ 代码 · 共 69 行

CPP
69
字号
/*============================================================================*
 *
 * (c) 1995-2002 RealNetworks, Inc. Patents pending. All rights reserved.
 *
 *============================================================================*/
 

// Helix includes...
#include "hxsym_debug.h"

#include "chxavescapedstring.h"
#include "chxavurlfix.h"

CHXAvURLRep CHXAvURLFixup::TryEscapeURL(const CHXAvURLRep& url)
{
    CHXAvURLRep ret = url;

    if (!ret.Valid())
    {
        //
        // Url may be 'invalid' because there are unescaped characters. 
        // 'Fix' it by trying to escape characters in the path and query
        //

        bool modified = false;

	// See if the path is invalid
	if (!ret.EscapedPath().ValidPath())
	{
	    // Escape the path
	    CHXAvEscapedString newPath;

	    newPath.EscapePathStr(ret.EscapedPath().GetEscapedStr());
	    
	    ret = CHXAvURLRep(ret.Protocol(), ret.Host(), ret.Port(),
			   newPath, ret.EscapedQuery());
	    modified = true;
	}

	// See if the query is invalid
	if (!ret.EscapedQuery().ValidQuery())
	{
	    // Escape the query
	    CHXAvEscapedString newQuery;

	    newQuery.EscapeQueryStr(ret.EscapedQuery().GetEscapedStr());
	    
	    ret = CHXAvURLRep(ret.Protocol(), ret.Host(), ret.Port(),
			   ret.EscapedPath(), newQuery);
	    
	    modified = true;
	}

        if (modified)
        {
            DPRINTF (SYMP_INFO,
		     ("CHXAvURLFixup::TryEscapeURL : old = '%s'\n",
		      (const char*)url.String()));

            DPRINTF (SYMP_INFO,
		     ("CHXAvURLFixup::TryEscapeURL : new = '%s'\n",
		      (const char*)ret.String()));
        }
    }

    return ret;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?