MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / Rename

Method Rename

libcppcryptfs/file/openfiles.cpp:104–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104bool 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}

Callers 1

CryptMoveFileInternalFunction · 0.80

Calls 3

touppercaseFunction · 0.85
findMethod · 0.80
eraseMethod · 0.80

Tested by

no test coverage detected