void CTrieHolder::InitFailureFunction() { assert (!m_Nodes.empty()); yvector<size_t> BFS; BFS.push_back(0); // going breadth-first search for (size_t i=0; i < BFS.size(); i++) { const CTrieNode& Parent = m_Nodes[BFS[i]]; size_t ChildrenCount = GetChildrenCount(BFS[i]); for (size_t j=0; j<ChildrenCount; j++) { const CTrieRelation& p = GetChildren(BFS[i])[j]; // going upside using following failure function in order to find the first node which // has a way downward with symbol RelationChar int r = Parent.m_FailureFunction; while ((r != -1) && (FindChild(r,p.m_RelationChar) == -1)) r = m_Nodes[r].m_FailureFunction; if (r != -1) { // the way is found m_Nodes[p.m_ChildNo].m_FailureFunction = FindChild(r,p.m_RelationChar); } else // no way is found, should start from the beginning m_Nodes[p.m_ChildNo].m_FailureFunction = 0; BFS.push_back(p.m_ChildNo); }; }; };
/*---------------------------------------------------------------------- | AP4_TrakAtom::SetChunkOffsets +---------------------------------------------------------------------*/ AP4_Result AP4_TrakAtom::SetChunkOffsets(const AP4_Array<AP4_UI64>& chunk_offsets) { AP4_Atom* atom; if ((atom = FindChild("mdia/minf/stbl/stco"))) { AP4_StcoAtom* stco = dynamic_cast<AP4_StcoAtom*>(atom); if (stco == NULL) return AP4_ERROR_INTERNAL; AP4_Cardinal stco_chunk_count = stco->GetChunkCount(); AP4_UI32* stco_chunk_offsets = stco->GetChunkOffsets(); if (stco_chunk_count > chunk_offsets.ItemCount()) { return AP4_ERROR_OUT_OF_RANGE; } for (unsigned int i=0; i<stco_chunk_count; i++) { stco_chunk_offsets[i] = (AP4_UI32)chunk_offsets[i]; } return AP4_SUCCESS; } else if ((atom = FindChild("mdia/minf/stbl/co64"))) { AP4_Co64Atom* co64 = dynamic_cast<AP4_Co64Atom*>(atom); if (co64 == NULL) return AP4_ERROR_INTERNAL; AP4_Cardinal co64_chunk_count = co64->GetChunkCount(); AP4_UI64* co64_chunk_offsets = co64->GetChunkOffsets(); if (co64_chunk_count > chunk_offsets.ItemCount()) { return AP4_ERROR_OUT_OF_RANGE; } for (unsigned int i=0; i<co64_chunk_count; i++) { co64_chunk_offsets[i] = chunk_offsets[i]; } return AP4_SUCCESS; } else { return AP4_ERROR_INVALID_STATE; } }
/*---------------------------------------------------------------------- | AP4_TrakAtom::GetChunkOffsets +---------------------------------------------------------------------*/ AP4_Result AP4_TrakAtom::GetChunkOffsets(AP4_Array<AP4_UI64>& chunk_offsets) { AP4_Atom* atom; if ((atom = FindChild("mdia/minf/stbl/stco"))) { AP4_StcoAtom* stco = AP4_DYNAMIC_CAST(AP4_StcoAtom, atom); if (stco == NULL) return AP4_ERROR_INTERNAL; AP4_Cardinal stco_chunk_count = stco->GetChunkCount(); const AP4_UI32* stco_chunk_offsets = stco->GetChunkOffsets(); chunk_offsets.SetItemCount(stco_chunk_count); for (unsigned int i=0; i<stco_chunk_count; i++) { chunk_offsets[i] = stco_chunk_offsets[i]; } return AP4_SUCCESS; } else if ((atom = FindChild("mdia/minf/stbl/co64"))) { AP4_Co64Atom* co64 = AP4_DYNAMIC_CAST(AP4_Co64Atom, atom); if (co64 == NULL) return AP4_ERROR_INTERNAL; AP4_Cardinal co64_chunk_count = co64->GetChunkCount(); const AP4_UI64* co64_chunk_offsets = co64->GetChunkOffsets(); chunk_offsets.SetItemCount(co64_chunk_count); for (unsigned int i=0; i<co64_chunk_count; i++) { chunk_offsets[i] = co64_chunk_offsets[i]; } return AP4_SUCCESS; } else { return AP4_ERROR_INVALID_STATE; } }
/*---------------------------------------------------------------------- | AP4_EncaSampleEntry::ToSampleDescription +---------------------------------------------------------------------*/ AP4_SampleDescription* AP4_EncaSampleEntry::ToSampleDescription() { // get the original sample format AP4_FrmaAtom* frma = (AP4_FrmaAtom*)FindChild("sinf/frma"); // get the scheme info AP4_SchmAtom* schm = (AP4_SchmAtom*)FindChild("sinf/schm"); if (schm == NULL) return NULL; // get the sample description for the original sample entry AP4_MpegAudioSampleDescription* original_sample_description = (AP4_MpegAudioSampleDescription*) AP4_AudioSampleEntry::ToSampleDescription(); // get the schi atom AP4_ContainerAtom* schi; schi = static_cast<AP4_ContainerAtom*>(FindChild("sinf/schi")); // create the sample description return new AP4_IsmaCrypSampleDescription( original_sample_description, frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4A, schm->GetSchemeType(), schm->GetSchemeVersion(), schm->GetSchemeUri().c_str(), schi); }
/*---------------------------------------------------------------------- | AP4_TrakAtom::AP4_TrakAtom +---------------------------------------------------------------------*/ AP4_TrakAtom::AP4_TrakAtom(AP4_UI32 size, AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) : AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK, size, false, stream, atom_factory) { m_TkhdAtom = AP4_DYNAMIC_CAST(AP4_TkhdAtom, FindChild("tkhd")); m_MdhdAtom = AP4_DYNAMIC_CAST(AP4_MdhdAtom, FindChild("mdia/mdhd")); }
/*---------------------------------------------------------------------- | AP4_TrakAtom::AP4_TrakAtom +---------------------------------------------------------------------*/ AP4_TrakAtom::AP4_TrakAtom(AP4_UI32 size, AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) : AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK, size, false, stream, atom_factory) { m_TkhdAtom = dynamic_cast<AP4_TkhdAtom*>(FindChild("tkhd")); m_MdhdAtom = dynamic_cast<AP4_MdhdAtom*>(FindChild("mdia/mdhd")); }
BOOL OSAL_ConfigController_SetNumValue(const char *ignore, const char *config_name, UINT32 *value) { BOOL result = FALSE; BOOL bXmlRead, bSetInnerText, bXmlWrite; pXmlElement xmlRoot, xmlTopElement, xmlTargetElement; char buf[16] = {0}; if (config_name == NULL) { return result; } pthread_mutex_lock(&g_configmutex); // Open Config XML file xmlRoot = CreateEmptyXmlData(); bXmlRead = ReadXmlFile(xmlRoot, CONFIG_XMLFILE); if (!bXmlRead) { OSALTRACE(OSAL_ERROR, ("cannot read config xml file")); pthread_mutex_unlock(&g_configmutex); return result; } // Find "config_name" xmlTopElement = FindChild(xmlRoot, CONFIG_INTEL_WIMAX); xmlTargetElement = FindChild(xmlTopElement, config_name); if (xmlTargetElement != NULL) { //convert integer to string snprintf(buf, sizeof(buf), "%d", *value); bSetInnerText = SetElementInnerText(xmlTargetElement, buf); if(bSetInnerText == TRUE) { // write to XML file bXmlWrite = WriteXmlFile(xmlTopElement, CONFIG_XMLFILE_TMP); if(bXmlWrite == TRUE) { result = TRUE; } else { OSALTRACE(OSAL_ERROR, ("cannot write config xml file")); result = FALSE; } } } // Close XML FreeXmlData(xmlRoot); //swap the file pthread_mutex_lock(&g_swapfilemutex); rename(CONFIG_XMLFILE_TMP,CONFIG_XMLFILE); pthread_mutex_unlock(&g_swapfilemutex); pthread_mutex_unlock(&g_configmutex); return result; }
BOOL OSAL_ConfigController_GetNumValue(const char *ignore, const char *config_name, UINT32 * value) { BOOL result = FALSE; BOOL bXmlRead; pXmlElement xmlRoot, xmlTopElement, xmlTargetElement; const char *target_data; BOOL bDnDOutputQuery = FALSE; if (config_name == NULL) { return result; } if ( strcasecmp(config_name, OSAL_KEY_ENTRY_DND_OUTPUT_MODE) == 0) { bDnDOutputQuery = TRUE; } pthread_mutex_lock(&g_configmutex); // Open Config XML file xmlRoot = CreateEmptyXmlData(); bXmlRead = ReadXmlFile(xmlRoot, CONFIG_XMLFILE); if (!bXmlRead) { OSALTRACE(OSAL_ERROR, ("cannot read config xml file")); pthread_mutex_unlock(&g_configmutex); return result; } // Find "config_name" xmlTopElement = FindChild(xmlRoot, CONFIG_INTEL_WIMAX); xmlTargetElement = FindChild(xmlTopElement, config_name); if (xmlTargetElement != NULL) { target_data = GetElementInnerText(xmlTargetElement); if (target_data != NULL) { // Copy to the value *value = (UINT32) atoi(target_data); result = TRUE; } } if ( bDnDOutputQuery ) { OSALTRACE(OSAL_DEBUG, ("Result of query is %d, and value is %d.", result, result ? *value : -1)); } // Close XML FreeXmlData(xmlRoot); pthread_mutex_unlock(&g_configmutex); return result; }
// Try to expand as much of the given path as possible, // and select the given tree item. bool wxGenericDirCtrl::ExpandPath(const wxString& path) { bool done = false; wxTreeItemId treeid = FindChild(m_rootId, path, done); wxTreeItemId lastId = treeid; // The last non-zero treeid while (treeid.IsOk() && !done) { ExpandDir(treeid); treeid = FindChild(treeid, path, done); if (treeid.IsOk()) lastId = treeid; } if (!lastId.IsOk()) return false; wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId); if (data->m_isDir) { m_treeCtrl->Expand(lastId); } if (HasFlag(wxDIRCTRL_SELECT_FIRST) && data->m_isDir) { // Find the first file in this directory wxTreeItemIdValue cookie; wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie); bool selectedChild = false; while (childId.IsOk()) { data = (wxDirItemData*) m_treeCtrl->GetItemData(childId); if (data && data->m_path != wxEmptyString && !data->m_isDir) { m_treeCtrl->SelectItem(childId); m_treeCtrl->EnsureVisible(childId); selectedChild = true; break; } childId = m_treeCtrl->GetNextChild(lastId, cookie); } if (!selectedChild) { m_treeCtrl->SelectItem(lastId); m_treeCtrl->EnsureVisible(lastId); } } else { m_treeCtrl->SelectItem(lastId); m_treeCtrl->EnsureVisible(lastId); } return true; }
BOOL OSAL_ConfigController_GetStrValue(const char *ignore, const char *config_name, char* value,UINT32 maxsize) { BOOL result = FALSE; BOOL bXmlRead; pXmlElement xmlRoot, xmlTopElement, xmlTargetElement; const char *target_data; UINT32 data_size=0; if (config_name == NULL) { return result; } pthread_mutex_lock(&g_configmutex); // Open Config XML file xmlRoot = CreateEmptyXmlData(); bXmlRead = ReadXmlFile(xmlRoot, CONFIG_XMLFILE); if (!bXmlRead) { OSALTRACE(OSAL_ERROR, ("cannot read config xml file")); pthread_mutex_unlock(&g_configmutex); return result; } // Find "config_name" xmlTopElement = FindChild(xmlRoot, CONFIG_INTEL_WIMAX); xmlTargetElement = FindChild(xmlTopElement, config_name); if (xmlTargetElement != NULL) { target_data = GetElementInnerText(xmlTargetElement); data_size = strlen(target_data)+1; if (target_data != NULL) { if(data_size > maxsize -1){ // Copy to the value memcpy(value, target_data, maxsize-1); // Added by Kalyan to make the value as a complete string // and to avoid problems with strlen, strcpy on value without \0 value[maxsize-1] = '\0'; } else { memcpy(value, target_data, data_size); } result = TRUE; } } // Close XML FreeXmlData(xmlRoot); pthread_mutex_unlock(&g_configmutex); return result; }
/*---------------------------------------------------------------------- | AP4_TrakAtom::AdjustChunkOffsets +---------------------------------------------------------------------*/ AP4_Result AP4_TrakAtom::AdjustChunkOffsets(AP4_SI64 delta) { AP4_Atom* atom; if ((atom = FindChild("mdia/minf/stbl/stco"))) { AP4_StcoAtom* stco = dynamic_cast<AP4_StcoAtom*>(atom); return stco->AdjustChunkOffsets((int)delta); } else if ((atom = FindChild("mdia/minf/stbl/co64"))) { AP4_Co64Atom* co64 = dynamic_cast<AP4_Co64Atom*>(atom); return co64->AdjustChunkOffsets(delta); } else { return AP4_ERROR_INVALID_STATE; } }
void OGR_SRSNode::StripNodes( const char * pszName ) { /* -------------------------------------------------------------------- */ /* Strip any children matching this name. */ /* -------------------------------------------------------------------- */ while( FindChild( pszName ) >= 0 ) DestroyChild( FindChild( pszName ) ); /* -------------------------------------------------------------------- */ /* Recurse */ /* -------------------------------------------------------------------- */ for( int i = 0; i < GetChildCount(); i++ ) GetChild(i)->StripNodes( pszName ); }
TreeNode * TreeNode::AddChild( TreeNode * Child ) { TreeNode * Result = NULL; Result = FindChild( Child->Item, Child->ItemIsIntra); if( Result == NULL ) { Result = Child; (*Children).push_back( Child ); // To keep the children vector sorted. //inplace_merge( (*Children).begin(), (*Children).end()-1, (*Children).end(), TreeNodeLess ); Child->Parent = this; if( Child->ItemIsIntra ) { Child->ItemsetNumber = ItemsetNumber; Child->Items = Items + 1; } else { Child->ItemsetNumber = ItemsetNumber + 1; Child->Items = Items + 1; } } else { if( Child->Support > Result->Support ) Result->Support = Child->Support; delete Child; } return Result; }
Room::Room(Map *m, Room *par, Direction from_direction, SDL_Rect area) { map = m; space = area; parent = par; for (int i = NORTH; i < LAST_DIRECTION; ++i) { if (i == from_direction) { children[from_direction] = parent; corridors[from_direction] = (SDL_Rect) {0, 0, 0, 0}; } else children[i] = NULL; } map->ApplyRoom(this); for (int i = 0; i < CHILD_TRIES; ++i) { if (!hasChildrenAvailable()) break; FindChild(); } if (!map->lastroom && this->CountExits() < 2) { map->lastroom = this; AddObject(RoomObject::STAIRS_DOWN); } }
bool ControlRoom::Attach(const char *nodeUrl,const char *controllerUrl) { if (controllerUrl[0] ==0) return true; ControlNode *existing=FindChild(nodeUrl) ; if ((!existing)||(existing->GetType()!=CNT_ASSIGNABLE)) { Trace::Error("Trying to map unknown node %s",nodeUrl) ; return false ; } AssignableControlNode *acn=(AssignableControlNode*)existing ; MultiChannelAdapter *mca=(MultiChannelAdapter *)acn->GetSourceChannel() ; if (!mca) { std::string name=acn->GetName() ; name+="-adapter" ; mca=new MultiChannelAdapter(name.c_str()) ; acn->SetSourceChannel(mca) ; } Channel *channel=ControllerService::GetInstance()->GetChannel(controllerUrl) ; if (channel) { mca->AddChannel(*channel) ; Trace::Log("MAPPING","Attached %s to %s",nodeUrl,controllerUrl) ; } else { Trace::Debug("Failed to attach %s to %s",nodeUrl,controllerUrl) ; } ; return true ; } ;
HWND FindChild(HWND hParent, wchar_t *find_name) { if(NULL == hParent) { return NULL; } HWND hFind = FindWindowEx(hParent, NULL, find_name, NULL); if(NULL == hFind) {// not found HWND hChild = GetWindow(hParent, GW_CHILD); while (hChild) { hFind = FindChild(hChild, find_name); if(hFind) { return hFind; } hChild = GetWindow(hChild, GW_HWNDNEXT); } return NULL; } return hFind; }
CControlUI* CVideoFrame::FindChild( CContainerUI* pContainer, LPCTSTR strName ) { if (!pContainer) return NULL; if (_tcsicmp(strName, pContainer->GetName()) == 0) { return pContainer; } for (int i = 0; ; i ++) { CControlUI* pControl = pContainer->GetItemAt(i); if (pControl == NULL) return NULL; if ( _tcsicmp(strName ,pControl->GetName()) == 0) { return pControl; } CContainerUI* pContainerSub = dynamic_cast<CContainerUI*>(pControl); if (pContainerSub) { CControlUI* p = FindChild(pContainerSub, strName); if (p) return p; } } return NULL; }
TreeNode * TreeNode::AddChild( int anItem, bool Intra, int Sup) { TreeNode *Result = NULL; TreeNode *Child = NULL; Result = FindChild( anItem, Intra); if( Result == NULL ) { Child= new TreeNode(anItem, Intra, Sup); Result = Child; (*Children).push_back( Child ); // To keep the children vector sorted. inplace_merge( (*Children).begin(), (*Children).end()-1, (*Children).end(), TreeNodeLess ); Child->Parent = this; if( Child->ItemIsIntra ) { Child->ItemsetNumber = ItemsetNumber; Child->Items = Items + 1; } else { Child->ItemsetNumber = ItemsetNumber + 1; Child->Items = Items + 1; } } else { if( Result->Support < Sup ) { printf("Item: %d %d %d\n", anItem, Result->Support, Sup); printf("ParentItem: %d %d\n", Item, Support); Result->Support = Sup; } } return Result; }
QModelIndex MergeModel::mapFromSource (const QModelIndex& sourceIndex) const { if (!sourceIndex.isValid ()) return {}; QList<QModelIndex> hier; auto parent = sourceIndex; while (parent.isValid ()) { hier.prepend (parent); parent = parent.parent (); } auto currentItem = Root_; for (const auto& idx : hier) { currentItem = currentItem->FindChild (idx); if (!currentItem) { qWarning () << Q_FUNC_INFO << "no next item for" << idx << hier; return {}; } } return createIndex (currentItem->GetRow (), sourceIndex.column (), currentItem.get ()); }
wxTreeItemId ClassBrowser::FindChild(const wxString& search, wxTreeCtrl* tree, const wxTreeItemId& start, bool recurse, bool partialMatch) { if (!tree) return wxTreeItemId(); wxTreeItemIdValue cookie; wxTreeItemId res = tree->GetFirstChild(start, cookie); while (res.IsOk()) { wxString text = tree->GetItemText(res); if ( (!partialMatch && text == search) || ( partialMatch && text.StartsWith(search)) ) { return res; } if (recurse && tree->ItemHasChildren(res)) { res = FindChild(search, tree, res, true, partialMatch); if (res.IsOk()) return res; } res = m_CCTreeCtrl->GetNextChild(start, cookie); } res.Unset(); return res; }
FarDlgNode & FarDialog::operator[](const String & n) { FarDlgNode * obj = FindChild(n); if (!obj) FWError(Format(L"Request to undefined object %s", n.ptr())); return *obj; }
void ScrollView::Build() { if (nullptr == m_pDelegate) return; Item* pContent = (Item*)FindChild("Content"); if (nullptr == pContent) return; pContent->ClearChildren(); // create new items ScrollViewModel* pModel = (ScrollViewModel*)GetModel(); int nCnt = pModel->GetCount(); for (int i = 0; i < nCnt; i++) { Item* pItem = GenerateDelegateItem(); if (!pItem->IsInstanceOf("ScrollViewDelegate")) { GetMgr()->Destroy(pItem->GetID()); continue; } ScrollViewDelegate* pDelegateItem = (ScrollViewDelegate*)pItem; pDelegateItem->SetName("ScrollViewDelegateItem"); pDelegateItem->SetWidth(GetWidth()); pDelegateItem->SetHeight(50); pDelegateItem->SetLeft(0); pDelegateItem->SetTop(i*50); pDelegateItem->SetIndex(i); pContent->AddChild(pItem); } }
int CTrieHolder::GetTerminatedPeriodNext (int NodeNo) const { if (NodeNo == 0) return -1; TerminalSymbolType RelationChar = m_Nodes[NodeNo].m_IncomingSymbol; int r = m_Nodes[m_Nodes[NodeNo].m_Parent].m_FailureFunction; while (r != -1) { while ((r != -1) && (FindChild(r,RelationChar) == -1)) r = m_Nodes[r].m_FailureFunction; if (r != -1) return FindChild(r,RelationChar); }; return -1; };
int TreeAddObject(HWND hwndDlg, int ID, OPT_OBJECT_DATA * data) { HTREEITEM rootItem=NULL; HTREEITEM cItem=NULL; char * path; char * ptr; char * ptrE; char buf[255]; BOOL ext=FALSE; path=data->szPath?mir_strdup(data->szPath):(data->szName[1]=='$')?mir_strdup((data->szName)+2):NULL; if (!path) { mir_snprintf(buf,SIZEOF(buf),"$(other)/%s",(data->szName)+1); path=mir_strdup(buf); } ptr=path; ptrE=path; do { while (*ptrE!='/' && *ptrE!='\0') ptrE++; if (*ptrE=='/') { *ptrE='\0'; ptrE++; // find item if not - create; { cItem=FindChild(GetDlgItem(hwndDlg,ID),rootItem,ptr); if (!cItem) // not found - create node { TVINSERTSTRUCTA tvis; tvis.hParent=rootItem; tvis.hInsertAfter=TVI_SORT; tvis.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_PARAM; tvis.item.pszText=ptr; tvis.item.lParam=(LPARAM)NULL; cItem=TreeView_InsertItemA(GetDlgItem(hwndDlg,ID),&tvis); } rootItem=cItem; } ptr=ptrE; } else ext=TRUE; }while (!ext); //Insert item node { TVINSERTSTRUCTA tvis; tvis.hParent=rootItem; tvis.hInsertAfter=TVI_SORT; tvis.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_PARAM; tvis.item.pszText=ptr; tvis.item.lParam=(LPARAM)data; TreeView_InsertItemA(GetDlgItem(hwndDlg,ID),&tvis); } mir_free_and_nill(path); return 0; }
/*---------------------------------------------------------------------- | AP4_TrakAtom::AdjustChunkOffsets +---------------------------------------------------------------------*/ AP4_Result AP4_TrakAtom::AdjustChunkOffsets(AP4_Offset offset) { if (AP4_Atom* atom = FindChild("mdia/minf/stbl/co64")) { AP4_Co64Atom* co64 = dynamic_cast<AP4_Co64Atom*>(atom); co64->AdjustChunkOffsets(offset); } AP4_Atom* atom = FindChild("mdia/minf/stbl/stco"); if (atom != NULL) { AP4_StcoAtom* stco = dynamic_cast<AP4_StcoAtom*>(atom); stco->AdjustChunkOffsets(offset); return AP4_SUCCESS; } else { return AP4_FAILURE; } }
void XUI_Wnd::AddChild(XUI_Wnd* pElement ) { if (-1==FindChild(pElement)) { pElement->m_pParent=this; m_pChildren.push_back(pElement); } }
///////////////// // Get the child by ID, returns NULL when not found CBasicContainer *CBasicContainer::GetChild(const std::string& id) { ContainerList::iterator i = FindChild(id); if (i == tChildren.end()) return NULL; else return *i; }
static OptionExp* FindSibling(OptionExp* pOptExp, const char* name) { OptionExp* pParent = pOptExp->GetParent(); if(pParent == NULL) { return NULL; } return FindChild(pParent, name); }
status_t device_node::_RegisterDynamic(device_node* previous) { // If this is not a bus, we don't have to scan it if (find_attr(this, B_DEVICE_BUS, false, B_STRING_TYPE) == NULL) return B_OK; // If we're not being probed, we honour the B_FIND_CHILD_ON_DEMAND // requirements if (!IsProbed() && (fFlags & B_FIND_CHILD_ON_DEMAND) != 0 && !_AlwaysRegisterDynamic()) return B_OK; KPath path; if ((fFlags & B_FIND_MULTIPLE_CHILDREN) == 0) { // find the one driver driver_module_info* bestDriver = NULL; float bestSupport = 0.0; void* cookie = NULL; while (_GetNextDriverPath(cookie, path) == B_OK) { _FindBestDriver(path.Path(), bestDriver, bestSupport, previous); } if (bestDriver != NULL) { TRACE((" register best module \"%s\", support %f\n", bestDriver->info.name, bestSupport)); if (bestDriver->register_device(this) == B_OK) { // There can only be one node of this driver // (usually only one at all, but there might be a new driver // "waiting" for its turn) device_node* child = FindChild(bestDriver->info.name); if (child != NULL) { child->fSupportsParent = bestSupport; if (previous != NULL) { previous->fFlags |= NODE_FLAG_OBSOLETE_DRIVER; previous->Release(); child->fFlags |= NODE_FLAG_WAITING_FOR_DRIVER; } } // TODO: if this fails, we could try the second best driver, // and so on... } put_module(bestDriver->info.name); } } else { // register all drivers that match void* cookie = NULL; while (_GetNextDriverPath(cookie, path) == B_OK) { _RegisterPath(path.Path()); } } return B_OK; }
void wxGenericDirCtrl::SelectPath(const wxString& path, bool select) { bool done = false; wxTreeItemId treeid = FindChild(m_rootId, path, done); wxTreeItemId lastId = treeid; // The last non-zero treeid while ( treeid.IsOk() && !done ) { treeid = FindChild(treeid, path, done); if ( treeid.IsOk() ) lastId = treeid; } if ( !lastId.IsOk() ) return; if ( done ) { m_treeCtrl->SelectItem(treeid, select); } }