[committed] libstdc++: Use _wstat64 for Windows [PR 95749]

Jonathan Wakely jwakely@redhat.com
Mon Aug 10 10:14:25 GMT 2020


In order to handle large files on Windows we need to use stat API with
64-bit st_size member.

libstdc++-v3/ChangeLog:

	PR libstdc++/95749
	* src/filesystem/ops-common.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
	(stat_type): Change to __stat64.
	(stat): Use _wstat64.

Tested x86_64-w64-mingw32. Committed to trunk.

There's a typo in the changelog which I'll fix tomorrow.

-------------- next part --------------
commit 9939be5758b52ed2fe1a7e56b94ce6d0f4d81580
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Aug 10 11:10:26 2020

    libstdc++: Use _wstat64 for Windows [PR 95749]
    
    In order to handle large files on Windows we need to use stat API with
    64-bit st_sioze member.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/95749
            * src/filesystem/ops-common.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
            (stat_type): Change to __wstat64.
            (stat): Use _wstat64.

diff --git a/libstdc++-v3/src/filesystem/ops-common.h b/libstdc++-v3/src/filesystem/ops-common.h
index 445d1ad0544..5cf900b045b 100644
--- a/libstdc++-v3/src/filesystem/ops-common.h
+++ b/libstdc++-v3/src/filesystem/ops-common.h
@@ -71,14 +71,14 @@ namespace __gnu_posix
   inline int close(int fd)
   { return ::_close(fd); }
 
-  typedef struct ::_stat stat_type;
+  typedef struct ::__stat64 stat_type;
 
   inline int stat(const wchar_t* path, stat_type* buffer)
-  { return ::_wstat(path, buffer); }
+  { return ::_wstat64(path, buffer); }
 
   inline int lstat(const wchar_t* path, stat_type* buffer)
   {
-    // TODO symlinks not currently supported
+    // FIXME: symlinks not currently supported
     return stat(path, buffer);
   }
 


More information about the Libstdc++ mailing list