[libcxx-commits] [libcxx] r370599 - [libc++] Fix directory_iterator compilation on Win32

Nico Weber via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 31 16:17:38 PDT 2019


Author: nico
Date: Sat Aug 31 16:17:38 2019
New Revision: 370599

URL: http://llvm.org/viewvc/llvm-project?rev=370599&view=rev
Log:
[libc++] Fix directory_iterator compilation on Win32

This patch fixes some typos and other small errors in
directory_iterator.cpp that prevented this file from being compiled for
Win32.

Patch by Stefan Schmidt <thrimbor.github at gmail.com>!

Differential Revision: https://reviews.llvm.org/D66986

Modified:
    libcxx/trunk/src/filesystem/directory_iterator.cpp

Modified: libcxx/trunk/src/filesystem/directory_iterator.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/filesystem/directory_iterator.cpp?rev=370599&r1=370598&r2=370599&view=diff
==============================================================================
--- libcxx/trunk/src/filesystem/directory_iterator.cpp (original)
+++ libcxx/trunk/src/filesystem/directory_iterator.cpp Sat Aug 31 16:17:38 2019
@@ -10,7 +10,7 @@
 #include "__config"
 #if defined(_LIBCPP_WIN32API)
 #define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
+#include <windows.h>
 #else
 #include <dirent.h>
 #endif
@@ -79,14 +79,14 @@ static file_type get_file_type(const WIN
   return file_type::unknown;
 }
 static uintmax_t get_file_size(const WIN32_FIND_DATA& data) {
-  return (data.nFileSizeHight * (MAXDWORD + 1)) + data.nFileSizeLow;
+  return (data.nFileSizeHigh * (MAXDWORD + 1)) + data.nFileSizeLow;
 }
 static file_time_type get_write_time(const WIN32_FIND_DATA& data) {
   ULARGE_INTEGER tmp;
-  FILETIME& time = data.ftLastWriteTime;
+  const FILETIME& time = data.ftLastWriteTime;
   tmp.u.LowPart = time.dwLowDateTime;
   tmp.u.HighPart = time.dwHighDateTime;
-  return file_time_type(file_time_type::duration(time.QuadPart));
+  return file_time_type(file_time_type::duration(tmp.QuadPart));
 }
 
 #endif
@@ -110,7 +110,7 @@ public:
 
   __dir_stream(const path& root, directory_options opts, error_code& ec)
       : __stream_(INVALID_HANDLE_VALUE), __root_(root) {
-    __stream_ = ::FindFirstFileEx(root.c_str(), &__data_);
+    __stream_ = ::FindFirstFile(root.c_str(), &__data_);
     if (__stream_ == INVALID_HANDLE_VALUE) {
       ec = error_code(::GetLastError(), generic_category());
       const bool ignore_permission_denied =
@@ -140,7 +140,7 @@ public:
       //cdata.__write_time_ = get_write_time(__data_);
       __entry_.__assign_iter_entry(
           __root_ / __data_.cFileName,
-          directory_entry::__create_iter_result(get_file_type(__data)));
+          directory_entry::__create_iter_result(detail::get_file_type(__data)));
       return true;
     }
     ec = error_code(::GetLastError(), generic_category());




More information about the libcxx-commits mailing list