Skip to content

Commit f2fea13

Browse files
authored
Fix MakeDirectoryContentReadonly recursion loop. (#1044)
Helpers.cpp contains overloaded MakeDirectoryContentReadonly function. 1st one translates std::string into TCHAR* and call 2nd one, but at least on windows compiler translates TCHAR* into std::string again and infinite recursion occur. Resolves: OLPEDGE-2270 Signed-off-by: Kostiantyn Zvieriev <ext-kostiantyn.zvieriev@here.com>
1 parent db067e7 commit f2fea13

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

olp-cpp-sdk-core/tests/cache/Helpers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
namespace {
4040
#if defined(_WIN32) && !defined(__MINGW32__)
4141

42-
bool MakeDirectoryContentReadonly(const TCHAR* utfdirPath, bool readonly) {
42+
bool MakeDirectoryContentReadonlyWin(const TCHAR* utfdirPath, bool readonly) {
4343
HANDLE hFind; // file handle
4444
WIN32_FIND_DATA FindFileData;
4545

@@ -72,7 +72,7 @@ bool MakeDirectoryContentReadonly(const TCHAR* utfdirPath, bool readonly) {
7272
StringCchCat(filename, _countof(filename), FindFileData.cFileName);
7373
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
7474
// we have found a directory, recurse
75-
if (!MakeDirectoryContentReadonly(filename, readonly)) {
75+
if (!MakeDirectoryContentReadonlyWin(filename, readonly)) {
7676
bSearch = false;
7777
break;
7878
}
@@ -141,7 +141,7 @@ bool MakeDirectoryContentReadonly(const std::string& path, bool readonly) {
141141
const TCHAR* n_path = path.c_str();
142142
#endif // _UNICODE
143143

144-
return MakeDirectoryContentReadonly(n_path, readonly);
144+
return MakeDirectoryContentReadonlyWin(n_path, readonly);
145145

146146
#else
147147

0 commit comments

Comments
 (0)