1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 17:15:08 +00:00

AK: Rename span() to bytes() when appropriate.

I originally defined the bytes() method for the String class, because it
made it obvious that it's a span of bytes instead of span of characters.

This commit makes this more consistent by defining a bytes() method when
the type of the span is known to be u8.

Additionaly, the cast operator to Bytes is overloaded for ByteBuffer and
such.
This commit is contained in:
asynts 2020-08-15 18:38:24 +02:00 committed by Andreas Kling
parent 525d51bbb5
commit fff581cd72
18 changed files with 51 additions and 45 deletions

View file

@ -102,7 +102,7 @@ KResultOr<size_t> UDPSocket::protocol_send(const void* data, size_t data_length)
udp_packet.set_length(sizeof(UDPPacket) + data_length);
memcpy(udp_packet.payload(), data, data_length);
klog() << "sending as udp packet from " << routing_decision.adapter->ipv4_address().to_string().characters() << ":" << local_port() << " to " << peer_address().to_string().characters() << ":" << peer_port() << "!";
routing_decision.adapter->send_ipv4(routing_decision.next_hop, peer_address(), IPv4Protocol::UDP, buffer.span(), ttl());
routing_decision.adapter->send_ipv4(routing_decision.next_hop, peer_address(), IPv4Protocol::UDP, buffer, ttl());
return data_length;
}