1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -5,7 +5,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibFileSystem/FileSystem.h>
#include <LibTest/TestCase.h>
#include <fcntl.h>
@ -23,7 +23,7 @@ TEST_CASE(test_mktemp_unique_filename)
if (fork() == 0) {
char path[] = "/tmp/test.mktemp.XXXXXX";
auto temp_path = DeprecatedString::formatted("{}", mktemp(path));
auto temp_path = ByteString::formatted("{}", mktemp(path));
EXPECT(temp_path.characters());
unlink(path);
@ -33,10 +33,10 @@ TEST_CASE(test_mktemp_unique_filename)
} else {
wait(NULL);
auto path1 = DeprecatedString::formatted("{}", reinterpret_cast<char const*>(ptr));
auto path1 = ByteString::formatted("{}", reinterpret_cast<char const*>(ptr));
char path[] = "/tmp/test.mktemp.XXXXXX";
auto path2 = DeprecatedString::formatted("{}", mktemp(path));
auto path2 = ByteString::formatted("{}", mktemp(path));
EXPECT(path2.characters());
unlink(path);
@ -53,7 +53,7 @@ TEST_CASE(test_mkdtemp_unique_filename)
if (fork() == 0) {
char path[] = "/tmp/test.mkdtemp.XXXXXX";
auto temp_path = DeprecatedString::formatted("{}", mkdtemp(path));
auto temp_path = ByteString::formatted("{}", mkdtemp(path));
EXPECT(temp_path.characters());
rmdir(path);
@ -63,10 +63,10 @@ TEST_CASE(test_mkdtemp_unique_filename)
} else {
wait(NULL);
auto path1 = DeprecatedString::formatted("{}", reinterpret_cast<char const*>(ptr));
auto path1 = ByteString::formatted("{}", reinterpret_cast<char const*>(ptr));
char path[] = "/tmp/test.mkdtemp.XXXXXX";
auto path2 = DeprecatedString::formatted("{}", mkdtemp(path));
auto path2 = ByteString::formatted("{}", mkdtemp(path));
EXPECT(path2.characters());
rmdir(path);
@ -86,8 +86,8 @@ TEST_CASE(test_mkstemp_unique_filename)
auto fd = mkstemp(path);
EXPECT_NE(fd, -1);
auto temp_path_string = TRY_OR_FAIL(FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)));
auto temp_path = temp_path_string.to_deprecated_string();
auto temp_path_string = TRY_OR_FAIL(FileSystem::read_link(ByteString::formatted("/proc/{}/fd/{}", getpid(), fd)));
auto temp_path = temp_path_string.to_byte_string();
EXPECT(temp_path.characters());
close(fd);
@ -99,14 +99,14 @@ TEST_CASE(test_mkstemp_unique_filename)
} else {
wait(NULL);
auto path1 = DeprecatedString::formatted("{}", reinterpret_cast<char const*>(ptr));
auto path1 = ByteString::formatted("{}", reinterpret_cast<char const*>(ptr));
char path[] = "/tmp/test.mkstemp.XXXXXX";
auto fd = mkstemp(path);
EXPECT(fd != -1);
auto path2_string = TRY_OR_FAIL(FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)));
auto path2 = path2_string.to_deprecated_string();
auto path2_string = TRY_OR_FAIL(FileSystem::read_link(ByteString::formatted("/proc/{}/fd/{}", getpid(), fd)));
auto path2 = path2_string.to_byte_string();
EXPECT(path2.characters());
close(fd);
@ -128,8 +128,8 @@ TEST_CASE(test_mkstemps_unique_filename)
auto fd = mkstemps(path, 6);
EXPECT_NE(fd, -1);
auto temp_path_string = TRY_OR_FAIL(FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)));
auto temp_path = temp_path_string.to_deprecated_string();
auto temp_path_string = TRY_OR_FAIL(FileSystem::read_link(ByteString::formatted("/proc/{}/fd/{}", getpid(), fd)));
auto temp_path = temp_path_string.to_byte_string();
EXPECT(temp_path.characters());
close(fd);
@ -145,14 +145,14 @@ TEST_CASE(test_mkstemps_unique_filename)
} else {
wait(NULL);
auto path1 = DeprecatedString::formatted("{}", reinterpret_cast<char const*>(ptr));
auto path1 = ByteString::formatted("{}", reinterpret_cast<char const*>(ptr));
char path[] = "/tmp/test.mkstemps.prefixXXXXXXsuffix";
auto fd = mkstemps(path, 6);
EXPECT(fd != -1);
auto path2_string = TRY_OR_FAIL(FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)));
auto path2 = path2_string.to_deprecated_string();
auto path2_string = TRY_OR_FAIL(FileSystem::read_link(ByteString::formatted("/proc/{}/fd/{}", getpid(), fd)));
auto path2 = path2_string.to_byte_string();
EXPECT(path2.characters());
close(fd);