diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx index 5d197d2fbb..548e3279b0 100644 --- a/Source/cmFileLock.cxx +++ b/Source/cmFileLock.cxx @@ -12,11 +12,7 @@ cmFileLock::cmFileLock(cmFileLock&& other) noexcept { this->File = other.File; -#if defined(_WIN32) - other.File = INVALID_HANDLE_VALUE; -#else - other.File = -1; -#endif + other.File = (decltype(other.File))-1; this->Filename = std::move(other.Filename); } @@ -32,11 +28,7 @@ cmFileLock::~cmFileLock() cmFileLock& cmFileLock::operator=(cmFileLock&& other) noexcept { this->File = other.File; -#if defined(_WIN32) - other.File = INVALID_HANDLE_VALUE; -#else - other.File = -1; -#endif + other.File = (decltype(other.File))-1; this->Filename = std::move(other.Filename); return *this; diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx index b7f7f38b24..632c0e9a96 100644 --- a/Source/cmFileLockResult.cxx +++ b/Source/cmFileLockResult.cxx @@ -5,6 +5,10 @@ #include #include +#ifdef _WIN32 +# include +#endif + cmFileLockResult cmFileLockResult::MakeOk() { return { OK, 0 }; diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h index 8a58d1f0a3..e252de7394 100644 --- a/Source/cmFileLockResult.h +++ b/Source/cmFileLockResult.h @@ -6,10 +6,6 @@ #include -#if defined(_WIN32) -# include // DWORD -#endif - /** * @brief Result of the locking/unlocking file. * @note See @c cmFileLock @@ -17,11 +13,7 @@ class cmFileLockResult { public: -#if defined(_WIN32) - using Error = DWORD; -#else using Error = int; -#endif /** * @brief Successful lock/unlock.