Changeset 410 for cpp/common/virtfile/virtfile.cpp
- Timestamp:
- 07/02/15 11:07:42 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/virtfile/virtfile.cpp
r302 r410 189 189 printf("ChainFileSystem::Vfopendir %s (chain=%p)\n",path,chain); 190 190 #endif 191 return (chain != NULL) ? chain->Vopendir(path) : NULL; 191 if (chain==NULL) return internalopendir(path); 192 return new Dir(string(path),this,chain); 192 193 } 193 194 … … 206 207 return (chain != NULL) ? chain->Vdirexists(path, is_writable) : false; 207 208 } 209 210 ChainFileSystem::Dir::~Dir() 211 { 212 if (dir) delete dir; 213 } 214 215 dirent* ChainFileSystem::Dir::Vreaddir() 216 { 217 dirent *de; 218 retry: 219 if (!dir) 220 { 221 if (first) 222 { 223 dir=first->internalopendir(path.c_str()); 224 first=NULL; 225 } 226 else if (second) 227 { 228 dir=second->Vopendir(path.c_str()); 229 second=NULL; 230 } 231 else 232 return NULL; 233 } 234 de=dir ? dir->Vreaddir() : NULL; 235 if (de==NULL) 236 {if (dir) delete dir; dir=NULL; goto retry;} 237 238 // no need to check for duplicates if no names are saved and scanning the last location (most common case) 239 if (! (duplicates.empty() && (first==NULL) && (second==NULL)) ) 240 { 241 string s(de->d_name); 242 if (duplicates.find(s)==duplicates.end()) 243 duplicates.insert(s); 244 else 245 goto retry; 246 } 247 248 return de; 249 }
Note: See TracChangeset
for help on using the changeset viewer.