char -> std::byte

This commit is contained in:
Andreas Tsouchlos 2025-04-19 02:39:12 +02:00
parent 5121c2a27b
commit 2b14257c52
2 changed files with 4 additions and 5 deletions

View File

@ -321,7 +321,7 @@ void NonBlockingClient::disconnect() {
}
[[nodiscard]] std::expected<int, int>
NonBlockingClient::send(std::span<const char> data) {
NonBlockingClient::send(std::span<const std::byte> data) {
// TODO: Do we need this?
auto conRes = get_last_connection_status();
if (!conRes) return std::unexpected{conRes.error()};
@ -359,7 +359,7 @@ bool NonBlockingClient::data_available() {
}
[[nodiscard]] std::expected<int, int>
NonBlockingClient::recv(std::span<char> buffer) {
NonBlockingClient::recv(std::span<std::byte> buffer) {
const int bytesReceived =
::recv(m_socket, (char*)buffer.data(), buffer.size(), 0);

View File

@ -98,9 +98,8 @@ public:
bool data_available();
// TODO: Make this std::byte
[[nodiscard]] std::expected<int, int> recv(std::span<char> buffer);
[[nodiscard]] std::expected<int, int> send(std::span<const char> data);
[[nodiscard]] std::expected<int, int> recv(std::span<std::byte> buffer);
[[nodiscard]] std::expected<int, int> send(std::span<const std::byte> data);
private:
int m_socket = -1;