]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Rename win32compat to Win32Util
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 29 Jul 2020 06:43:21 +0000 (08:43 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 29 Jul 2020 14:43:59 +0000 (16:43 +0200)
src/CMakeLists.txt
src/Lockfile.cpp
src/Util.cpp
src/Win32Util.cpp [moved from src/win32compat.cpp with 92% similarity]
src/Win32Util.hpp [moved from src/win32compat.hpp with 86% similarity]
src/execute.cpp
src/legacy_util.cpp

index 2a24a208330f37fde359f77487f68e8607068e3a..f28c192a9bdec90db3e91f3db5daec3e00ab611d 100644 (file)
@@ -47,7 +47,7 @@ if(INODE_CACHE_SUPPORTED)
 endif()
 
 if(WIN32)
-  list(APPEND source_files win32compat.cpp)
+  list(APPEND source_files Win32Util.cpp)
 endif()
 
 add_library(ccache_lib STATIC ${source_files})
index e1fe22579ecfe7782e80e41a124a263d11d7cee8..e07d0c2c71af9543b4b6372cab88f090025907b1 100644 (file)
@@ -23,7 +23,7 @@
 #include "logging.hpp"
 
 #ifdef _WIN32
-#  include "win32compat.hpp"
+#  include "Win32Util.hpp"
 #endif
 
 #include "third_party/fmt/core.h"
@@ -154,7 +154,7 @@ do_acquire_win32(const std::string& lockfile, uint32_t staleness_limit)
     DWORD error = GetLastError();
     cc_log("lockfile_acquire: CreateFile %s: %s (%lu)",
            lockfile.c_str(),
-           win32_error_message(error).c_str(),
+           Win32Util::error_message(error).c_str(),
            error);
     if (error == ERROR_PATH_NOT_FOUND) {
       // Directory doesn't exist?
index d82a5fa1158c29324faa616538372eae56a3f5a5..6e1d55633f9edafa57412b722e4065f9d48c94a8 100644 (file)
 #  include <sys/param.h>
 #endif
 
-#ifdef _WIN32
-#  include "win32compat.hpp"
-#endif
-
 #ifdef __linux__
 #  ifdef HAVE_SYS_IOCTL_H
 #    include <sys/ioctl.h>
similarity index 92%
rename from src/win32compat.cpp
rename to src/Win32Util.cpp
index 27d9a6bb3877a4a75845ed1c886f1e791a90b4fd..f046153fa7773415de4b99cec2ba05b8066c951c 100644 (file)
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#include "win32compat.hpp"
+#include "Win32Util.hpp"
 
-#ifdef _WIN32
+namespace Win32Util {
 
 std::string
-win32_error_message(DWORD error_code)
+error_message(DWORD error_code)
 {
   LPSTR buffer;
   size_t size =
@@ -38,4 +38,4 @@ win32_error_message(DWORD error_code)
   return message;
 }
 
-#endif
+} // namespace Win32Util
similarity index 86%
rename from src/win32compat.hpp
rename to src/Win32Util.hpp
index 252b25972e082d0317ef45a2ad0668015541f5fe..3a7ed1c9f589cd95b79c0fa6c52ee707ae71346f 100644 (file)
@@ -22,7 +22,8 @@
 
 #include <string>
 
-std::string win32_error_message(DWORD error_code);
+namespace Win32Util {
 
-BOOL
-GetFileNameFromHandle(HANDLE file_handle, TCHAR* filename, WORD cch_filename);
+std::string error_message(DWORD error_code);
+
+} // namespace Win32Util
index e444a70cd730400ea27a6a33b685a787ef3ec105..89096aaaf0ec21bfcdc81ef4080addad764b30d7 100644 (file)
@@ -30,7 +30,7 @@
 #include "logging.hpp"
 
 #ifdef _WIN32
-#  include "win32compat.hpp"
+#  include "Win32Util.hpp"
 #endif
 
 using nonstd::string_view;
@@ -229,10 +229,9 @@ win32execute(const char* path,
   free(args);
   if (ret == 0) {
     DWORD error = GetLastError();
-    std::string error_message = win32_error_message(error);
     cc_log("failed to execute %s: %s (%lu)",
            full_path_win_ext,
-           win32_error_message(error).c_str(),
+           Win32Util::error_message(error).c_str(),
            error);
     return -1;
   }
index 07629c590bbb1015f37b806e40c101b959d33476..fe7cbd94b0d9332ee026c0ad6feeee17e34087a3 100644 (file)
@@ -24,7 +24,7 @@
 #include "logging.hpp"
 
 #ifdef _WIN32
-#  include "win32compat.hpp"
+#  include "Win32Util.hpp"
 #endif
 
 #ifdef HAVE_PWD_H
@@ -170,7 +170,7 @@ x_rename(const char* oldpath, const char* newpath)
     cc_log("failed to rename %s to %s: %s (%lu)",
            oldpath,
            newpath,
-           win32_error_message(error).c_str(),
+           Win32Util::error_message(error).c_str(),
            error);
     return -1;
   } else {