inline bool Spec::get_first_column_type_from_ref(ref_type top_ref, Allocator& alloc, ColumnType& type) noexcept { const char* top_header = alloc.translate(top_ref); ref_type types_ref = to_ref(Array::get(top_header, 0)); const char* types_header = alloc.translate(types_ref); if (Array::get_size_from_header(types_header) == 0) return false; type = ColumnType(Array::get(types_header, 0)); return true; }
// eiman // slaad - changed to use gIgnoreList bool QueryView::ShouldIgnore( BMessage * msg ) { bool result=false; dev_t device; ino_t node; ino_t directory; int32 opcode; const char * name; msg->FindInt32("device",&device); msg->FindInt64("node",&node); msg->FindInt64("directory",&directory); msg->FindInt32("opcode",&opcode); msg->FindString("name",&name); if ( opcode == B_ENTRY_CREATED ) { // Entry for matching file entry_ref match_ref(device,directory,name); BEntry match(&match_ref); BEntry parent; if ( match.GetParent(&parent) == B_OK ) { entry_ref parent_ref; parent.GetRef(&parent_ref); reflist::iterator iter; iter = gIgnoreList.begin(); while ( iter != gIgnoreList.end() ) { if ( (*iter) == parent_ref ) { // Parent is ignored, break node_ref ref; ref.node = node; ref.device = device; fIgnoredMatches.push_back( ref ); result = true; break; } iter++; } } // start watching node node_ref ref; ref.node = node; ref.device = device; watch_node( &ref, B_WATCH_NAME, BMessenger(this) ); } if ( opcode == B_ENTRY_MOVED ) { // from node-monitoring, not query // Get entry_ref to file ino_t to_dir; msg->FindInt64("to directory",&to_dir); entry_ref to_ref(device,to_dir,name); // get parent BEntry entry(&to_ref); BEntry parent; entry.GetParent(&parent); entry_ref parent_ref; parent.GetRef(&parent_ref); reflist::iterator iter; iter = gIgnoreList.begin(); while ( iter != gIgnoreList.end() ) { if ( (*iter) == parent_ref ) { // Parent is ignored, break node_ref ref; ref.node = node; ref.device = device; list<node_ref>::iterator iter; iter = find(fIgnoredMatches.begin(), fIgnoredMatches.end(), ref); if ( iter == fIgnoredMatches.end() ) { // make sure we don't ignore twice (moving between two ignored dirs) fIgnoredMatches.push_back( ref ); } result = true; break; } iter++; } if ( !result ) { // remove node from ignore list if present list<node_ref>::iterator iter; node_ref ref; ref.node = node; ref.device = device; iter = find(fIgnoredMatches.begin(), fIgnoredMatches.end(), ref); if ( iter != fIgnoredMatches.end() ) { // found ignored fIgnoredMatches.erase(iter); } } } if ( opcode == B_ENTRY_REMOVED ) { // remove from fIgnoredMatches if there list<node_ref>::iterator iter; node_ref ref; ref.node = node; ref.device = device; iter = find(fIgnoredMatches.begin(), fIgnoredMatches.end(), ref); if ( iter != fIgnoredMatches.end() ) { // found ignored fIgnoredMatches.erase(iter); result = true; } watch_node( &ref, B_STOP_WATCHING, BMessenger(this) ); } return result; }