| 782 | } |
| 783 | |
| 784 | void Directory::scan_dir(const ACE_TString& relative, DDS_Dirent& dir, |
| 785 | unsigned int overflow_index) |
| 786 | { |
| 787 | ACE_TString path = physical_dirname_ + relative; |
| 788 | add_slash(path); |
| 789 | |
| 790 | while (DDS_DIRENT* ent = dir.read()) { |
| 791 | if (ent->d_name[0] == ACE_TEXT('.') && (!ent->d_name[1] || |
| 792 | (ent->d_name[1] == ACE_TEXT('.') && !ent->d_name[2]))) { |
| 793 | continue; // skip '.' and '..' |
| 794 | } |
| 795 | |
| 796 | ACE_TString file = path + ent->d_name; |
| 797 | |
| 798 | if (is_dir(file.c_str())) { |
| 799 | ACE_TString phys(relative); |
| 800 | add_slash(phys); |
| 801 | phys += ent->d_name; |
| 802 | |
| 803 | if (ACE_OS::strncmp(ent->d_name, ACE_TEXT("_overflow."), 10) == 0) { |
| 804 | unsigned int n = static_cast<unsigned int>(ACE_OS::atoi(ent->d_name + 10)); |
| 805 | DDS_Dirent overflow(file.c_str()); |
| 806 | scan_dir(ent->d_name, overflow, n); |
| 807 | |
| 808 | } else if (ACE_OS::strlen(ent->d_name) <= FSS_MAX_FILE_NAME_ENCODED) { |
| 809 | dirs_[b32h_decode(ent->d_name)] = phys; |
| 810 | ++overflow_[overflow_index]; |
| 811 | |
| 812 | } else { |
| 813 | CwdGuard cg(file); |
| 814 | std::ifstream fn("_fullname"); |
| 815 | OPENDDS_STRING fullname; |
| 816 | |
| 817 | if (!std::getline(fn, fullname)) { |
| 818 | throw std::runtime_error("Can't read .../_fullname"); |
| 819 | } |
| 820 | |
| 821 | ACE_TString full_t(ACE_TEXT_CHAR_TO_TCHAR(fullname.c_str())); |
| 822 | dirs_[full_t] = phys; |
| 823 | ++overflow_[overflow_index]; |
| 824 | |
| 825 | String_Index_t idx = phys.rfind(ACE_TEXT('.')); |
| 826 | |
| 827 | if (idx == ACE_TString::npos) { |
| 828 | throw std::runtime_error("Badly formatted long dir name"); |
| 829 | } |
| 830 | |
| 831 | ACE_TString prefix(phys.c_str(), idx); |
| 832 | unsigned int serial = static_cast<unsigned int>(ACE_OS::atoi(&phys[idx + 1])); |
| 833 | unsigned int& counter = long_names_[prefix]; |
| 834 | |
| 835 | if (serial >= counter) counter = serial + 1; |
| 836 | } |
| 837 | |
| 838 | } else { // regular file |
| 839 | if (ent->d_name[0] != ACE_TEXT('_')) { |
| 840 | files_[b32h_decode(ent->d_name)] = ent->d_name; |
| 841 | ++overflow_[overflow_index]; |
nothing calls this directly
no test coverage detected