Small changes for MingW compiles concerning unsupported error code and clarified test in utf8 decoder.

This commit is contained in:
Steffen Schümann 2019-05-11 15:49:26 +02:00
parent 7e975a8f7f
commit 16a5fbb86e

View File

@ -740,7 +740,8 @@ 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;
@ -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
@ -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)
@ -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());
} }
} }