| 102 | } |
| 103 | |
| 104 | bool CryptOpenFiles::Rename(LPCWSTR from, LPCWSTR to) |
| 105 | { |
| 106 | wstring ucfrom; |
| 107 | wstring ucto; |
| 108 | |
| 109 | if (!touppercase(from, ucfrom)) { |
| 110 | return false; |
| 111 | } |
| 112 | |
| 113 | if (!touppercase(to, ucto)) { |
| 114 | return false; |
| 115 | } |
| 116 | |
| 117 | lock_guard<mutex> lock(m_mutex); |
| 118 | |
| 119 | auto it_from = m_openfiles.find(ucfrom); |
| 120 | |
| 121 | if (it_from == m_openfiles.end()) { |
| 122 | assert(false); |
| 123 | return false; |
| 124 | } |
| 125 | |
| 126 | auto entry = it_from->second; |
| 127 | |
| 128 | m_openfiles.erase(it_from); |
| 129 | |
| 130 | auto it_to = m_openfiles.find(ucto); |
| 131 | |
| 132 | if (it_to != m_openfiles.end()) { |
| 133 | assert(false); |
| 134 | return false; |
| 135 | } |
| 136 | |
| 137 | m_openfiles[ucto] = entry; |
| 138 | |
| 139 | return true; |
| 140 | } |
no test coverage detected