mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-07-22 20:54:27 +08:00
Small changes for MingW compiles concerning unsupported error code and clarified test in utf8 decoder.
This commit is contained in:
parent
7e975a8f7f
commit
16a5fbb86e
@ -740,13 +740,14 @@ public:
|
|||||||
void swap(recursive_directory_iterator& rhs);
|
void swap(recursive_directory_iterator& rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct recursive_directory_iterator_impl {
|
struct recursive_directory_iterator_impl
|
||||||
|
{
|
||||||
directory_options _options;
|
directory_options _options;
|
||||||
bool _recursion_pending;
|
bool _recursion_pending;
|
||||||
std::stack<directory_iterator> _dir_iter_stack;
|
std::stack<directory_iterator> _dir_iter_stack;
|
||||||
recursive_directory_iterator_impl(directory_options options, bool recursion_pending)
|
recursive_directory_iterator_impl(directory_options options, bool recursion_pending)
|
||||||
: _options(options)
|
: _options(options)
|
||||||
, _recursion_pending(recursion_pending)
|
, _recursion_pending(recursion_pending)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1055,7 +1056,11 @@ GHC_INLINE std::error_code make_error_code(portable_error err)
|
|||||||
case portable_error::invalid_argument:
|
case portable_error::invalid_argument:
|
||||||
return std::error_code(ERROR_INVALID_PARAMETER, std::system_category());
|
return std::error_code(ERROR_INVALID_PARAMETER, std::system_category());
|
||||||
case portable_error::is_a_directory:
|
case portable_error::is_a_directory:
|
||||||
|
#ifdef ERROR_DIRECTORY_NOT_SUPPORTED
|
||||||
return std::error_code(ERROR_DIRECTORY_NOT_SUPPORTED, std::system_category());
|
return std::error_code(ERROR_DIRECTORY_NOT_SUPPORTED, std::system_category());
|
||||||
|
#else
|
||||||
|
return std::error_code(ERROR_NOT_SUPPORTED, std::system_category());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
switch (err) {
|
switch (err) {
|
||||||
@ -1211,7 +1216,7 @@ inline StringType fromUtf8(const std::string& utf8String, const typename StringT
|
|||||||
unsigned utf8_state = S_STRT;
|
unsigned utf8_state = S_STRT;
|
||||||
std::uint32_t codepoint = 0;
|
std::uint32_t codepoint = 0;
|
||||||
while (iter < utf8String.end()) {
|
while (iter < utf8String.end()) {
|
||||||
if (!(utf8_state = consumeUtf8Fragment(utf8_state, (uint8_t)*iter++, codepoint))) {
|
if ((utf8_state = consumeUtf8Fragment(utf8_state, (uint8_t)*iter++, codepoint)) == S_STRT) {
|
||||||
if (sizeof(typename StringType::value_type) == 4) {
|
if (sizeof(typename StringType::value_type) == 4) {
|
||||||
result += codepoint;
|
result += codepoint;
|
||||||
}
|
}
|
||||||
@ -1818,7 +1823,6 @@ GHC_INLINE u8arguments::u8arguments(int& argc, char**& argv)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 30.10.8.4.1 constructors and destructor
|
// 30.10.8.4.1 constructors and destructor
|
||||||
|
|
||||||
@ -1965,11 +1969,11 @@ GHC_INLINE path& path::operator/=(const path& p)
|
|||||||
|
|
||||||
GHC_INLINE void path::append_name(const char* name)
|
GHC_INLINE void path::append_name(const char* name)
|
||||||
{
|
{
|
||||||
if(_path.empty()) {
|
if (_path.empty()) {
|
||||||
this->operator/=(path(name));
|
this->operator/=(path(name));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(_path.back() != path::generic_separator) {
|
if (_path.back() != path::generic_separator) {
|
||||||
_path.push_back(path::generic_separator);
|
_path.push_back(path::generic_separator);
|
||||||
}
|
}
|
||||||
_path += name;
|
_path += name;
|
||||||
@ -2428,7 +2432,7 @@ GHC_INLINE path path::lexically_normal() const
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (*(--dest.end()) != "..") {
|
else if (*(--dest.end()) != "..") {
|
||||||
if(dest._path.back() == generic_separator) {
|
if (dest._path.back() == generic_separator) {
|
||||||
dest._path.pop_back();
|
dest._path.pop_back();
|
||||||
}
|
}
|
||||||
dest.remove_filename();
|
dest.remove_filename();
|
||||||
@ -3015,7 +3019,7 @@ GHC_INLINE void copy(const path& from, const path& to, copy_options options, std
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef LWG_2682_BEHAVIOUR
|
#ifdef LWG_2682_BEHAVIOUR
|
||||||
else if(is_directory(fs_from) && (options & copy_options::create_symlinks) != copy_options::none) {
|
else if (is_directory(fs_from) && (options & copy_options::create_symlinks) != copy_options::none) {
|
||||||
ec = detail::make_error_code(detail::portable_error::is_a_directory);
|
ec = detail::make_error_code(detail::portable_error::is_a_directory);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4602,7 +4606,6 @@ public:
|
|||||||
// POSIX implementation
|
// POSIX implementation
|
||||||
class directory_iterator::impl
|
class directory_iterator::impl
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
impl(const path& path, directory_options options)
|
impl(const path& path, directory_options options)
|
||||||
: _base(path)
|
: _base(path)
|
||||||
@ -4610,7 +4613,7 @@ public:
|
|||||||
, _dir(nullptr)
|
, _dir(nullptr)
|
||||||
, _entry(nullptr)
|
, _entry(nullptr)
|
||||||
{
|
{
|
||||||
if(!path.empty()) {
|
if (!path.empty()) {
|
||||||
_dir = ::opendir(path.native().c_str());
|
_dir = ::opendir(path.native().c_str());
|
||||||
}
|
}
|
||||||
if (!path.empty()) {
|
if (!path.empty()) {
|
||||||
@ -4629,7 +4632,7 @@ public:
|
|||||||
impl(const impl& other) = delete;
|
impl(const impl& other) = delete;
|
||||||
~impl()
|
~impl()
|
||||||
{
|
{
|
||||||
if(_dir) {
|
if (_dir) {
|
||||||
::closedir(_dir);
|
::closedir(_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4648,7 +4651,7 @@ public:
|
|||||||
::closedir(_dir);
|
::closedir(_dir);
|
||||||
_dir = nullptr;
|
_dir = nullptr;
|
||||||
_current = path();
|
_current = path();
|
||||||
if(errno) {
|
if (errno) {
|
||||||
ec = std::error_code(errno, std::system_category());
|
ec = std::error_code(errno, std::system_category());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4884,13 +4887,13 @@ GHC_INLINE recursive_directory_iterator& recursive_directory_iterator::increment
|
|||||||
else {
|
else {
|
||||||
_impl->_dir_iter_stack.top().increment(ec);
|
_impl->_dir_iter_stack.top().increment(ec);
|
||||||
}
|
}
|
||||||
if(!ec) {
|
if (!ec) {
|
||||||
while (depth() && _impl->_dir_iter_stack.top() == directory_iterator()) {
|
while (depth() && _impl->_dir_iter_stack.top() == directory_iterator()) {
|
||||||
_impl->_dir_iter_stack.pop();
|
_impl->_dir_iter_stack.pop();
|
||||||
_impl->_dir_iter_stack.top().increment(ec);
|
_impl->_dir_iter_stack.top().increment(ec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!_impl->_dir_iter_stack.empty()) {
|
else if (!_impl->_dir_iter_stack.empty()) {
|
||||||
_impl->_dir_iter_stack.pop();
|
_impl->_dir_iter_stack.pop();
|
||||||
}
|
}
|
||||||
_impl->_recursion_pending = true;
|
_impl->_recursion_pending = true;
|
||||||
@ -4915,8 +4918,7 @@ GHC_INLINE void recursive_directory_iterator::pop(std::error_code& ec)
|
|||||||
do {
|
do {
|
||||||
_impl->_dir_iter_stack.pop();
|
_impl->_dir_iter_stack.pop();
|
||||||
_impl->_dir_iter_stack.top().increment(ec);
|
_impl->_dir_iter_stack.top().increment(ec);
|
||||||
}
|
} while (depth() && _impl->_dir_iter_stack.top() == directory_iterator());
|
||||||
while (depth() && _impl->_dir_iter_stack.top() == directory_iterator());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user