Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions include/fast_io_hosted/platforms/nt/nt_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,31 @@ inline auto nt_call_invoke_with_directory_handle_impl(void *directory, char_type
= char16_t const *;
if constexpr (::std::same_as<char_type, char16_t>)
{
using char16_may_alias_ptr
#if __has_cpp_attribute(__gnu__::__may_alias__)
[[__gnu__::__may_alias__]]
#endif
= char16_t *;
::std::uint_least16_t const bytes(strlen_to_nt_filename_bytes(filename_len));

// Since this involves escaping Win32-style paths to NT, all forward slashes '/' are converted to backslashes '\\'.

auto const char16_t_size{bytes / sizeof(char16_t)};

rtl_alloc_guard rtl_guard{rtl_alloc_guard::allocator::allocate(char16_t_size)};
rtl_alloc_guard rtl_guard{rtl_alloc_guard::allocator::allocate(char16_t_size + 1u)};

::fast_io::freestanding::nonoverlapped_bytes_copy_n(reinterpret_cast<::std::byte const *>(filename), bytes, reinterpret_cast<::std::byte *>(rtl_guard.ptr));

for (auto curr{rtl_guard.ptr}; curr != rtl_guard.ptr + char16_t_size; ++curr)
auto curr{rtl_guard.ptr};
for (; curr != rtl_guard.ptr + char16_t_size; ++curr)
{
if (*curr == u'/')
{
*curr = u'\\';
}
}

*curr = u'\0';

win32::nt::unicode_string relative_path{
.Length = bytes, .MaximumLength = bytes, .Buffer = rtl_guard.ptr};
.Length = bytes,
.MaximumLength = static_cast<::std::uint_least16_t>(bytes + sizeof(char16_t)),
.Buffer = rtl_guard.ptr};
return callback(directory, __builtin_addressof(relative_path));
}
else if constexpr (sizeof(char_type) == sizeof(char16_t))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct win32_socket_event_guard_t
curr_handle = {};
return temp;
}

inline constexpr native_handle_type native_handle() const noexcept
{
return curr_handle;
Expand Down
2 changes: 0 additions & 2 deletions include/fast_io_hosted/process/process/arg_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ inline constexpr void append_win32_quoted_arg_common(

if (!needs_quote)
{
auto const sz{static_cast<::std::size_t>(last - first)};
for (it = first; it != last; ++it)
{
str.push_back(*it);
Expand All @@ -59,7 +58,6 @@ inline constexpr void append_win32_quoted_arg_common(
return;
}

auto const sz{static_cast<::std::size_t>(last - first)};
str.push_back(::fast_io::char_literal_v<u8'\"', replace_char_type>);
for (it = first; it != last; ++it)
{
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_hosted/threads/thread/dos.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#include <chrono>
#include <ranges>
Expand Down
5 changes: 3 additions & 2 deletions include/fast_io_hosted/threads/thread/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#endif
#elif defined(__MSDOS__) || defined(__DJGPP__)
#include "dos.h"
#elif !defined(__SINGLE_THREAD__) && !defined(__NEWLIB__) && \
!defined(__MSDOS__) && !defined(__wasi__) && __has_include(<pthread.h>)
#elif defined(__wasi__)
#include "wasi.h"
#elif !defined(__SINGLE_THREAD__) && !defined(__NEWLIB__) && !defined(__MSDOS__) && __has_include(<pthread.h>)
#include "pthread.h"
#endif
Loading