Skip to content

Commit c8a23dc

Browse files
committed
safe_ptr: fixed google-explicit-constructor clang-tidy and noExplicitConstructor selfcheck warnings
1 parent 57e0ff3 commit c8a23dc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cli/cppcheckexecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
301301
mLatestProgressOutputTime = std::time(nullptr);
302302

303303
if (!settings.outputFile.empty()) {
304-
mErrorOutput = new std::ofstream(settings.outputFile);
304+
mErrorOutput = safe_ptr<std::ofstream>(new std::ofstream(settings.outputFile));
305305
}
306306

307307
if (settings.xml) {

lib/safeptr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ template<typename T>
3030
class safe_ptr
3131
{
3232
public:
33-
safe_ptr(T* p)
33+
explicit safe_ptr(T* p)
3434
: mPtr(p)
3535
{}
3636

@@ -58,7 +58,7 @@ class safe_ptr
5858
return *mPtr;
5959
}
6060

61-
operator bool() const NOEXCEPT {
61+
explicit operator bool() const NOEXCEPT {
6262
return mPtr != nullptr;
6363
}
6464

0 commit comments

Comments
 (0)