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

ByteBuffer: Remove pointer() in favor of data()

We had two ways to get the data inside a ByteBuffer. That was silly.
This commit is contained in:
Andreas Kling 2019-09-30 08:57:01 +02:00
parent dd696e7c75
commit 8f45a259fc
30 changed files with 89 additions and 92 deletions

View file

@ -58,7 +58,7 @@ void NetworkAdapter::send(const MACAddress& destination, const ARPPacket& packet
{
int size_in_bytes = sizeof(EthernetFrameHeader) + sizeof(ARPPacket);
auto buffer = ByteBuffer::create_zeroed(size_in_bytes);
auto* eth = (EthernetFrameHeader*)buffer.pointer();
auto* eth = (EthernetFrameHeader*)buffer.data();
eth->set_source(mac_address());
eth->set_destination(destination);
eth->set_ether_type(EtherType::ARP);
@ -72,7 +72,7 @@ void NetworkAdapter::send_ipv4(const MACAddress& destination_mac, const IPv4Addr
{
size_t size_in_bytes = sizeof(EthernetFrameHeader) + sizeof(IPv4Packet) + payload_size;
auto buffer = ByteBuffer::create_zeroed(size_in_bytes);
auto& eth = *(EthernetFrameHeader*)buffer.pointer();
auto& eth = *(EthernetFrameHeader*)buffer.data();
eth.set_source(mac_address());
eth.set_destination(destination_mac);
eth.set_ether_type(EtherType::IPv4);