]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/nowide/src/stat.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / nowide / src / stat.cpp
1 //
2 // Copyright (c) 2020-2022 Alexander Grund
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7
8 #define BOOST_NOWIDE_SOURCE
9
10 #if defined(__MINGW32__) && defined(__STRICT_ANSI__)
11 // Need the _w* functions which are extensions on MinGW but not on MinGW-w64
12 #include <_mingw.h>
13 #ifndef __MINGW64_VERSION_MAJOR
14 #undef __STRICT_ANSI__
15 #endif
16 #endif
17
18 #include <boost/nowide/config.hpp>
19
20 #ifdef BOOST_WINDOWS
21
22 #include <boost/nowide/stackstring.hpp>
23 #include <boost/nowide/stat.hpp>
24 #include <errno.h>
25
26 namespace boost {
27 namespace nowide {
28 namespace detail {
29 int stat(const char* path, posix_stat_t* buffer, size_t buffer_size)
30 {
31 if(sizeof(*buffer) != buffer_size)
32 {
33 errno = EINVAL;
34 return EINVAL;
35 }
36 const wstackstring wpath(path);
37 return _wstat(wpath.get(), buffer);
38 }
39 int stat(const char* path, stat_t* buffer, size_t buffer_size)
40 {
41 if(sizeof(*buffer) != buffer_size)
42 {
43 errno = EINVAL;
44 return EINVAL;
45 }
46 const wstackstring wpath(path);
47 return _wstat64(wpath.get(), buffer);
48 }
49 } // namespace detail
50 } // namespace nowide
51 } // namespace boost
52
53 #endif