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:
parent
dd696e7c75
commit
8f45a259fc
30 changed files with 89 additions and 92 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue