| 54 | static_assert(sizeof(UniversalAddress) == 128); |
| 55 | |
| 56 | std::pair<const char *, std::unique_ptr<char[]>> |
| 57 | createNullTerminatedString(std::string_view View) noexcept { |
| 58 | const char *CStr = nullptr; |
| 59 | std::unique_ptr<char[]> Buffer; |
| 60 | if (!View.empty()) { |
| 61 | if (const auto Pos = View.find_first_of('\0'); |
| 62 | Pos != std::string_view::npos) { |
| 63 | CStr = View.data(); |
| 64 | } else { |
| 65 | Buffer = std::make_unique<char[]>(View.size() + 1); |
| 66 | std::copy(View.begin(), View.end(), Buffer.get()); |
| 67 | CStr = Buffer.get(); |
| 68 | } |
| 69 | } |
| 70 | return {CStr, std::move(Buffer)}; |
| 71 | } |
| 72 | |
| 73 | WasiExpect<std::tuple<DWORD_, DWORD_, DWORD_>> inline constexpr getOpenFlags( |
| 74 | __wasi_oflags_t OpenFlags, __wasi_fdflags_t FdFlags, |