Example #1
0
void
BNetworkCookieJar::UrlIterator::_FindNext()
{
	fLastIndex = fIndex;
	fLastElement = fElement;
	if (fLastList != NULL)
		fLastList->Unlock();

	fLastList = fList;
	if (fLastList)
		fLastList->LockForReading();

	if (fCookieJar->fCookieHashMap->Lock()) {
		while (!_FindPath()) {
			if (!_SuperDomain()) {
				fElement = NULL;
				fCookieJar->fCookieHashMap->Unlock();
				return;
			}

			_FindDomain();
		}
		fCookieJar->fCookieHashMap->Unlock();
	}
}
Example #2
0
void SlimItem::InsertPath(const CString& strPath, const CStringA& strOsFlag)
{
    CString strRealPath;
    TCHAR* temp = new TCHAR[MAX_PATH * 2];
    WinVersion sysVersion = KGetWinVersion();

    if (!strOsFlag.CompareNoCase("xp") && sysVersion >= WINVERSION_VISTA)
        return;

    if (!strOsFlag.CompareNoCase("vista") && sysVersion != WINVERSION_VISTA)
        return;

    if (!strOsFlag.CompareNoCase("win7") && sysVersion <= WINVERSION_VISTA)
        return;

    if (!ExpandEnvironmentStrings(strPath, temp, MAX_PATH * 2))
        return;

    strRealPath = temp;

    if (strRealPath.Find(L"*") != -1)
    {
        _FindPath(strRealPath);
    } 
    else if (::GetFileAttributes(strRealPath) != INVALID_FILE_ATTRIBUTES)
    {    
        m_itemPaths.Add(strRealPath);
    }
}
Example #3
0
bool BinaryTree<T>::_FindPath(Node*root,Node *n,std::stack<Node*> &path){
	if(root==NULL || n == NULL){
		return false;
	}
	
	path.push(root);

	if(root == n){
		return true;
	}

	if(_FindPath(root->_left,n,path)){
		return true;
	}

	if(_FindPath(root->_right,n,path)){
		return true;
	}

	path.pop();
	return false;
}
Example #4
0
typename BinaryTree<T>::Node *BinaryTree<T>::GetCommonAncestralNode(Node *n1,Node *n2){
	std::stack<Node*> s1;
	std::stack<Node*> s2;
	
	//找n1、n2路径分别存放在s1、s2里
	_FindPath(_root,n1,s1);
	_FindPath(_root,n2,s2);

	//删除多余的路径
	while(s1.size() > s2.size()){
		s1.pop();
	}
	while(s2.size() > s1.size()){
		s2.pop();
	}
	
	//找最近公共祖先
	while(s1.top()!=s2.top()){
		s1.pop();
		s2.pop();
	}

	return s1.top();
}
void
BNetworkCookieJar::UrlIterator::_FindNext()
{
    fLastIndex = fIndex;
    fLastElement = fElement;
    fLastList = fList;

    while (!_FindPath()) {
        if (!_SuperDomain()) {
            fElement = NULL;
            return;
        }

        _FindDomain();
    }
}