mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:34:57 +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:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -7,11 +7,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Result.h>
|
||||
|
||||
struct DlErrorMessage {
|
||||
DlErrorMessage(DeprecatedString&& other)
|
||||
DlErrorMessage(ByteString&& other)
|
||||
: text(move(other))
|
||||
{
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ struct DlErrorMessage {
|
|||
// from the one in libc.so
|
||||
virtual ~DlErrorMessage() = default;
|
||||
|
||||
DeprecatedString text;
|
||||
ByteString text;
|
||||
};
|
||||
|
||||
struct __Dl_info;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Types.h>
|
||||
#include <bits/dlfcn_integration.h>
|
||||
#include <dlfcn.h>
|
||||
|
@ -25,7 +25,7 @@ __thread char* s_dlerror_text = NULL;
|
|||
__thread bool s_dlerror_retrieved = false;
|
||||
#endif
|
||||
|
||||
static void store_error(DeprecatedString const& error)
|
||||
static void store_error(ByteString const& error)
|
||||
{
|
||||
free(s_dlerror_text);
|
||||
s_dlerror_text = strdup(error.characters());
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
#include <arpa/inet.h>
|
||||
|
@ -54,8 +54,8 @@ struct ServiceFileLine {
|
|||
|
||||
static ErrorOr<Optional<ServiceFileLine>> parse_service_file_line(char const* line, ssize_t read);
|
||||
static servent __getserv_buffer;
|
||||
static DeprecatedString __getserv_name_buffer;
|
||||
static DeprecatedString __getserv_protocol_buffer;
|
||||
static ByteString __getserv_name_buffer;
|
||||
static ByteString __getserv_protocol_buffer;
|
||||
static int __getserv_port_buffer;
|
||||
static Vector<ByteBuffer> __getserv_alias_list_buffer;
|
||||
static Vector<char*> __getserv_alias_list;
|
||||
|
@ -68,7 +68,7 @@ static char const* protocols_path = "/etc/protocols";
|
|||
|
||||
static bool fill_getproto_buffers(char const* line, ssize_t read);
|
||||
static protoent __getproto_buffer;
|
||||
static DeprecatedString __getproto_name_buffer;
|
||||
static ByteString __getproto_name_buffer;
|
||||
static Vector<ByteBuffer> __getproto_alias_list_buffer;
|
||||
static Vector<char*> __getproto_alias_list;
|
||||
static int __getproto_protocol_buffer;
|
||||
|
@ -96,7 +96,7 @@ static int connect_to_lookup_server()
|
|||
return fd;
|
||||
}
|
||||
|
||||
static DeprecatedString gethostbyname_name_buffer;
|
||||
static ByteString gethostbyname_name_buffer;
|
||||
|
||||
hostent* gethostbyname(char const* name)
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ int gethostbyname_r(char const* __restrict name, struct hostent* __restrict ret,
|
|||
auto ipv4_address = IPv4Address::from_string({ name, strlen(name) });
|
||||
|
||||
if (ipv4_address.has_value()) {
|
||||
return populate_ret(ipv4_address.value().to_deprecated_string().characters(), ipv4_address.value().to_in_addr_t());
|
||||
return populate_ret(ipv4_address.value().to_byte_string().characters(), ipv4_address.value().to_in_addr_t());
|
||||
}
|
||||
|
||||
int fd = connect_to_lookup_server();
|
||||
|
@ -318,7 +318,7 @@ int gethostbyname_r(char const* __restrict name, struct hostent* __restrict ret,
|
|||
return populate_ret(name, address);
|
||||
}
|
||||
|
||||
static DeprecatedString gethostbyaddr_name_buffer;
|
||||
static ByteString gethostbyaddr_name_buffer;
|
||||
|
||||
hostent* gethostbyaddr(void const* addr, socklen_t addr_size, int type)
|
||||
{
|
||||
|
@ -474,9 +474,9 @@ struct servent* getservent()
|
|||
|
||||
servent* service_entry = nullptr;
|
||||
|
||||
__getserv_name_buffer = service_file_line.value().name.to_deprecated_string();
|
||||
__getserv_name_buffer = service_file_line.value().name.to_byte_string();
|
||||
__getserv_port_buffer = service_file_line.value().port;
|
||||
__getserv_protocol_buffer = service_file_line.value().protocol.to_deprecated_string();
|
||||
__getserv_protocol_buffer = service_file_line.value().protocol.to_byte_string();
|
||||
__getserv_alias_list_buffer = service_file_line.value().aliases;
|
||||
|
||||
__getserv_buffer.s_name = const_cast<char*>(__getserv_name_buffer.characters());
|
||||
|
@ -583,9 +583,9 @@ static ErrorOr<Optional<ServiceFileLine>> parse_service_file_line(char const* li
|
|||
if (split_line.size() < 2)
|
||||
return Error::from_string_view("malformed service file"sv);
|
||||
|
||||
auto name = TRY(String::from_deprecated_string(split_line[0]));
|
||||
auto name = TRY(String::from_byte_string(split_line[0]));
|
||||
|
||||
auto port_protocol = TRY(String::from_deprecated_string(split_line[1]));
|
||||
auto port_protocol = TRY(String::from_byte_string(split_line[1]));
|
||||
auto port_protocol_split = TRY(port_protocol.split('/'));
|
||||
|
||||
if (port_protocol_split.size() < 2)
|
||||
|
@ -756,7 +756,7 @@ void endprotoent()
|
|||
|
||||
static bool fill_getproto_buffers(char const* line, ssize_t read)
|
||||
{
|
||||
DeprecatedString string_line = DeprecatedString(line, read);
|
||||
ByteString string_line = ByteString(line, read);
|
||||
auto split_line = string_line.replace(" "sv, "\t"sv, ReplaceMode::All).split('\t');
|
||||
|
||||
// This indicates an incorrect file format. Protocols file entries should
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <errno.h>
|
||||
|
@ -20,8 +20,8 @@ static FILE* s_stream = nullptr;
|
|||
static unsigned s_line_number = 0;
|
||||
static struct spwd s_shadow_entry;
|
||||
|
||||
static DeprecatedString s_name;
|
||||
static DeprecatedString s_pwdp;
|
||||
static ByteString s_name;
|
||||
static ByteString s_pwdp;
|
||||
|
||||
void setspent()
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ struct spwd* getspnam(char const* name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool parse_shadow_entry(DeprecatedString const& line)
|
||||
static bool parse_shadow_entry(ByteString const& line)
|
||||
{
|
||||
auto parts = line.split_view(':', SplitBehavior::KeepEmpty);
|
||||
if (parts.size() != 9) {
|
||||
|
@ -168,7 +168,7 @@ struct spwd* getspent()
|
|||
if ((!s || !s[0]) && feof(s_stream))
|
||||
return nullptr;
|
||||
|
||||
DeprecatedString line(s, Chomp);
|
||||
ByteString line(s, Chomp);
|
||||
if (parse_shadow_entry(line))
|
||||
return &s_shadow_entry;
|
||||
// Otherwise, proceed to the next line.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/BuiltinWrappers.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/PrintfImplementation.h>
|
||||
#include <AK/ScopedValueRollback.h>
|
||||
|
@ -947,7 +947,7 @@ int vasprintf(char** strp, char const* fmt, va_list ap)
|
|||
builder.appendvf(fmt, ap);
|
||||
VERIFY(builder.length() <= NumericLimits<int>::max());
|
||||
int length = builder.length();
|
||||
*strp = strdup(builder.to_deprecated_string().characters());
|
||||
*strp = strdup(builder.to_byte_string().characters());
|
||||
return length;
|
||||
}
|
||||
|
||||
|
@ -961,7 +961,7 @@ int asprintf(char** strp, char const* fmt, ...)
|
|||
va_end(ap);
|
||||
VERIFY(builder.length() <= NumericLimits<int>::max());
|
||||
int length = builder.length();
|
||||
*strp = strdup(builder.to_deprecated_string().characters());
|
||||
*strp = strdup(builder.to_byte_string().characters());
|
||||
return length;
|
||||
}
|
||||
|
||||
|
|
|
@ -649,7 +649,7 @@ int ptsname_r(int fd, char* buffer, size_t size)
|
|||
return -1;
|
||||
}
|
||||
memset(buffer, 0, devpts_path_builder.length() + 1);
|
||||
auto full_devpts_path_string = devpts_path_builder.to_deprecated_string();
|
||||
auto full_devpts_path_string = devpts_path_builder.to_byte_string();
|
||||
if (!full_devpts_path_string.copy_characters_to_buffer(buffer, size)) {
|
||||
errno = ERANGE;
|
||||
return -1;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -34,7 +34,7 @@ ALWAYS_INLINE int graphics_connector_get_head_edid(int fd, GraphicsHeadEDID* inf
|
|||
}
|
||||
auto minor_number = minor(display_connector_stat.st_rdev);
|
||||
|
||||
auto edid_fd = open(DeprecatedString::formatted("/sys/devices/graphics/connectors/{}/edid", minor_number).characters(), O_RDONLY);
|
||||
auto edid_fd = open(ByteString::formatted("/sys/devices/graphics/connectors/{}/edid", minor_number).characters(), O_RDONLY);
|
||||
if (edid_fd < 0) {
|
||||
return edid_fd;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// Has to be defined before including due to legacy Unices
|
||||
#define SYSLOG_NAMES 1
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -124,7 +124,7 @@ void vsyslog_r(int priority, struct syslog_data* data, char const* message, va_l
|
|||
combined.appendff("{}: ", get_syslog_ident(data));
|
||||
|
||||
combined.appendvf(message, args);
|
||||
auto combined_string = combined.to_deprecated_string();
|
||||
auto combined_string = combined.to_byte_string();
|
||||
|
||||
if (data->logopt & LOG_CONS)
|
||||
dbgputstr(combined_string.characters(), combined_string.length());
|
||||
|
|
|
@ -414,7 +414,7 @@ size_t strftime(char* destination, size_t max_size, char const* format, const st
|
|||
return 0;
|
||||
}
|
||||
|
||||
auto str = builder.to_deprecated_string();
|
||||
auto str = builder.to_byte_string();
|
||||
bool fits = str.copy_characters_to_buffer(destination, max_size);
|
||||
return fits ? str.length() : 0;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/ScopedValueRollback.h>
|
||||
#include <AK/Vector.h>
|
||||
|
@ -190,12 +190,12 @@ int execvpe(char const* filename, char* const argv[], char* const envp[])
|
|||
ScopedValueRollback errno_rollback(errno);
|
||||
|
||||
// TODO: Make this use the PATH search implementation from LibFileSystem.
|
||||
DeprecatedString path = getenv("PATH");
|
||||
ByteString path = getenv("PATH");
|
||||
if (path.is_empty())
|
||||
path = DEFAULT_PATH;
|
||||
auto parts = path.split(':');
|
||||
for (auto& part : parts) {
|
||||
auto candidate = DeprecatedString::formatted("{}/{}", part, filename);
|
||||
auto candidate = ByteString::formatted("{}/{}", part, filename);
|
||||
int rc = execve(candidate.characters(), argv, envp);
|
||||
if (rc < 0 && errno != ENOENT) {
|
||||
errno_rollback.set_override_rollback_value(errno);
|
||||
|
@ -881,13 +881,13 @@ void sync()
|
|||
syscall(SC_sync);
|
||||
}
|
||||
|
||||
static Optional<DeprecatedString> getlogin_buffer {};
|
||||
static Optional<ByteString> getlogin_buffer {};
|
||||
|
||||
char* getlogin()
|
||||
{
|
||||
if (!getlogin_buffer.has_value()) {
|
||||
if (auto* passwd = getpwuid(getuid())) {
|
||||
getlogin_buffer = DeprecatedString(passwd->pw_name);
|
||||
getlogin_buffer = ByteString(passwd->pw_name);
|
||||
}
|
||||
endpwent();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue