Skip to content

Commit

Permalink
Merge pull request #1018 from MacroModel/master
Browse files Browse the repository at this point in the history
using (tlc_)win32_9xa_dir_handle_path_str
  • Loading branch information
trcrsired authored Dec 7, 2024
2 parents ed90b1b + 2f9a710 commit 3b96519
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/fast_io_dsal/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ constexpr inline ::fast_io::u8string u8concat_fast_io(Args &&...args)
}
else
{
static_assert(type_error, "some types are not printable, so we cannot concat ::fast_io::FFFstring");
static_assert(type_error, "some types are not printable, so we cannot concat ::fast_io::u8string");
return {};
}
}
Expand Down
4 changes: 2 additions & 2 deletions include/fast_io_hosted/filesystem/win32_9xa.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace fast_io
struct win32_9xa_dirent
{
void *file_struct{};
::fast_io::containers::basic_string<char8_t, ::fast_io::native_global_allocator> find_path{};
::fast_io::win32::details::win32_9xa_dir_handle_path_str find_path{};

::fast_io::win32_9xa_dir_handle d_handle{};
file_type d_type{};
[[maybe_unused]] ::std::uint_least64_t d_ino{};
::fast_io::containers::basic_string<char8_t, ::fast_io::native_global_allocator> filename{};
::fast_io::win32::details::win32_9xa_dir_handle_path_str filename{};

inline ~win32_9xa_dirent()
{
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_hosted/filesystem/win32_9xa_at.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ inline constexpr win32_9xa_at_flags &operator^=(win32_9xa_at_flags &x, win32_9xa
namespace win32::details
{

inline ::fast_io::containers::basic_string<char8_t, ::fast_io::native_thread_local_allocator> concat_tlc_win32_9xa_path_uncheck_whether_exist(::fast_io::win32_9xa_dir_handle const &dirhd, char8_t const *path_c_str, ::std::size_t path_size) noexcept
inline ::fast_io::win32::details::tlc_win32_9xa_dir_handle_path_str concat_tlc_win32_9xa_path_uncheck_whether_exist(::fast_io::win32_9xa_dir_handle const &dirhd, char8_t const *path_c_str, ::std::size_t path_size) noexcept
{
auto const beg{path_c_str};
auto curr{beg};
Expand Down
25 changes: 15 additions & 10 deletions include/fast_io_hosted/platforms/win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -916,42 +916,47 @@ struct
}
};

namespace win32::details
{
using win32_9xa_dir_handle_path_str = ::fast_io::containers::basic_string<char8_t, ::fast_io::native_global_allocator>;
using tlc_win32_9xa_dir_handle_path_str = ::fast_io::containers::basic_string<char8_t, ::fast_io::native_thread_local_allocator>;
} // namespace win32::details

struct win32_9xa_dir_handle
{
::fast_io::containers::basic_string<char8_t, ::fast_io::native_global_allocator> path;
win32::details::win32_9xa_dir_handle_path_str path;
};

namespace win32::details
{

template <typename... Args>
constexpr inline ::fast_io::containers::basic_string<char8_t, ::fast_io::native_global_allocator> concat_win32_9xa_dir_handle_path_str(Args &&...args)
constexpr inline win32_9xa_dir_handle_path_str concat_win32_9xa_dir_handle_path_str(Args &&...args)
{
constexpr bool type_error{::fast_io::operations::defines::print_freestanding_okay<::fast_io::details::dummy_buffer_output_stream<char8_t>, Args...>};
if constexpr (type_error)
{
return ::fast_io::basic_general_concat<false, char8_t, ::fast_io::containers::basic_string<char8_t, ::fast_io::native_global_allocator>>(
return ::fast_io::basic_general_concat<false, char8_t, win32_9xa_dir_handle_path_str>(
::fast_io::io_print_forward<char8_t>(::fast_io::io_print_alias(args))...);
}
else
{
static_assert(type_error, "some types are not printable, so we cannot concat ::fast_io::FFFstring");
static_assert(type_error, "some types are not printable, so we cannot concat ::fast_io::win32::details::win32_9xa_dir_handle_path_str");
return {};
}
}

template <typename... Args>
constexpr inline ::fast_io::containers::basic_string<char8_t, ::fast_io::native_thread_local_allocator> concat_tlc_win32_9xa_dir_handle_path_str(Args &&...args)
constexpr inline tlc_win32_9xa_dir_handle_path_str concat_tlc_win32_9xa_dir_handle_path_str(Args &&...args)
{
constexpr bool type_error{::fast_io::operations::defines::print_freestanding_okay<::fast_io::details::dummy_buffer_output_stream<char8_t>, Args...>};
if constexpr (type_error)
{
return ::fast_io::basic_general_concat<false, char8_t, ::fast_io::containers::basic_string<char8_t, ::fast_io::native_thread_local_allocator>>(
return ::fast_io::basic_general_concat<false, char8_t, tlc_win32_9xa_dir_handle_path_str>(
::fast_io::io_print_forward<char8_t>(::fast_io::io_print_alias(args))...);
}
else
{
static_assert(type_error, "some types are not printable, so we cannot concat ::fast_io::FFFstring");
static_assert(type_error, "some types are not printable, so we cannot concat ::fast_io::win32::details::tlc_win32_9xa_dir_handle_path_str");
return {};
}
}
Expand Down Expand Up @@ -1005,7 +1010,7 @@ inline win32_9xa_dir_handle basic_win32_9xa_create_dir_file_impl(char const *fil
#endif
= char8_t const *;

::fast_io::containers::basic_string<char8_t, ::fast_io::native_global_allocator> path{concat_win32_9xa_dir_handle_path_str(::fast_io::mnp::os_c_str_with_known_size(
win32_9xa_dir_handle_path_str path{concat_win32_9xa_dir_handle_path_str(::fast_io::mnp::os_c_str_with_known_size(
reinterpret_cast<char8_t_const_may_alias_ptr>(filename_c_str), filename_c_str_len))};

for (auto &c : path)
Expand Down Expand Up @@ -1120,7 +1125,7 @@ inline void *basic_win32_9xa_create_file_at_fs_dirent_impl(win32_9xa_dir_handle
}
}

::fast_io::containers::basic_string<char8_t, ::fast_io::native_global_allocator> str{concat_win32_9xa_dir_handle_path_str(::fast_io::mnp::code_cvt(directory_handle->path), u8"\\", ::fast_io::mnp::os_c_str_with_known_size(beg, filename_c_str_len))};
win32_9xa_dir_handle_path_str str{concat_win32_9xa_dir_handle_path_str(::fast_io::mnp::code_cvt(directory_handle->path), u8"\\", ::fast_io::mnp::os_c_str_with_known_size(beg, filename_c_str_len))};
auto handle{::fast_io::details::win32_create_file_impl<win32_family::ansi_9x>(str, ompm)};
return handle;
}
Expand Down

0 comments on commit 3b96519

Please sign in to comment.