mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 01:26:22 +00:00
Everywhere: Port to String::copy_characters_to_buffer()
This commit is contained in:
parent
be6cce5530
commit
852454746e
Notes:
sideshowbarker
2024-07-19 02:59:36 +09:00
Author: https://github.com/bugaevc
Commit: 852454746e
Pull-request: https://github.com/SerenityOS/serenity/pull/3296
Reviewed-by: https://github.com/BenWiederhake
Reviewed-by: https://github.com/alimpfard
8 changed files with 39 additions and 18 deletions
|
@ -125,7 +125,10 @@ int main(int argc, char** argv)
|
|||
ping_packet.header.code = 0;
|
||||
ping_packet.header.un.echo.id = htons(pid);
|
||||
ping_packet.header.un.echo.sequence = htons(seq++);
|
||||
strlcpy(ping_packet.msg, "Hello there!\n", sizeof(ping_packet.msg));
|
||||
|
||||
bool fits = String("Hello there!\n").copy_characters_to_buffer(ping_packet.msg, sizeof(ping_packet.msg));
|
||||
// It's a constant string, we can be sure that it fits.
|
||||
ASSERT(fits);
|
||||
|
||||
ping_packet.header.checksum = internet_checksum(&ping_packet, sizeof(PingPacket));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue